Skip to main content
Glama

elci.dev developer tools

XML to JSON Converter

xml_to_json
Read-only

Convert XML to JSON. Attributes become "@name", text beside attributes or child elements becomes "#text", repeated elements become arrays, CDATA is text and comments are dropped.

Returns: Object with json: the converted value, keyed by the root element name.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "input": "<input>"
    },
    "name": "xml_to_json"
  }
}

Input Schema

NameRequiredDescriptionDefault
inputYesXML text.
coerceNoTurn numbers and true/false into JSON numbers and booleans (values with leading zeros stay text).

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4/5.0
Behavior4/5

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

Annotations already establish readOnlyHint=true and openWorldHint=false, so safety is covered; the description adds real value by disclosing the transformation contract (attribute prefixing, #text nodes, array-ification of repeats, CDATA handling, comment dropping) and the return shape. It stops short of stating error behavior for malformed XML or the 1 MB input ceiling, which is why it is not a 5.

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?

Two tightly packed sentences: the operation first, then the mapping rules, then the return value. Every clause carries information an agent would otherwise have to guess, and there is no filler or repetition of structured fields.

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?

With no output schema, the description correctly supplies the return shape (object with a `json` key keyed by root element name), which is exactly what is otherwise missing. For a simple two-parameter pure function this is nearly complete; only error/failure behavior and input size limits are unaddressed.

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 description coverage is 100%, so both `input` and `coerce` are already documented, including the default and the leading-zero exception. The description adds nothing about the parameters themselves, only about output shaping, so the baseline 3 applies.

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 opens with a specific verb+resource ("Convert XML to JSON") and immediately enumerates the exact mapping rules (attributes to "@name", stray text to "#text", repeats to arrays, CDATA as text, comments dropped). That is far more than a restatement of the title and makes it unmistakable against siblings like yaml_json_convert or json_to_csv.

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?

Usage is only implied: the tool takes a string of XML and converts it, which is self-evident from the purpose. There is no explicit statement of when to prefer this over a sibling converter, and no mention of prerequisites or exclusions, so it sits at the minimum-viable level.

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.

Resources