Skip to main content
Glama
verifactu-mcp

verifactu-mcp

Validate VeriFactu invoice chain

validate_invoice_chain
Read-onlyIdempotent

Audit a VERI*FACTU invoice chain by recomputing AEAT fingerprints and verifying record links to detect breaks, altered records, duplicates, and invalid data.

Instructions

Audit a VERI*FACTU chain of records (in generation order) given as JSON objects.

Each record has the fields of verifactu_hash plus Huella (stored fingerprint) and optionally HuellaAnterior or RegistroAnterior {IDEmisorFactura, NumSerieFactura, FechaExpedicionFactura, Huella} and PrimerRegistro ("S"). For every record the fingerprint is recomputed and compared, and the link to the previous record checked. Reports chain breaks, altered records, PrimerRegistro misuse, duplicate invoices, cancellations of unknown invoices, timestamps going backwards, invalid NIF/dates/amounts/TipoFactura. continues_from: last fingerprint of the previous batch, to audit a chain in pieces. Up to 20,000 records. last_huella is what the next record must link to.

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": {
      "records": "<records>"
    },
    "name": "validate_invoice_chain"
  }
}

Input Schema

NameRequiredDescriptionDefault
recordsYes
continues_fromNo

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.5/5.0
Behavior5/5

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

Annotations only say readOnly/idempotent/closed-world; the description adds substantial behavior beyond that: every fingerprint is recomputed and compared, the previous-record link is checked, and it enumerates exactly what gets reported (chain breaks, altered records, PrimerRegistro misuse, duplicate invoices, cancellations of unknown invoices, backwards timestamps, invalid NIF/dates/amounts/TipoFactura). It also discloses the 20,000-record limit and what `last_huella` means for chaining.

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 the core action and result set, and every clause is substantive. Minor deductions for the dense run-on enumeration and the mid-paragraph lowercase `continues_from:` stub, which reads as a note rather than structured guidance.

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?

Covers the input shape, the chaining/continuation mechanism, scale limits, and the classes of findings returned; since an output schema exists, it needn't restate return structure. Nothing an agent needs in order to call it correctly is missing.

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

Parameters5/5

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

With 0% schema description coverage, the description carries the full burden and does so: it defines the shape of each `records` element (fields of `verifactu_hash` plus `Huella`, optionally `HuellaAnterior` or a `RegistroAnterior` object with named subfields, plus `PrimerRegistro` = "S"), and explains `continues_from` as the last fingerprint of the prior batch. This is meaning the bare schema (`array of object, additionalProperties: true`) does not convey.

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+resource+scope: audit a VERI*FACTU chain of records in generation order, given as JSON objects. That is clearly distinct from the single-record sibling `verifactu_hash` (which only computes a fingerprint) and from `validate_verifactu_xml`, so an agent can route without opening schemas.

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?

It explains the practical batching case for `continues_from` ("to audit a chain in pieces") and implicitly the whole-chain case, but never explicitly says when to prefer this over `verifactu_hash` or what to do when only a single record needs checking. Usage is inferable rather than stated.

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