Skip to main content
Glama

xml_xml_to_dict

Convert XML documents to nested Python dictionaries returned as JSON. Handles attributes with '@' prefix, text content with '#text', and repeated tags as lists.

Instructions

[xml] Convert an XML document to a nested Python dict (returned as JSON). Attributes use @ prefix, text content uses #text when mixed with children. Repeated tags become lists.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
xml_stringYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior4/5

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

With no annotations, the description carries full burden. It discloses key behaviors: attribute handling, mixed content text marker, and list conversion for repeated tags. However, it does not mention error handling (e.g., malformed XML) or performance constraints, which is acceptable for a simple converter.

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 sentences: first states purpose, second details output conventions. No redundant information, front-loaded, and every sentence adds value. Highly compact.

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 simplicity (one param, no nested objects) and presence of an output schema (inferred), the description covers the essential behavior and output format. Minor gap: lack of error notes, but overall sufficient for a straightforward conversion tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema has 0% description coverage; the parameter 'xml_string' is only named. The description adds that it is an XML document, but no further constraints (e.g., must be valid XML) or format details are provided. The parameter is simple, but more semantics would help.

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 clearly states the tool converts XML to a Python dict (JSON), with specific details on attribute prefix (@) and text content handling. This distinguishes it from sibling tools like xml_xml_find or xml_xml_extract which have different scopes.

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 when full document conversion is needed, but lacks explicit when-to-use or when-not-to-use guidance. No alternatives are mentioned, though the purpose is clear enough for an agent to infer.

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/0-co/agent-friend'

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