Skip to main content
Glama
verifactu-mcp

verifactu-mcp

Compute VeriFactu record hash

verifactu_hash
Read-onlyIdempotent

Calculates the VERI*FACTU SHA-256 fingerprint (huella) for one invoice record and links it to the previous chain hash, returning field errors that AEAT would reject.

Instructions

Compute the VERI*FACTU fingerprint (huella, SHA-256) of one invoicing record.

record (AEAT field names; snake_case aliases accepted): alta: IDEmisorFactura, NumSerieFactura, FechaExpedicionFactura (DD-MM-AAAA), TipoFactura (F1, F2, F3, R1-R5), CuotaTotal, ImporteTotal (as written in the XML, decimal point), FechaHoraHusoGenRegistro (AAAA-MM-DDThh:mm:ss+hh:mm). anulación (TipoRegistro="anulacion"): IDEmisorFacturaAnulada, NumSerieFacturaAnulada, FechaExpedicionFacturaAnulada, FechaHoraHusoGenRegistro. previous_huella: fingerprint of the previous record of the chain; empty for the first record. Returns the fingerprint, the exact string hashed and any field problems (an error means the AEAT would reject the record).

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": {
      "record": "<record>"
    },
    "name": "verifactu_hash"
  }
}

Input Schema

NameRequiredDescriptionDefault
recordYes
previous_huellaNo

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.4/5.0
Behavior4/5

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

Annotations already declare readOnlyHint, idempotentHint and a closed-world scope, so safety is covered. The description adds real behavioral context beyond that: it returns the fingerprint, the exact string hashed, and any field problems, and it explains that an error means AEAT would reject the record - meaningful error-semantics disclosure for a pure-computation tool.

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 one-line purpose, then a tightly structured field list keyed by record type with no filler sentences. The nested bullet formatting is dense but each item (field name, format, allowed values) earns its place.

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?

For a complex nested-record tool with an output schema that already documents return shape, the definition covers field naming, formats, chain linking and error meaning. Minor gaps remain, such as which fields are mandatory versus optional within each record type and how unknown or extra fields are treated, but nothing critical for correct invocation 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?

Schema coverage is 0% and record is an untyped object with additionalProperties, so the description carries the full burden - and it does: it enumerates AEAT field names per record type, date/time formats (DD-MM-AAAA, AAAA-MM-DDThh:mm:ss+hh:mm), the allowed TipoFactura values (F1-F3, R1-R5), that amounts use the decimal point as written in the XML, and that snake_case aliases are accepted.

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: computes the VERI*FACTU fingerprint (huella, SHA-256) of one invoicing record. It is clearly distinguished from hashing-adjacent siblings like validate_invoice_chain or generate_verifactu_qr, which do validation and QR generation rather than hash computation.

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 a clear conditional usage rule for the two record shapes (alta vs anulación with TipoRegistro='anulacion') and states that previous_huella is empty for the first record of the chain, which tells the agent how to call it in chained contexts. It does not explicitly route the agent away from alternatives such as validate_invoice_chain or validate_verifactu_xml, so no exclusions are given.

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