Quick Start
How It Works
| Component | Purpose | Behavior |
|---|---|---|
| ClarifyTool | Core tool implementation | Pauses execution for user input |
| ClarifyHandler | Channel-specific behavior | Routes questions to CLI/bot/UI |
| Context Integration | Runtime handler resolution | Uses ctx[‘clarify_handler’] if available |
Channel Integration
CLI Usage
Bot Usage
Custom Context Handler
Handler Resolution
The tool uses this priority order for handling questions:- Context Handler:
kwargs["ctx"]["clarify_handler"](highest priority) - Tool Handler:
self.handler(defaultClarifyHandler()) - Fallback: Returns guidance message when no interactive channel available
Configuration Options
Tool Schema
Bot Auto-Approval
clarify tool is included in the bot’s default auto-approve list, so it won’t require manual approval in bot environments.
Common Patterns
Progressive Clarification
Context-Aware Questions
Fallback Behavior
Best Practices
Use Sparingly
Use Sparingly
Only call clarify when you genuinely cannot proceed without user input. Don’t ask for preferences that have reasonable defaults.Good: “Which API endpoint format?” when building an API
Bad: “Should I use descriptive variable names?” (obvious default)
Provide Clear Choices
Provide Clear Choices
When possible, offer specific choices rather than open-ended questions.Good:
choices=["fastapi", "flask", "django"]
Bad: "What Python web framework should I use?" (no choices)Handle Fallbacks Gracefully
Handle Fallbacks Gracefully
Always check if the response indicates no interactive channel and proceed with sensible defaults.
Context-Aware Questions
Context-Aware Questions
Frame questions with enough context for users to make informed decisions.Good: “Which authentication method for your user API?”
Bad: “Which auth?” (unclear context)
Related
Tools Overview
Core tool system and custom tools
Agent Configuration
Agent setup and tool integration

