Skip to main content
Glama

generate_retry_message

Generate a canonical retry feedback message for an LLM from a tool name, validation error, and attempted arguments, using the same formatting as runtime callers.

Instructions

Given a tool name, validation error, and attempted args, build the canonical LLM-facing retry feedback message. Uses agentvet's ToolArgError.toLLMFeedback() formatting so the wording matches what runtime callers see.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tool_nameYes
validation_errorYes
attempted_argsYes

Implementation Reference

  • The handler function that executes the 'generate_retry_message' tool logic. It creates a ToolArgError with the tool name, validation error, and attempted args, then calls toLLMFeedback() to build the LLM-facing retry message.
    function generateRetryMessageTool(input: { tool_name: string; validation_error: string; attempted_args: any }) {
      const err = new ToolArgError(input.tool_name, input.validation_error, input.attempted_args);
      const feedback = err.toLLMFeedback?.() ?? err.message;
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify({ retry_message: feedback }, null, 2),
          },
        ],
      };
    }
  • The input schema definition for 'generate_retry_message' tool. It defines three required properties: tool_name (string), validation_error (string), and attempted_args (object).
    {
      name: 'generate_retry_message',
      description:
        'Given a tool name, validation error, and attempted args, build the canonical LLM-facing retry feedback message. Uses agentvet\'s ToolArgError.toLLMFeedback() formatting so the wording matches what runtime callers see.',
      inputSchema: {
        type: 'object',
        properties: {
          tool_name: { type: 'string' },
          validation_error: { type: 'string' },
          attempted_args: { type: 'object' },
        },
        required: ['tool_name', 'validation_error', 'attempted_args'],
      },
    },
  • src/server.ts:53-109 (registration)
    The tool is registered in the TOOLS array (line 95-108) which is served via ListToolsRequestSchema handler. The tool dispatch in the CallToolRequestSchema handler (line 125-126) routes the tool name to the handler function.
    const TOOLS = [
      {
        name: 'validate_tool_args',
        description:
          'Validate a tool-call args object against a small shape spec. Returns { valid, error?, retry_hint? } where retry_hint is a ready-to-send LLM feedback message describing exactly what was wrong.',
        inputSchema: {
          type: 'object',
          properties: {
            tool_name: {
              type: 'string',
              description: 'Name of the tool being called (surfaces in retry_hint).',
            },
            args: {
              type: 'object',
              description: 'The args object the LLM wants to pass.',
            },
            shape: SHAPE_SCHEMA,
          },
          required: ['tool_name', 'args', 'shape'],
        },
      },
      {
        name: 'lint_tool_definition',
        description:
          'Sanity-check a tool definition for common mistakes that hurt LLM tool-use accuracy: missing description, vague description, no required fields, schema fields without descriptions, non-snake_case names.',
        inputSchema: {
          type: 'object',
          properties: {
            tool: {
              type: 'object',
              description: 'A tool definition: { name, description, inputSchema }.',
              properties: {
                name: { type: 'string' },
                description: { type: 'string' },
                inputSchema: { type: 'object' },
              },
              required: ['name'],
            },
          },
          required: ['tool'],
        },
      },
      {
        name: 'generate_retry_message',
        description:
          'Given a tool name, validation error, and attempted args, build the canonical LLM-facing retry feedback message. Uses agentvet\'s ToolArgError.toLLMFeedback() formatting so the wording matches what runtime callers see.',
        inputSchema: {
          type: 'object',
          properties: {
            tool_name: { type: 'string' },
            validation_error: { type: 'string' },
            attempted_args: { type: 'object' },
          },
          required: ['tool_name', 'validation_error', 'attempted_args'],
        },
      },
    ] as const;
  • src/server.ts:125-126 (registration)
    Dispatch case in CallToolRequestSchema handler that routes 'generate_retry_message' to the generateRetryMessageTool function.
    case 'generate_retry_message':
      return generateRetryMessageTool(args as { tool_name: string; validation_error: string; attempted_args: any });
Behavior3/5

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

No annotations are provided, so the description carries full burden. It describes inputs and output but does not disclose behavioral traits like idempotency, side effects, or read-only nature. The tool appears to be a pure function, but this is not explicitly stated. Minimal transparency beyond functional description.

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?

Two sentences that are concise and front-loaded. Every sentence provides essential information without redundancy. The structure is clear and efficient.

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

Completeness3/5

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

For a simple string generation tool with 3 parameters and no output schema, the description covers inputs and the output's purpose. However, it does not describe the output format or provide examples, which would be helpful for an agent. Given the tool's simplicity and lack of annotations, the description could be more complete.

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 coverage is 0% (no parameter descriptions in schema). The description names the three parameters (tool_name, validation_error, attempted_args) and indicates their roles, but does not elaborate on expected formats, constraints, or examples. It adds value over the raw schema but does not fully compensate for the lack of schema descriptions.

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 specifies the tool's purpose: building a canonical LLM-facing retry feedback message given tool_name, validation_error, and attempted_args. It includes the formatting method (agentvet's ToolArgError.toLLMFeedback()), and distinguishes from siblings (lint_tool_definition, validate_tool_args) by its unique output.

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

Usage Guidelines4/5

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

The description implies when to use this tool—when generating a retry message after a validation error. It notes that the wording matches runtime callers, but does not explicitly state when not to use it or compare to alternatives. However, the siblings are sufficiently different, so no confusion.

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/MukundaKatta/agentvet-mcp'

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