Skip to main content
Glama

Validate XML

validate_xml

Validate an XML document with xmlvalid: well-formedness, an XSD, DTD or RelaxNG schema, and for e-invoices the Schematron business rules of EN 16931, Peppol BIS, XRechnung, Factur-X and national formats. Pass the document as xml (its text) or url (a public http(s) address), and a schema: a catalog slug from search_schemas, a saved schema ("@orders-v3"), or "auto" to use the e-invoice profile the document names. Without a schema only well-formedness is checked. Returns valid, errors and warnings with line, column, message, rule and a help_url explaining each. Counts as one API validation of the account's monthly quota.

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": "validate_xml"
  }
}

Input Schema

NameRequiredDescriptionDefault
urlNoA public http(s) URL of the document, fetched by xmlvalid.
xmlNoThe XML document itself. Use url instead for a document on the web.
nameNoA file name to show in the result, such as invoice-42.xml.
waitNoSeconds to wait for the result before returning a pending status to poll with get_validation; 30 when left out, 0 to return at once.
schemaNoA catalog slug (see search_schemas), "@<name>" for a saved schema, or "auto" for the e-invoice profile the document names. Leave out to check well-formedness only.
rules_versionNoPin Schematron rule sets to releases, as rule-set@version, comma-separated (peppol-bis-3-ubl@3.0.21): the call fails with rules_version_mismatch when one has moved on. The result's rule_sets lists the releases that ran.

Output Schema

