Skip to main content
Glama

validate_tool_args

Validates a tool-call arguments object against a specified shape, returning validity status, error details, and a ready-to-send retry hint for the LLM to correct mistakes.

Instructions

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.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tool_nameYesName of the tool being called (surfaces in retry_hint).
argsYesThe args object the LLM wants to pass.
shapeYesShape spec mapping field name to type. Types: "string", "number", "boolean", "array", "object". Suffix with "?" for optional. Example: { "name": "string", "age": "number", "tags": "array", "notes": "string?" }

Implementation Reference

  • The function `validateToolArgsTool` that implements the core logic of the 'validate_tool_args' tool. It uses `adapters.shape` to create a validator from the shape spec, calls `validate()`, and returns { valid, error?, retry_hint? }.
    function validateToolArgsTool(input: { tool_name: string; args: any; shape: any }) {
      const validator = adapters.shape(input.shape);
      const result = validate(input.tool_name, validator, input.args);
      if (result.valid) {
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify({ valid: true }, null, 2),
            },
          ],
        };
      }
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(
              {
                valid: false,
                error: result.error.validationError,
                retry_hint: result.error.toLLMFeedback?.() ?? result.error.message,
              },
              null,
              2,
            ),
          },
        ],
      };
    }
  • The SHAPE_SCHEMA constant defining the shape spec input schema for the tool.
    const SHAPE_SCHEMA = {
      type: 'object',
      description:
        'Shape spec mapping field name to type. Types: "string", "number", "boolean", "array", "object". Suffix with "?" for optional. Example: { "name": "string", "age": "number", "tags": "array", "notes": "string?" }',
      additionalProperties: { type: 'string' },
    } as const;
  • src/server.ts:53-73 (registration)
    The tool registration entry for 'validate_tool_args' in the TOOLS array, including its name, description, and inputSchema.
    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'],
        },
      },
  • src/server.ts:117-123 (registration)
    The dispatch handler that routes CallToolRequestSchema requests for 'validate_tool_args' to validateToolArgsTool.
    server.setRequestHandler(CallToolRequestSchema, async (req) => {
      const { name, arguments: args } = req.params;
      try {
        switch (name) {
          case 'validate_tool_args':
            return validateToolArgsTool(args as { tool_name: string; args: any; shape: any });
          case 'lint_tool_definition':
Behavior4/5

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

Despite no annotations, the description transparently states the return structure ({valid, error?, retry_hint?}) and explains that retry_hint is a ready-to-send LLM feedback message. This covers the behavior well, though it omits details like idempotency or side effects.

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

Conciseness4/5

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

A single sentence with a clear structure: first states the action, then lists the return fields. It is concise but could be improved by front-loading the most critical information (e.g., validation outcome).

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?

The description covers the basic function and return values, but lacks usage context like when to validate or how the shape spec works (already in schema). No output schema means description should be more detailed, but it adequately explains the return format.

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 100% with detailed descriptions for each parameter. The description adds minimal extra meaning beyond the schema (e.g., clarifying retry_hint's purpose), meeting the baseline for high coverage.

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 uses a specific verb ('Validate') and resource ('tool-call args object against a small shape spec'), clearly distinguishing it from sibling tools (generate_retry_message, lint_tool_definition) which serve different purposes.

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

Usage Guidelines3/5

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

No explicit guidance on when to use this tool versus alternatives. The description implies usage for validating tool-call arguments but does not provide prerequisites or contrasting scenarios with siblings.

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