Skip to main content
Glama

ask_clarification

Ask targeted questions to clarify user requirements and improve the prompt engineering process, ensuring accurate and optimized outputs for Claude Code.

Instructions

Ask clarifying questions to better understand user requirements and refine the prompt engineering process.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
questionsYesList of clarifying questions to ask the user
sessionIdYesThe session ID for this prompt engineering session

Implementation Reference

  • The handler function for the 'ask_clarification' tool. Validates arguments using isClarificationArgs, then formats and returns the clarifying questions to the user with instructions to use 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, }; }
  • Input schema definition for the 'ask_clarification' tool, specifying sessionId and questions array as required parameters.
    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 (via ASK_CLARIFICATION_TOOL constant) in the list of available tools returned by ListToolsRequest.
    server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: [ENGINEER_PROMPT_TOOL, ASK_CLARIFICATION_TOOL, ANSWER_QUESTIONS_TOOL, AUTO_OPTIMIZE_TOOL], }));
  • Type guard helper function to validate and type-check 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) ); }

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