Skip to main content
Glama

Repair broken invoice XML

repair_xml
Read-onlyIdempotent

Repair an invoice XML that is not well-formed (validate/parse answer MALFORMED_XML): closes unclosed elements, removes stray closing tags, fixes prefix/case mismatches, escapes bare & and <. Refuses truncated files, HTML and files needing more than 25 changes (REPAIR_NOT_POSSIBLE). Returns every change and the repaired XML; validate it before sending. XML only, not PDF.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "repair_xml"
  }
}

Input Schema

NameRequiredDescriptionDefault
contentNoInvoice XML (UBL, CII, XRechnung, Peppol BIS, ZUGFeRD/Factur-X XML, KSeF FA(3)) as text

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.5/5.0
Behavior4/5

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

Annotations already cover safety (readOnlyHint, idempotentHint, destructiveHint=false, openWorldHint=false), yet the description still adds real behavioral content: a hard 25-change ceiling, named refusal outcomes with the REPAIR_NOT_POSSIBLE code, and the fact that it returns both the change list and the repaired document. It stops short of saying what the change records look like or whether the original is preserved.

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?

Purpose and trigger come first, then the repair scope, then the refusal conditions, then the return contract and follow-up. Every clause carries information an agent needs (defect types, limits, error code, next step); there is no filler or restatement of the name.

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?

With no output schema, the description takes on the return contract itself ('Returns every change and the repaired XML') and supplies the error path via REPAIR_NOT_POSSIBLE. Combined with the pre-call trigger and post-call validation instruction, an agent has everything needed to decide, invoke, and follow up correctly.

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?

Only one parameter, and the schema already documents it at 100% coverage including the supported format list (UBL, CII, XRechnung, Peppol BIS, ZUGFeRD/Factur-X, KSeF FA(3)). The description adds little beyond the schema for the 'content' field itself, 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?

States a specific verb and resource ('Repair an invoice XML that is not well-formed') and pins the triggering condition to a concrete upstream signal (validate/parse returning MALFORMED_XML). It enumerates the exact defect classes it fixes (unclosed elements, stray closing tags, prefix/case mismatches, bare & and <), so an agent can tell this apart from validate_invoice, parse_invoice, and fix_invoice without opening a schema.

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?

Gives an explicit when-to-use trigger (MALFORMED_XML from validate/parse) and explicit when-not-to-use cases (truncated files, HTML, anything needing more than 25 changes). It also sequences the follow-up action ('validate it before sending') and rules out the adjacent PDF path with 'XML only, not PDF'.

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.