Skip to main content
Glama

specgrid-eu-compliance

Audit AEAT VeriFactu Hash Chain

verifactu_verify_chain
Read-onlyIdempotent

Audit an ordered batch of Spanish AEAT VeriFactu invoice records to verify every record SHA-256 Huella and cryptographic link to the preceding record. Stateless, deterministic, read-only with zero storage; returns chainValid (boolean), recordCount, and per-record hashMatches / chainLinkMatches flags (returns isError=true if records is empty or malformed). Use when inspecting historical invoice logs for tampering or broken links; use verifactu_fingerprint instead to compute a single new invoice hash.

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

Input Schema

NameRequiredDescriptionDefault
recordsYesChronologically ordered list of VeriFactu invoice records; each record must include its stored expectedHash.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed5 schema fields changed
    • addedInput schema / additionalProperties
      Added value: +false
    • changedInput schema / properties / records / description
      Previous value: -"Ordered array of VeriFactu records, each including expectedHash"New value: +"Chronologically ordered list of VeriFactu invoice records; each record must include its stored expectedHash."
    • addedInput schema / properties / records / items / properties
      Added value: +{
      +  "expectedHash": {
      +    "description": "Stored 64-char uppercase hex SHA-256 Huella to verify against recomputed value.",
      +    "type": "string"
      +  },
      +  "generationTimestamp": {
      +    "description": "ISO-8601 timestamp with timezone offset.",
      +    "type": "string"
      +  },
      +  "invoiceType": {
      +    "description": "AEAT TipoFactura code.",
      +    "enum": [
      +      "F1",
      +      "F2",
      +      "F3",
      +      "R1",
      +      "R2",
      +      "R3",
      +      "R4",
      +      "R5"
      +    ],
      +    "type": "string"
      +  },
      +  "issueDate": {
      +    "description": "Issue date in strict DD-MM-YYYY format.",
      +    "type": "string"
      +  },
      +  "issuerNif": {
      +    "description": "Spanish issuer NIF/CIF (e.g. \"89890001K\").",
      +    "type": "string"
      +  },
      +  "previousHash": {
      +    "description": "Previous 64-char SHA-256 Huella, or \"\" for the first record.",
      +    "type": "string"
      +  },
      +  "seriesNumber": {
      +    "description": "Invoice series and number (e.g. \"INV-2026/0001\").",
      +    "type": "string"
      +  },
      +  "taxAmount": {
      +    "description": "Total VAT amount (CuotaTotal).",
      +    "type": "number"
      +  },
      +  "totalAmount": {
      +    "description": "Total gross amount (ImporteTotal).",
      +    "type": "number"
      +  }
      +}
    • addedInput schema / properties / records / items / required
      Added value: +[
      +  "issuerNif",
      +  "seriesNumber",
      +  "issueDate",
      +  "invoiceType",
      +  "taxAmount",
      +  "totalAmount",
      +  "generationTimestamp",
      +  "expectedHash"
      +]
    • addedInput schema / properties / records / minItems
      Added value: +1
  2. First observed

TDQS

A4.3/5.0
Behavior4/5

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

Annotations already declare readOnly/idempotent/non-destructive/non-open-world, and the description adds genuinely new traits: stateless, deterministic, zero storage, plus the failure mode (isError=true when records is empty or malformed). It also enumerates return fields (chainValid, recordCount, hashMatches/chainLinkMatches) for a tool with no output schema. It stops short of noting the ordering sensitivity of verification or what a partial-failure result looks like.

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?

Two dense sentences, front-loaded with the core action, with the alternative routed at the end. Every clause carries information, though the parenthetical error clause and return-value list make the first sentence heavy for a single read.

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?

With one required array parameter, nested record schema, annotations, and no output schema, the definition covers what the tool does, what it returns, and how it fails — enough for correct invocation. A note on whether all records must be supplied in order (or whether partial batches are valid) would close the remaining gap.

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 coverage is 100% and the nested record fields are well documented, so the schema carries the semantics. The description only frames the batch as 'ordered' and reinforces that each record's stored hash is checked against a recomputed value, adding little beyond the field-level docs — baseline 3.

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 — 'Audit an ordered batch of Spanish AEAT VeriFactu invoice records' — and names exactly what is verified (SHA-256 Huella plus cryptographic link to the preceding record). It explicitly contrasts itself with verifactu_fingerprint, so an agent can distinguish the two batch-vs-single tools 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 trigger ('inspecting historical invoice logs for tampering or broken links') and an explicit alternative ('use verifactu_fingerprint instead to compute a single new invoice hash'), with the condition that selects between them. Nothing is left to inference.

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