Skip to main content
Glama

Payload Validator

Validate XML

validate_xml
Read-only

Validates an XML document for well-formedness, namespace correctness, and the entity-based attacks that arrive as XML.

Use this before parsing XML you received, and when an XML document is being rejected by something that will not say why.

Do not eyeball this. Four classes of genuinely invalid XML are accepted by ordinary well-formedness checkers, so "it validated" does not mean what it appears to: (1) Two root elements. <a/><b/> is not a valid XML document; XML permits exactly one outermost element. Concatenated records hit this constantly. (2) Undeclared namespace prefixes. <x:a> with no xmlns:x is well-formed as raw XML and invalid under Namespaces in XML — so it passes a syntax check and is then rejected by XPath, XSLT, SOAP and every schema validator. (3) Undeclared entities. XML predefines only five (&lt; &gt; &amp; &apos; &quot;). &nbsp; is an HTML entity and is simply undefined in XML. (4) A bare &, almost always arriving inside a URL.

Security findings, which are the reason to run this on input you did not write: external entity declarations (XXE — reported with the URI they point at and the remediation for Python, Java and .NET), nested entity expansion (billion laughs), parameter entities (the out-of-band XXE vehicle), external DTD references (an SSRF vector and a runtime dependency on someone else's host), and any DOCTYPE at all, since hardened parsers reject them outright.

Input: input, the raw XML text as a string. 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.

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.5/5.0
Behavior5/5

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

Goes far beyond the readOnlyHint and openWorldHint annotations by explaining exactly what is and isn't done: nothing is resolved, fetched, expanded, or stored. It also warns about common false positives and explains the 'valid' vs 'parseable' distinction.

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?

Long but well-organized, with a clear lead sentence, explicit usage guidance, a numbered list of subtle failure modes, and a structured explanation of returns and safety. Every paragraph adds meaningful decision-making or interpretation value.

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 complex security-relevant validator with no output schema and minimal annotations, the description is exceptionally complete: it covers input bounds, return semantics, stable rule codes, safety guarantees, and the specific attack classes an agent should expect.

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%, so the schema already documents the `input` parameter. The description adds a clarifying reminder that the input is raw text, not a parsed object, but largely restates information already present in the schema.

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?

States a specific verb ('Validates') and resource ('XML document') with precise scope: well-formedness, namespace correctness, and entity-based attacks. This clearly distinguishes it from JSON, CSV, YAML, and auto-format validators.

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?

Explicitly says when to use it: before parsing received XML and when an XML document is rejected without explanation. It does not explicitly say when not to use it or name a specific alternative, so it stops just short of a full 5.

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