answer_questions
Provide answers to clarifying questions to continue prompt engineering for Claude Code, enabling interactive refinement of optimized prompts.
Instructions
Provide answers to clarifying questions and continue the prompt engineering process.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sessionId | Yes | The session ID for this prompt engineering session | |
| answers | Yes | Answers to the previously asked questions |
Implementation Reference
- index.ts:640-673 (handler)Executes the answer_questions tool: validates args, retrieves session, incorporates answers as refinements, generates final optimized prompt using engineerPrompt, cleans up 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)Tool object definition including name, description, and inputSchema (JSON Schema) for the answer_questions tool.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 (via ANSWER_QUESTIONS_TOOL) in the list 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 arguments for the answer_questions tool handler.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) ); }