Skip to main content
Glama
mako10k

MCP-Confirm

by mako10k

ask_yes_no

Get user confirmation through yes/no questions when AI needs clarification or verification during interactions.

Instructions

Ask a yes/no confirmation question to the user when the AI needs clarification or verification

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
questionYesThe yes/no confirmation question to ask the user

Implementation Reference

  • The handler function for the 'ask_yes_no' tool. It extracts the question from input arguments, constructs an elicitation request schema for a boolean answer, sends the request via sendElicitationRequest, and returns the user's yes/no response or handles errors.
    private async handleAskYesNo(args: Record<string, unknown>) { const question = typeof args.question === "string" ? args.question : "Please answer yes or no"; const elicitationParams: ElicitationParams = { message: question, requestedSchema: { type: "object", properties: { answer: { type: "boolean", title: "Your Answer", description: "Please select yes or no", }, }, required: ["answer"], }, // Use default timeout instead of hardcoded short timeout timeoutMs: this.config.defaultTimeoutMs, }; try { const response = await this.sendElicitationRequest(elicitationParams); if (response.action === "accept" && response.content) { return { content: [ { type: "text", text: `User answered: ${response.content.answer ? "Yes" : "No"}`, }, ], }; } else { return { content: [ { type: "text", text: `User ${response.action}ed the question.`, }, ], }; } } catch (error) { return this.createErrorResponse( `Elicitation request failed: ${error instanceof Error ? error.message : String(error)}` ); } }
  • Defines the schema for the 'ask_yes_no' tool, specifying the name, description, and input schema that requires a 'question' string parameter.
    private createAskYesNoTool(): Tool { return { name: "ask_yes_no", description: "Ask a yes/no confirmation question to the user when the AI needs clarification or verification", inputSchema: { type: "object", properties: { question: { type: "string", description: "The yes/no confirmation question to ask the user", }, }, required: ["question"], }, }; }
  • src/index.ts:231-241 (registration)
    Registers the 'ask_yes_no' tool as part of the list of available tools returned in response to ListTools requests.
    private getToolDefinitions(): Tool[] { return [ this.createAskYesNoTool(), this.createConfirmActionTool(), this.createClarifyIntentTool(), this.createVerifyUnderstandingTool(), this.createCollectRatingTool(), this.createElicitCustomTool(), this.createSearchLogsTool(), this.createAnalyzeLogsTool(), ];
  • src/index.ts:518-519 (registration)
    Dispatches 'ask_yes_no' tool calls to the handleAskYesNo handler in the executeToolCall switch statement.
    case "ask_yes_no": return await this.handleAskYesNo(args);

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/mako10k/mcp-confirm'

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