answer_questions
Resolve clarifying questions and advance prompt engineering by providing answers within a session, enabling optimized Claude Code prompts.
Instructions
Provide answers to clarifying questions and continue the prompt engineering process.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| answers | Yes | Answers to the previously asked questions | |
| sessionId | Yes | The session ID for this prompt engineering session |
Implementation Reference
- index.ts:640-673 (handler)The handler for the 'answer_questions' tool. Validates input using isAnswerArgs, retrieves the session, appends answers to refinements, generates the final optimized prompt using engineerPrompt, deletes the session, and returns the result.case "answer_questions": { if (!isAnswerArgs(args)) { throw new Error("Invalid arguments for answer_questions"); } const { sessionId, answers } = args; const session = activeSessions.get(sessionId); if (!session) { throw new Error(`Session ${sessionId} not found`); } // Update session with answers session.refinements.push(...answers); // Generate final engineered prompt const engineeredPrompt = await engineerPrompt( session.originalPrompt, session.language, session.context.join('\n'), session.refinements ); // Clean up session activeSessions.delete(sessionId); return { content: [{ type: "text", text: `**Final Optimized Prompt for Claude Code:**\n\n${engineeredPrompt}\n\n**Are you ready to use this prompt?**` }], isError: false, }; }
- index.ts:76-95 (schema)Defines the Tool object for 'answer_questions', including name, description, and inputSchema with properties for sessionId and answers.const ANSWER_QUESTIONS_TOOL: Tool = { name: "answer_questions", description: "Provide answers to clarifying questions and continue the prompt engineering process.", inputSchema: { type: "object", properties: { sessionId: { type: "string", description: "The session ID for this prompt engineering session" }, answers: { type: "array", items: { type: "string" }, description: "Answers to the previously asked questions" } }, required: ["sessionId", "answers"], title: "answer_questionsArguments" } };
- index.ts:570-572 (registration)Registers the 'answer_questions' tool (as ANSWER_QUESTIONS_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:165-177 (helper)Type guard function used to validate the arguments for the 'answer_questions' tool.function isAnswerArgs(args: unknown): args is { sessionId: string; answers: string[]; } { return ( typeof args === "object" && args !== null && "sessionId" in args && typeof (args as { sessionId: string }).sessionId === "string" && "answers" in args && Array.isArray((args as { answers: string[] }).answers) ); }