ask_clarification
Ask clarifying questions to understand user requirements and refine prompts for Claude Code engineering.
Instructions
Ask clarifying questions to better understand user requirements and refine the prompt engineering process.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sessionId | Yes | The session ID for this prompt engineering session | |
| questions | Yes | List of clarifying questions to ask the user |
Implementation Reference
- index.ts:625-638 (handler)Executes the ask_clarification tool: validates arguments and responds with formatted clarifying questions for the user to answer using the answer_questions tool.case "ask_clarification": { if (!isClarificationArgs(args)) { throw new Error("Invalid arguments for ask_clarification"); } const { sessionId, questions } = args; return { content: [{ type: "text", text: `Please answer these clarifying questions:\n\n${questions.map((q, i) => `${i + 1}. ${q}`).join('\n')}\n\nUse the answer_questions tool with session ID "${sessionId}" when ready.` }], isError: false, }; }
- index.ts:58-73 (schema)JSON Schema defining the input parameters for the ask_clarification tool: sessionId (string, required) and questions (array of strings, required).inputSchema: { type: "object", properties: { sessionId: { type: "string", description: "The session ID for this prompt engineering session" }, questions: { type: "array", items: { type: "string" }, description: "List of clarifying questions to ask the user" } }, required: ["sessionId", "questions"], title: "ask_clarificationArguments" }
- index.ts:570-572 (registration)Registers the ask_clarification tool (as ASK_CLARIFICATION_TOOL) in the list of available tools returned by ListToolsRequestSchema.server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: [ENGINEER_PROMPT_TOOL, ASK_CLARIFICATION_TOOL, ANSWER_QUESTIONS_TOOL, AUTO_OPTIMIZE_TOOL], }));
- index.ts:151-163 (helper)Type guard function used to validate the arguments passed to the ask_clarification tool handler.function isClarificationArgs(args: unknown): args is { sessionId: string; questions: string[]; } { return ( typeof args === "object" && args !== null && "sessionId" in args && typeof (args as { sessionId: string }).sessionId === "string" && "questions" in args && Array.isArray((args as { questions: string[] }).questions) ); }
- index.ts:55-74 (schema)Full Tool object definition for ask_clarification, including name, description, and input schema.const ASK_CLARIFICATION_TOOL: Tool = { name: "ask_clarification", description: "Ask clarifying questions to better understand user requirements and refine the prompt engineering process.", inputSchema: { type: "object", properties: { sessionId: { type: "string", description: "The session ID for this prompt engineering session" }, questions: { type: "array", items: { type: "string" }, description: "List of clarifying questions to ask the user" } }, required: ["sessionId", "questions"], title: "ask_clarificationArguments" } };