NameRequiredDescriptionDefault
idYesThe validation id, for get_validation.
errorNoWhat went wrong on our side when status is failed.
rulesNo
resultNoNull until the validation is done.
schemaNoNull when only well-formedness was checked.
statusYesqueued or running: poll get_validation with the id; done: see result.
documentNo
progressNo
rule_setsNoThe Schematron rule sets that ran after the schema check, at their releases.
created_atNo
finished_atNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "properties": {
      +    "created_at": {
      +      "type": "string"
      +    },
      +    "document": {
      +      "properties": {
      +        "name": {
      +          "type": "string"
      +        },
      +        "size": {
      +          "type": "integer"
      +        },
      +        "source": {
      +          "enum": [
      +            "upload",
      +            "url",
      +            "body"
      +          ],
      +          "type": "string"
      +        },
      +        "url": {
      +          "type": "string"
      +        }
      +      },
      +      "type": "object"
      +    },
      +    "error": {
      +      "description": "What went wrong on our side when status is failed.",
      +      "type": [
      +        "string",
      +        "null"
      +      ]
      +    },
      +    "finished_at": {
      +      "type": [
      +        "string",
      +        "null"
      +      ]
      +    },
      +    "id": {
      +      "description": "The validation id, for get_validation.",
      +      "type": "string"
      +    },
      +    "progress": {
      +      "maximum": 100,
      +      "minimum": 0,
      +      "type": "integer"
      +    },
      +    "result": {
      +      "description": "Null until the validation is done.",
      +      "properties": {
      +        "bytes": {
      +          "type": "integer"
      +        },
      +        "documents": {
      +          "description": "For an archive: errors and warnings are then in items.",
      +          "properties": {
      +            "failed": {
      +              "type": "integer"
      +            },
      +            "passed": {
      +              "type": "integer"
      +            },
      +            "skipped": {
      +              "type": "integer"
      +            },
      +            "total": {
      +              "type": "integer"
      +            }
      +          },
      +          "type": "object"
      +        },
      +        "duration_ms": {
      +          "type": "integer"
      +        },
      +        "engine": {
      +          "properties": {
      +            "libxml2": {
      +              "type": "string"
      +            },
      +            "saxonjs": {
      +              "type": [
      +                "string",
      +                "null"
      +              ]
      +            },
      +            "xmlvalid": {
      +              "type": "string"
      +            }
      +          },
      +          "type": [
      +            "object",
      +            "null"
      +          ]
      +        },
      +        "errors": {
      +          "description": "The errors, the first 50 when errors_listed is set.",
      +          "items": {
      +            "properties": {
      +              "column": {
      +                "description": "0 when unknown.",
      +                "type": "integer"
      +              },
      +              "help_url": {
      +                "description": "A page explaining this kind of error and how to fix it.",
      +                "type": [
      +                  "string",
      +                  "null"
      +                ]
      +              },
      +              "level": {
      +                "enum": [
      +                  "warning",
      +                  "error",
      +                  "fatal"
      +                ],
      +                "type": "string"
      +              },
      +              "line": {
      +                "description": "0 when the message is about the whole document.",
      +                "type": "integer"
      +              },
      +              "message": {
      +                "type": "string"
      +              },
      +              "message_en": {
      +                "description": "The message in English, for a rule its publisher wrote in another language.",
      +                "type": [
      +                  "string",
      +                  "null"
      +                ]
      +              },
      +              "path": {
      +                "description": "Where a business rule fired, as an XPath with the document's prefixes.",
      +                "type": [
      +                  "string",
      +                  "null"
      +                ]
      +              },
      +              "rule": {
      +                "description": "The business rule that failed, such as BR-CO-15; explain it with explain_rule.",
      +                "type": [
      +                  "string",
      +                  "null"
      +                ]
      +              },
      +              "rule_url": {
      +                "description": "The rule's page on xmlvalid.com.",
      +                "type": [
      +                  "string",
      +                  "null"
      +                ]
      +              },
      +              "type": {
      +                "description": "syntax, xsd, relaxng, dtd, schema, io, schematron (a business rule), archive or pdf.",
      +                "type": "string"
      +              }
      +            },
      +            "required": [
      +              "line",
      +              "message"
      +            ],
      +            "type": "object"
      +          },
      +          "type": "array"
      +        },
      +        "errors_listed": {
      +          "description": "Set when errors were cut to this many; errors_total counts them all.",
      +          "type": "integer"
      +        },
      +        "errors_total": {
      +          "type": "integer"
      +        },
      +        "errors_truncated": {
      +          "description": "More than the 500 errors the API keeps were found.",
      +          "type": "boolean"
      +        },
      +        "items": {
      +          "description": "For an archive, one result per document.",
      +          "items": {
      +            "properties": {
      +              "name": {
      +                "type": "string"
      +              },
      +              "outcome": {
      +                "type": "string"
      +              },
      +              "valid": {
      +                "type": "boolean"
      +              }
      +            },
      +            "required": [
      +              "name",
      +              "outcome"
      +            ],
      +            "type": "object"
      +          },
      +          "type": "array"
      +        },
      +        "outcome": {
      +          "enum": [
      +            "valid",
      +            "warnings",
      +            "invalid",
      +            "schema",
      +            "input",
      +            "failed"
      +          ],
      +          "type": "string"
      +        },
      +        "pdf": {
      +          "description": "For a PDF, the invoice found in it.",
      +          "properties": {
      +            "attachment": {
      +              "description": "The XML file validated, such as factur-x.xml.",
      +              "type": "string"
      +            },
      +            "guideline": {
      +              "type": [
      +                "string",
      +                "null"
      +              ]
      +            },
      +            "profile": {
      +              "type": [
      +                "string",
      +                "null"
      +              ]
      +            }
      +          },
      +          "type": "object"
      +        },
      +        "sha256": {
      +          "type": [
      +            "string",
      +            "null"
      +          ]
      +        },
      +        "valid": {
      +          "description": "True for the outcomes valid and warnings.",
      +          "type": "boolean"
      +        },
      +        "warnings": {
      +          "description": "The warnings, the first 50 when warnings_listed is set.",
      +          "items": {
      +            "properties": {
      +              "column": {
      +                "description": "0 when unknown.",
      +                "type": "integer"
      +              },
      +              "help_url": {
      +                "description": "A page explaining this kind of error and how to fix it.",
      +                "type": [
      +                  "string",
      +                  "null"
      +                ]
      +              },
      +              "level": {
      +                "enum": [
      +                  "warning",
      +                  "error",
      +                  "fatal"
      +                ],
      +                "type": "string"
      +              },
      +              "line": {
      +                "description": "0 when the message is about the whole document.",
      +                "type": "integer"
      +              },
      +              "message": {
      +                "type": "string"
      +              },
      +              "message_en": {
      +                "description": "The message in English, for a rule its publisher wrote in another language.",
      +                "type": [
      +                  "string",
      +                  "null"
      +                ]
      +              },
      +              "path": {
      +                "description": "Where a business rule fired, as an XPath with the document's prefixes.",
      +                "type": [
      +                  "string",
      +                  "null"
      +                ]
      +              },
      +              "rule": {
      +                "description": "The business rule that failed, such as BR-CO-15; explain it with explain_rule.",
      +                "type": [
      +                  "string",
      +                  "null"
      +                ]
      +              },
      +              "rule_url": {
      +                "description": "The rule's page on xmlvalid.com.",
      +                "type": [
      +                  "string",
      +                  "null"
      +                ]
      +              },
      +              "type": {
      +                "description": "syntax, xsd, relaxng, dtd, schema, io, schematron (a business rule), archive or pdf.",
      +                "type": "string"
      +              }
      +            },
      +            "required": [
      +              "line",
      +              "message"
      +            ],
      +            "type": "object"
      +          },
      +          "type": "array"
      +        },
      +        "warnings_listed": {
      +          "description": "Set when warnings were cut to this many.",
      +          "type": "integer"
      +        },
      +        "warnings_total": {
      +          "type": "integer"
      +        }
      +      },
      +      "required": [
      +        "valid",
      +        "errors",
      +        "warnings"
      +      ],
      +      "type": [
      +        "object",
      +        "null"
      +      ]
      +    },
      +    "rule_sets": {
      +      "description": "The Schematron rule sets that ran after the schema check, at their releases.",
      +      "items": {
      +        "properties": {
      +          "key": {
      +            "type": "string"
      +          },
      +          "name": {
      +            "type": "string"
      +          },
      +          "version": {
      +            "type": "string"
      +          }
      +        },
      +        "required": [
      +          "key",
      +          "name",
      +          "version"
      +        ],
      +        "type": "object"
      +      },
      +      "type": "array"
      +    },
      +    "rules": {
      +      "properties": {
      +        "name": {
      +          "type": "string"
      +        }
      +      },
      +      "type": [
      +        "object",
      +        "null"
      +      ]
      +    },
      +    "schema": {
      +      "description": "Null when only well-formedness was checked.",
      +      "properties": {
      +        "catalog": {
      +          "description": "The catalog slug.",
      +          "type": "string"
      +        },
      +        "detected": {
      +          "description": "True when schema \"auto\" picked this profile.",
      +          "type": "boolean"
      +        },
      +        "kind": {
      +          "type": "string"
      +        },
      +        "name": {
      +          "type": "string"
      +        },
      +        "saved": {
      +          "description": "The saved schema, as @<name>.",
      +          "type": "string"
      +        }
      +      },
      +      "type": [
      +        "object",
      +        "null"
      +      ]
      +    },
      +    "status": {
      +      "description": "queued or running: poll get_validation with the id; done: see result.",
      +      "enum": [
      +        "queued",
      +        "running",
      +        "done",
      +        "failed",
      +        "cancelled"
      +      ],
      +      "type": "string"
      +    }
      +  },
      +  "required": [
      +    "id",
      +    "status"
      +  ],
      +  "type": "object"
      +}
  2. Changed1 schema field changed
    • changedInput schema / properties / wait / description
      Previous value: -"Seconds to wait for the result before returning a pending status to poll with get_validation."New value: +"Seconds to wait for the result before returning a pending status to poll with get_validation; 30 when left out, 0 to return at once."
  3. First observed

