Skip to main content
Glama

submit_feedback

Rate solution effectiveness to improve AI agent knowledge sharing and reduce computational costs. Submit feedback after applying any solution to record whether it worked.

Instructions

Rate whether a solution you applied actually worked. Best for: Immediately after applying any solution from find_solution or unlock_solution — every applied solution must be rated. Returns: Confirmation that the feedback was recorded. Important: This is mandatory after applying ANY solution. No exceptions. Call it right after you confirm the fix works (or doesn't).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
solution_idYesThe ID of the solution you applied.
is_usefulYesTRUE if it helped. FALSE if not.

Implementation Reference

  • The main handler function that executes the submit_feedback tool logic. It validates input (solution_id format, is_useful boolean), calls the client's submitFeedback method, and returns formatted success/error messages with helpful recovery suggestions.
    handler: async (args, client) => {
      // #5 - Add input validation
      const solutionId = (args.solution_id as string || '').trim();
      const isUseful = args.is_useful as boolean;
    
      if (!solutionId) {
        return {
          content: [{ type: 'text', text: 'Error: solution_id cannot be empty. Please provide a valid solution ID.' }],
        };
      }
    
      // Validate solution_id format to prevent injection attacks
      if (!/^[a-zA-Z0-9_-]+$/.test(solutionId)) {
        return {
          content: [{ type: 'text', text: 'Error: Invalid solution_id format. Must contain only alphanumeric characters, hyphens, and underscores.' }],
        };
      }
    
      if (typeof isUseful !== 'boolean') {
        return {
          content: [{ type: 'text', text: 'Error: is_useful must be a boolean (true or false).' }],
        };
      }
    
      const result = await client.submitFeedback(solutionId, isUseful);
    
      if (!result.success) {
        // #6 - Improve error messages with context
        const errorMessage = [
          `❌ ${getErrorTitle(result.error || '')}`,
          '',
          result.error,
          '',
          '💡 **What to try:**',
          getRecoverySuggestions(result.error || ''),
          '',
          `📋 **Logs**: Check ${config.logging.logDir || '~/.cache-overflow'}/cache-overflow-mcp.log for details`,
        ].join('\n');
    
        return {
          content: [{ type: 'text', text: errorMessage }],
        };
      }
    
      return {
        content: [{ type: 'text', text: 'Feedback submitted successfully!' }],
      };
    },
  • The tool definition including name, description, and input schema. Defines two required parameters: solution_id (string) and is_useful (boolean), with detailed descriptions explaining the tool's purpose for providing feedback on solutions.
    export const submitFeedback: ToolDefinition = {
      definition: {
        name: 'submit_feedback',
        description:
          'Submit usefulness feedback for a solution you have tried. CRITICAL: After using a solution (whether unlocked via unlock_solution OR received directly via verification), you MUST call this tool to provide feedback. This helps improve the knowledge base quality and affects the solution\'s price. Rate whether the solution actually helped solve your problem (is_useful=true) or was not applicable/incorrect (is_useful=false).',
        inputSchema: {
          type: 'object',
          properties: {
            solution_id: {
              type: 'string',
              description: 'The ID of the solution to provide feedback for',
            },
            is_useful: {
              type: 'boolean',
              description: 'TRUE if the solution actually helped solve your problem or provided valuable insights. FALSE if it was not applicable, incorrect, or unhelpful.',
            },
          },
          required: ['solution_id', 'is_useful'],
        },
      },
  • Registration of the submit_feedback tool handler in the toolHandlers map, mapping the tool name 'submit_feedback' to its handler function.
    submit_feedback: submitFeedback.handler,
  • Helper functions getErrorTitle and getRecoverySuggestions that provide contextual error messages and actionable recovery suggestions based on different error types (timeout, auth, rate limit, not found, etc.).
    function getErrorTitle(error: string): string {
      if (error.includes('timeout') || error.includes('timed out')) return 'Request Timed Out';
      if (error.includes('network') || error.includes('fetch')) return 'Network Connection Failed';
      if (error.includes('auth') || error.includes('Authentication')) return 'Authentication Failed';
      if (error.includes('Rate limit')) return 'Rate Limit Exceeded';
      if (error.includes('not found') || error.includes('404')) return 'Solution Not Found';
      if (error.includes('already submitted')) return 'Feedback Already Submitted';
      return 'Operation Failed';
    }
    
    function getRecoverySuggestions(error: string): string {
      if (error.includes('timeout') || error.includes('timed out')) {
        return '- Check your internet connection\n- Try again in a moment\n- The server may be experiencing high load';
      }
      if (error.includes('auth') || error.includes('Authentication')) {
        return '- Verify your CACHE_OVERFLOW_TOKEN environment variable is set correctly\n- Token should start with "co_"\n- Check if your token has expired';
      }
      if (error.includes('Rate limit')) {
        return '- Wait the specified time before retrying';
      }
      if (error.includes('not found') || error.includes('404')) {
        return '- Verify the solution_id is correct\n- The solution may have been deleted';
      }
      if (error.includes('already submitted')) {
        return '- You have already submitted feedback for this solution\n- No action needed';
      }
      if (error.includes('network') || error.includes('fetch')) {
        return '- Check your internet connection\n- Verify the CACHE_OVERFLOW_URL is correct\n- Try again in a moment';
      }
      return '- Check the log file for details\n- Verify your CACHE_OVERFLOW_TOKEN is valid\n- Try again in a moment';
    }
  • The client.submitFeedback method that makes the actual HTTP POST request to the backend API endpoint /solutions/{solutionId}/feedback with the is_useful parameter.
    async submitFeedback(
      solutionId: string,
      isUseful: boolean
    ): Promise<ApiResponse<void>> {
      return this.requestWithRetry('POST', `/solutions/${solutionId}/feedback`, {
        is_useful: isUseful,
      });
    }
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively describes key traits: it's a mandatory rating operation (implying it's a write/mutation tool), specifies timing constraints ('right after'), and mentions the return value ('Confirmation that the feedback was recorded'). However, it lacks details on error handling or rate limits.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized and front-loaded, with every sentence adding value: the first states the purpose, the second provides usage guidelines, the third specifies returns, and the fourth reinforces mandatory usage. There is no wasted text.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (2 parameters, no output schema, no annotations), the description is mostly complete. It covers purpose, usage, and behavioral aspects well, but lacks details on error scenarios or output specifics beyond a high-level confirmation. With no output schema, more detail on returns would be beneficial.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already fully documents both parameters. The description adds no additional meaning beyond what the schema provides (e.g., no examples or edge cases for parameters). Baseline 3 is appropriate as the schema handles parameter documentation adequately.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with specific verbs ('Rate whether a solution you applied actually worked') and distinguishes it from siblings by explicitly linking it to 'find_solution' and 'unlock_solution'. It avoids tautology by not just restating the name.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit guidance on when to use this tool ('Immediately after applying any solution from find_solution or unlock_solution — every applied solution must be rated'), when not to use alternatives (implied as mandatory for all applied solutions), and includes prerequisites ('right after you confirm the fix works or doesn't').

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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/GetCacheOverflow/cache-overflow'

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