Skip to main content
Glama
paladini

devutils-mcp-server

json_validate

Validate JSON strings to detect parsing errors and identify their approximate locations for debugging and data integrity.

Instructions

Validate a JSON string and report any parsing errors with their approximate location.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
inputYesThe JSON string to validate

Implementation Reference

  • The implementation of the json_validate tool, which validates JSON strings and returns either a success message or an error with position and context.
    server.tool(
      "json_validate",
      "Validate a JSON string and report any parsing errors with their approximate location.",
      { input: z.string().describe("The JSON string to validate") },
      async ({ input }) => {
        try {
          JSON.parse(input);
          return {
            content: [
              {
                type: "text" as const,
                text: JSON.stringify(
                  { valid: true, message: "Valid JSON" },
                  null,
                  2
                ),
              },
            ],
          };
        } catch (e) {
          const message = e instanceof Error ? e.message : String(e);
    
          // Try to extract position info from error
          const posMatch = message.match(/position\s+(\d+)/i);
          const position = posMatch ? parseInt(posMatch[1], 10) : undefined;
    
          let context: string | undefined;
          if (position !== undefined) {
            const start = Math.max(0, position - 20);
            const end = Math.min(input.length, position + 20);
            context = input.slice(start, end);
          }
    
          return {
            content: [
              {
                type: "text" as const,
                text: JSON.stringify(
                  {
                    valid: false,
                    error: message,
                    position,
                    context,
                  },
                  null,
                  2
                ),
              },
            ],
          };
        }
      }
    );
Behavior3/5

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

With no annotations provided, the description carries the full burden. It successfully discloses that the tool reports parsing errors with approximate locations, giving insight into output behavior. However, it omits other behavioral traits like success-case returns, whether it modifies input, or performance characteristics.

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?

Single sentence, front-loaded with the primary action ('Validate'), zero redundancy. Every phrase earns its place: action (validate), resource (JSON string), and unique value-add (error location reporting) are all present without waste.

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 low complexity (1 parameter, 100% schema coverage), the description is adequately complete. It compensates for the missing output schema by describing the return behavior (error reporting with locations), though it could clarify what constitutes successful validation.

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% (the 'input' parameter is fully described as 'The JSON string to validate'). The description reinforces that the input is a JSON string for validation but adds no additional semantic details, syntax constraints, or format examples beyond the schema baseline.

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') with clear resource ('JSON string') and distinctively mentions 'report any parsing errors with their approximate location,' which clearly differentiates it from sibling tools like json_format (formatting) and json_path_query (data extraction).

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?

The description implies usage through the mention of error reporting, suggesting this tool is for checking JSON validity before parsing. However, it lacks explicit when-to-use guidance (e.g., 'use this before parsing untrusted input') or comparisons to alternatives like json_format.

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/paladini/devutils-mcp-server'

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