Skip to main content
Glama

XML to JSON converter: convert an XML document into JSON

xml_to_json
Read-only

Convert an XML document to JSON: attributes become "@name" keys, text becomes "#text" (or the value itself when an element only holds text), and repeated child elements become arrays. DOCTYPEs and external entities are refused, so nothing outside the document is ever loaded. Up to 100,000 characters. Use to read XML feeds, SOAP responses and config files in an agent. Example: xml=PenInk. Price $0.01/call via x402 USDC or a card key (/credits), first 25 free; failed calls free. Reads or computes only and changes nothing; each call is charged, so repeats are not free.

Input Schema

NameRequiredDescriptionDefault
xmlYesThe XML document

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.4/5.0
Behavior5/5

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

Annotations only declare readOnly/destructive/openWorld/idempotent flags; the description adds substantive behavior the agent cannot infer: DOCTYPEs and external entities are refused (XXE safety), a 100,000-character input cap, and a per-call charge with failed calls free. It also explains *why* idempotentHint=false — each call is billed, so repeats are not free — turning an opaque annotation into an actionable constraint.

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 core semantics and constraints are front-loaded before the example, and every early sentence carries information. The trailing sentence is slightly wasteful — "Reads or computes only and changes nothing" restates readOnlyHint/destructiveHint already present in annotations — but the billing note that follows it still earns its place.

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 one-parameter conversion tool with no output schema, the description covers everything an agent needs: input format, output shape conventions, size ceiling, security refusal behavior, and cost model. Nothing about successful or failed invocation is left ambiguous.

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?

The single `xml` parameter is fully documented in the schema (100% coverage), so baseline 3 applies. The inline example `<order id="7"><item sku="a1">Pen</item>…</order>` is a modest value-add because it shows how the documented mapping rules play out, but no additional syntax, encoding, or formatting constraints are offered.

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 first clause names a specific verb and resource ("Convert an XML document to JSON") and immediately specifies the output mapping conventions (attributes → "@name", text → "#text", repeated children → arrays). This is enough to distinguish it from siblings like json_format, yaml_to_json, or json_repair without opening any schema.

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?

"Use to read XML feeds, SOAP responses and config files in an agent" gives concrete usage contexts, and the worked example anchors an expected call shape. There is no explicit when-not or named alternative (e.g. use yaml_to_json for YAML), so it stops short of full routing guidance.

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.