Skip to main content
Glama

Payload Validator

Detect the format and validate

validate_auto
Read-only

Detects whether a payload is JSON, YAML, XML or CSV, then validates it.

Use this when you have a blob of text and do not know what it is — a file with no extension, a clipboard paste, a response body with an unhelpful content type, or a config file whose format you would otherwise have to guess.

Detection is structural and the reason is always returned, so the assumption is visible rather than hidden: a leading < is XML, a leading { or [ is JSON, a %YAML directive or key: value lines are YAML, and a consistent delimiter count across multiple lines is CSV. JSON is checked before YAML on purpose, because JSON is a strict subset of YAML 1.2 and every JSON document would otherwise be ambiguous.

If the detected format does not validate but JSON or XML does, the result is corrected and detection.corrected is true. Only those two can win a correction, because only they have decisive grammars — CSV will read almost any text as a valid single-column file, so "it validates as CSV" is not evidence, and allowing it would silently reinterpret broken JSON as fine.

Prefer the format-specific tool when you already know the format: it skips detection and cannot be corrected out from under you.

Input: input, the raw text. Up to 1,000,000 bytes.

Returns: valid (no errors), parseable (whether a conforming parser would accept it — deliberately separate, because a duplicate key parses fine and still means two different things), a diagnostics array where each entry has a 1-based line and column, a stable rule code, a message, an excerpt showing the offending line with a caret under the column, a fixHint, and blocksParse; plus counts and format-specific stats. Rule codes are stable and safe to branch on; messages are not. Additionally detection with the chosen format, the reason in one sentence, and corrected.

Safety: nothing is resolved, fetched or expanded. External XML entities are reported, never retrieved; alias bombs are detected without being expanded; no schema or DTD is fetched over the network. Payloads are validated in memory and never stored.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
inputYesThe raw document text, not a parsed object — the findings are properties of the text. Up to 1,000,000 bytes.

Schema Changelog

Changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. First observed

TDQS

A4.6/5.0
Behavior5/5

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

Annotations only declare readOnlyHint and openWorldHint, but the description goes far beyond this: it explains structural detection logic, the deliberate JSON-before-YAML ordering, the correction rule limited to JSON/XML, the parseable-vs-valid distinction, diagnostic entry contents, and explicit safety guarantees (no network, no expansion, no storage). This richly discloses behaviors an agent could not infer from annotations or schema.

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?

The description is long but well-structured into purpose, usage, detection logic, correction behavior, return values, and safety. Each paragraph earns its place, and the most decision-relevant information (purpose and when to use) comes first. A slight deduction for repeating the byte limit already present in the schema and for including more detail on diagnostics than an agent strictly needs to decide on invocation.

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

Completeness5/5

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

For a tool with one simple parameter, no output schema, and read-only annotations, this description covers all bases: use cases, alternatives, detection and correction semantics, full return structure, and safety constraints. An agent has everything needed to call it correctly and understand the result.

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% and the schema already describes the single parameter as raw document text with the 1,000,000-byte limit. The description repeats those details and adds contextual examples like clipboard paste and config file, but does not materially expand the parameter's semantics beyond what the schema already provides.

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 states a specific verb and resource: 'Detects whether a payload is JSON, YAML, XML or CSV, then validates it.' It clearly distinguishes itself from format-specific siblings by positioning itself as the auto-detecting variant and explicitly naming the alternative tools to prefer when the format is known.

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?

Usage is explicit: 'Use this when you have a blob of text and do not know what it is' lists concrete scenarios, and it warns to 'Prefer the format-specific tool when you already know the format.' It also explains the trade-off: detection can be corrected, while the format-specific tools cannot be corrected out from under you.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

TDQS

A4.7/5.0
Disambiguation5/5

Each tool targets a single unambiguous format (JSON, YAML, XML, CSV), and validate_auto is explicitly differentiated from the format-specific tools with guidance on when to prefer one over the other. The cross-references in the descriptions remove any possible confusion between the auto-detector and the dedicated validators.

Naming Consistency5/5

All five tools follow the exact same validate_<format> pattern with consistent snake_case naming. validate_auto fits the pattern naturally alongside validate_json, validate_yaml, validate_xml, and validate_csv, making the tool set predictable at a glance.

Tool Count5/5

Five tools is well-scoped for a payload validation server: auto-detection plus the four dominant text data formats. Each tool earns its place and there are no redundant or filler tools.

Completeness5/5

The validation surface is complete for the stated domain — the four major serialization formats are covered with deep edge-case handling, and validate_auto fills the gap for unknown formats. Possible additions like TOML or JSON Schema validation are outside the server's apparent scope and would be scope creep rather than natural missing coverage.

Resources