Skip to main content
Glama
mako10k

MCP-Confirm

by mako10k

collect_rating

Request and gather user feedback on AI response quality to improve accuracy and user satisfaction. Allows specifying the subject and adding context for precise feedback collection.

Instructions

Collect user satisfaction rating for AI's response or help quality

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
descriptionNoAdditional context for the rating request
subjectYesWhat to rate (e.g., 'this response', 'my help with your task')

Implementation Reference

  • The handler function for the 'collect_rating' tool. It constructs an elicitation request to collect a numerical rating (1-10) and optional comment from the user, sends it via sendElicitationRequest, and returns the formatted response.
    private async handleCollectRating(args: Record<string, unknown>) { const subject = typeof args.subject === "string" ? args.subject : "this item"; const description = typeof args.description === "string" ? args.description : undefined; const elicitationParams: ElicitationParams = { message: `Please rate ${subject}`, requestedSchema: { type: "object", properties: { rating: { type: "number", title: "Rating (1-10 scale)", description: description || `Rate ${subject} from 1 to 10 (10 is the highest/best)`, minimum: 1, maximum: 10, }, comment: { type: "string", title: "Comment", description: "Optional comment about your rating", }, }, required: ["rating"], }, // 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) { const rating = response.content.rating as number; const comment = response.content.comment as string | undefined; return { content: [ { type: "text", text: `User rating for ${subject}: ${rating}/10${comment ? `\nComment: ${comment}` : ""}`, }, ], }; } else { return { content: [ { type: "text", text: `User ${response.action}ed the rating request.`, }, ], }; } } catch (error) { return this.createErrorResponse( `Rating collection failed: ${error instanceof Error ? error.message : String(error)}` ); } }
  • Defines the tool specification including name, description, and input schema for 'collect_rating'.
    private createCollectRatingTool(): Tool { return { name: "collect_rating", description: "Collect user satisfaction rating for AI's response or help quality", inputSchema: { type: "object", properties: { subject: { type: "string", description: "What to rate (e.g., 'this response', 'my help with your task')", }, description: { type: "string", description: "Additional context for the rating request", }, }, required: ["subject"], }, }; }
  • src/index.ts:231-241 (registration)
    Registers the 'collect_rating' tool by including it in the list of available tools returned by 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 switch statement in executeToolCall that dispatches 'collect_rating' calls to the handleCollectRating handler.
    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}`); } }

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

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