Skip to main content
Glama

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
NameRequiredDescriptionDefault
sessionIdYesThe session ID for this prompt engineering session
answersYesAnswers to the previously asked questions

Implementation Reference

  • 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, }; }
  • 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], }));
  • 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) ); }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/gr3enarr0w/cc_peng_mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server