elicit_custom
Create custom confirmation dialogs with specific data collection schemas when standard confirmation tools are insufficient for your needs.
Instructions
Create a custom confirmation dialog with specific schema when standard tools don't fit
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| message | Yes | Message to display to the user | |
| schema | Yes | JSON schema defining the structure of information to collect |
Implementation Reference
- src/index.ts:900-943 (handler)The primary handler function that implements the logic for the 'elicit_custom' tool. It processes the input arguments to create an elicitation request with a custom message and schema, sends it via sendElicitationRequest, and formats the response as MCP tool output.private async handleElicitCustom(args: Record<string, unknown>) { const message = typeof args.message === "string" ? args.message : "Please provide input"; const schema = typeof args.schema === "object" && args.schema !== null ? (args.schema as ElicitationSchema) : { type: "object" as const, properties: {}, }; const elicitationParams: ElicitationParams = { message, requestedSchema: schema, }; try { const response = await this.sendElicitationRequest(elicitationParams); if (response.action === "accept") { return { content: [ { type: "text", text: `Custom elicitation completed:\n${JSON.stringify(response.content, null, 2)}`, }, ], }; } else { return { content: [ { type: "text", text: `User ${response.action}ed the custom elicitation.`, }, ], }; } } catch (error) { return this.createErrorResponse( `Custom elicitation failed: ${error instanceof Error ? error.message : String(error)}` ); } }
- src/index.ts:372-393 (schema)Defines the Tool object for 'elicit_custom', including its name, description, and inputSchema which specifies the expected input structure (message and schema).private createElicitCustomTool(): Tool { return { name: "elicit_custom", description: "Create a custom confirmation dialog with specific schema when standard tools don't fit", inputSchema: { type: "object", properties: { message: { type: "string", description: "Message to display to the user", }, schema: { type: "object", description: "JSON schema defining the structure of information to collect", }, }, required: ["message", "schema"], }, }; }
- src/index.ts:231-242 (registration)Registers the 'elicit_custom' tool by including this.createElicitCustomTool() in the array of available tools returned by getToolDefinitions(), which is used by the ListTools handler.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 tool execution dispatcher (switch statement in executeToolCall) registers and routes calls to the 'elicit_custom' handler via its specific case statement.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}`); } }