verify_understanding
Confirm AI understanding of user requests by verifying key points and proposed next steps to ensure accurate task execution.
Instructions
Verify that the AI correctly understood the user's requirements before proceeding
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| key_points | No | Key points that the AI wants to confirm | |
| next_steps | No | What the AI plans to do next if understanding is correct | |
| understanding | Yes | AI's understanding of the user's request |
Implementation Reference
- src/index.ts:825-897 (handler)The main handler function for the 'verify_understanding' tool. It constructs a user-facing message summarizing the AI's understanding, key points, and next steps. It then sends an elicitation request to the user via the MCP protocol with a schema expecting confirmation of correctness, corrections, and approval to proceed. Returns the user's response or error.private async handleVerifyUnderstanding(args: Record<string, unknown>) { const understanding = typeof args.understanding === "string" ? args.understanding : "Unknown understanding"; const key_points = Array.isArray(args.key_points) ? args.key_points : undefined; const next_steps = typeof args.next_steps === "string" ? args.next_steps : undefined; let message = `Please verify my understanding:\n\n**What I understood**: ${understanding}`; if (key_points && key_points.length > 0) { message += `\n\n**Key points to confirm**:\n${key_points.map((point: unknown, i: number) => `${i + 1}. ${String(point)}`).join("\n")}`; } if (next_steps) { message += `\n\n**What I plan to do next**: ${next_steps}`; } const elicitationParams: ElicitationParams = { message, requestedSchema: { type: "object", properties: { understanding_correct: { type: "boolean", title: "Understanding Correct", description: "Is my understanding correct?", }, corrections: { type: "string", title: "Corrections", description: "What should I correct or clarify?", }, proceed: { type: "boolean", title: "Proceed", description: "Should I proceed with the planned next steps?", }, }, required: ["understanding_correct"], }, }; try { const response = await this.sendElicitationRequest(elicitationParams); if (response.action === "accept") { return { content: [ { type: "text", text: `Understanding verification result:\n${JSON.stringify(response.content, null, 2)}`, }, ], }; } else { return { content: [ { type: "text", text: `User ${response.action}ed the understanding verification.`, }, ], }; } } catch (error) { return this.createErrorResponse( `Understanding verification failed: ${error instanceof Error ? error.message : String(error)}` ); }
- src/index.ts:319-347 (schema)Tool definition including name, description, and input schema for 'verify_understanding'. The schema defines the expected inputs: understanding (required string), optional key_points array, and next_steps string.private createVerifyUnderstandingTool(): Tool { return { name: "verify_understanding", description: "Verify that the AI correctly understood the user's requirements before proceeding", inputSchema: { type: "object", properties: { understanding: { type: "string", description: "AI's understanding of the user's request", }, key_points: { type: "array", items: { type: "string", }, description: "Key points that the AI wants to confirm", }, next_steps: { type: "string", description: "What the AI plans to do next if understanding is correct", }, }, required: ["understanding"], }, }; }
- src/index.ts:231-241 (registration)The getToolDefinitions method registers the 'verify_understanding' tool by including it in the list of available tools returned for 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:516-537 (registration)The executeToolCall switch statement registers the dispatch for 'verify_understanding' by calling its handler when the tool name matches.private async executeToolCall(name: string, args: Record<string, unknown>) { switch (name) { case "ask_yes_no": return await this.handleAskYesNo(args); case "confirm_action": return await this.handleConfirmAction(args); case "clarify_intent": return await this.handleClarifyIntent(args); case "verify_understanding": return await this.handleVerifyUnderstanding(args); case "collect_rating": return await this.handleCollectRating(args); case "elicit_custom": return await this.handleElicitCustom(args); case "search_logs": return await this.handleSearchLogs(args); case "analyze_logs": return await this.handleAnalyzeLogs(args); default: throw new Error(`Unknown tool: ${name}`); } }