Skip to main content
Glama

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

Implementation Reference

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

Other Tools

Related Tools

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