TDQS

A4.5/5.0
Behavior5/5

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

Goes well beyond the annotations: discloses the monthly quota cost ("Counts as one API validation of the account's monthly quota"), the result shape (valid, errors and warnings with line, column, message, rule, help_url), a concrete failure mode (rules_version_mismatch) and what rule_sets reports. These are real operational consequences an agent needs before calling.

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?

Front-loaded with purpose and a supported-formats list, then input forms, defaults, and return/behavior notes. It is dense but well ordered; a few clauses duplicate the input schema descriptions (e.g. xml vs url), which is minor waste.

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?

Output schema exists and the annotations already cover safety/open-world behavior, yet the description still explains the return fields and quota impact, which is helpful. It omits that validations are persisted and retrievable via the get_validation sibling (only alluded to via the schema's `wait` text), a notable gap for a tool with a polling companion.

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

Parameters4/5

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

Schema coverage is 100% and the schema already documents all six parameters in detail, so the baseline is 3. The description adds meaning by tying `schema` values to concrete forms ("@orders-v3", "auto") and by stating the no-schema default, but most of its parameter text restates 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 and resource ("Validate an XML document") and immediately scopes the work: well-formedness, XSD/DTD/RelaxNG, and Schematron e-invoice rule sets (EN 16931, Peppol BIS, XRechnung, Factur-X). An agent can distinguish this from explain_error/explain_rule/search_schemas purely from this sentence.

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?

Gives clear selection logic for inputs: `xml` for document text, `url` for a public http(s) address, catalog slug from search_schemas, a saved "@" schema, or "auto" for the declared e-invoice profile. It also states the fallback behavior ("Without a schema only well-formedness is checked"). It stops short of naming when to prefer siblings like explain_error or get_validation explicitly, so it is not a 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.

Resources