Skip to main content
Glama

Mx Validate Cfdi

mx__validate_cfdi

Ensure CFDI 4.0 XML is structurally valid against official SAT XSD schemas. Validates optional TFD and Pagos 2.0 complements, returning pass/fail results for each applicable schema.

Instructions

Validate a CFDI 4.0 document against the official SAT XSD schemas.

Always validates the root Comprobante against cfdv40.xsd. If a TimbreFiscalDigital complement is present (i.e. the document has been stamped by a PAC), it is additionally validated against TimbreFiscalDigitalv11.xsd.xml. If a Pagos complement is present (TipoDeComprobante="P"), it is additionally validated against Pagos20.xsd.xml.

This is XSD-only — business-rule checks from SAT's Matriz de errores (specs/MatrizDeErrores_CFDI_v40_20260325.xls) are not run, mirroring mcp-nfe-br's br__validate_nfe_xml precedent (XSD-first, business rules deferred). A document that passes this validator is structurally conformant but not guaranteed to pass PAC certification.

Returns a dict with:

  • valid: True only if every schema that applies passed

  • comprobante: the cfdv40.xsd validation result

  • tfd: the TFD validation result, present only if a TimbreFiscalDigital element was found

  • pagos: the Pagos 2.0 validation result, present only if a Pagos element was found

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
xmlYesThe CFDI 4.0 Comprobante XML to validate, as a string

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. First observedv0.3.0

TDQS

A4.4/5.0
Behavior5/5

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

Annotations are absent, so the description carries the full burden and meets it thoroughly. It discloses the always-run root Comprobante check, the conditional TFD and Pagos validations with their trigger conditions, the XSD-only limitation, and the precise semantics of 'valid' (True only if every applicable schema passed). This depth goes far beyond what the annotations could have provided.

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?

The description is long but every section earns its place: purpose sentence, conditional validation logic, scope limitation, and a scannable bulleted return-dict breakdown. The core purpose is front-loaded, and the length is proportionate to the real complexity of three schemas and conditional validation paths.

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?

An agent can invoke this correctly from the description alone: one fully documented parameter, explicit conditional behavior, documented return keys, and an existing output schema. The only real gap is that the description never positions itself against the adjacent sibling mx__verify_tfd, so an agent must infer which tool covers verification of the TFD seal.

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% — the single 'xml' parameter is already documented as 'The CFDI 4.0 Comprobante XML to validate, as a string.' The description confirms this but adds no syntax, format, or encoding detail beyond the schema; the conditional behavior based on document contents is better credited under behavioral transparency.

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?

Opens with a specific verb+resource+method: 'Validate a CFDI 4.0 document against the official SAT XSD schemas.' It further names the exact schemas (cfdv40.xsd, TimbreFiscalDigitalv11.xsd.xml, Pagos20.xsd.xml) and its structural-validation scope clearly differentiates it from the build/seal siblings and from mx__verify_tfd's verification role.

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?

Explicitly states the negative space: business-rule checks from SAT's Matriz de errores are not run, and 'a document that passes this validator is structurally conformant but not guaranteed to pass PAC certification.' However, it never names a concrete alternative for those excluded cases, leaving the validate-vs-verify boundary with mx__verify_tfd implicit.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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/cmendezs/mcp-cfdi-mx'

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