Skip to main content
Glama

Verify a tamper-evident audit chain

verify_audit_chain
Read-only

Recompute a hash chain from genesis to detect mutated payloads and broken links, and pass a saved anchor checkpoint to catch truncate-and-re-append or full rewrites before trusting a chain you did not produce.

Instructions

Independently re-verifies a hash chain from genesis: recomputes every entry's hash and confirms each entry's prevHash matches the preceding entry's entryHash. Detects a mutated payload (stored entryHash no longer matches recomputed hash) and a severed link or spliced-out middle entry (prevHash mismatch) with no options at all. Two DIFFERENT truncation attacks need two DIFFERENT options, and neither is on by default: (1) entries deleted from the end and NOT replaced -- pass expectedMinLength to catch a chain that's simply shorter than it should be (a tail deletion alone leaves no broken pointer for the walk to find); this does NOT catch truncate-and-re-append (deleting tail entries and then appending new, self-consistent ones to reach the same length again -- expectedMinLength sees the 'right' length and passes). (2) to catch truncate-and-re-append, pass anchor: an { index, entryHash } checkpoint you saved earlier from a source the chain's writer cannot edit (your own log, a separate append-only store). The chain is invalid unless the entry at anchor.index has exactly that entryHash -- this also catches a full rewrite from genesis, but entries after the anchor are only checked for internal consistency, not against anything external. Passing neither option means a truncate-and-re-append (or a full rewrite from genesis) can pass as 'valid'. An empty chain is 'valid' with nothing checked (newer kits report entriesChecked: 0). Proves the chain is internally consistent and unaltered since it was hashed (and, with anchor, unaltered up to the anchor point); it does NOT prove nobody with write access ever rewrote the whole chain from genesis when no anchor is supplied (tamper-evident, not tamper-proof). Use this to audit a chain you did not produce yourself before trusting it.

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": {
      "chain": "<chain>"
    },
    "name": "verify_audit_chain"
  }
}

Input Schema

NameRequiredDescriptionDefault
chainYesThe chain to verify, exactly as stored/received.
anchorNoA checkpoint obtained earlier from somewhere the chain's writer cannot change (your own log, a separate append-only store) -- e.g. `{ index: chain.length - 1, entryHash: chain[chain.length - 1].entryHash }` saved right after you last trusted this chain. The chain is invalid unless it has an entry at `anchor.index` with exactly this entryHash. This is what actually catches truncate-and-re-append or a full rewrite from genesis -- `expectedMinLength` alone does not. Entries after the anchor are only checked for internal consistency, not against anything external.
expectedMinLengthNoIf you know how long the chain should be, pass it to catch entries deleted from the end and NOT replaced. Does NOT catch truncate-and-re-append (see `anchor`) -- a chain shortened and then extended back to this length with new entries passes this check.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.4.0
    • changedInput schema / properties / anchor / properties / entryHash / description
      Previous value: -"The anchored entry's entryHash, saved from a source the chain's writer cannot edit."New value: +"The anchored entry's non-blank entryHash, saved from a source the chain's writer cannot edit."
  2. First observedv0.1.0

TDQS

A4.8/5.0
Behavior5/5

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

Annotations only say readOnlyHint=true and openWorldHint=false; the description adds the substantive behavior: what classes of tampering are detected, that an empty chain returns valid with entriesChecked: 0, and the crucial limitation that this is tamper-evident not tamper-proof. It even notes the asymmetry that entries after the anchor are only checked for internal consistency.

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 verification mechanism, then organized as numbered attack/option pairs, which suits the complexity. It is long and repeats the truncate-and-re-append caveat in both the expectedMinLength and anchor discussions, though that repetition serves the explicit contrast between the two options.

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?

For a three-parameter tool with a nested chain object and no output schema, the description covers verification semantics, empty-chain behavior, and the security guarantees' boundaries. Nothing an agent needs to call it correctly or interpret a 'valid' result is missing.

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%, so the schema already documents all three parameters, and much of the description's option explanation duplicates those schema strings. What it adds beyond the schema is cross-parameter reasoning — the combination of expectedMinLength and anchor, and the fact that using neither leaves a specific attack undetected — which the schema describes only per-field.

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 and mechanism: 'Independently re-verifies a hash chain from genesis: recomputes every entry's hash and confirms each entry's prevHash matches the preceding entry's entryHash.' This distinguishes it immediately from the sibling append_audit_entry, which writes rather than verifies.

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?

Explicitly states when to use it ('audit a chain you did not produce yourself before trusting it') and gives decision rules for the two optional parameters tied to distinct attack models. It also explicitly warns that passing neither option lets a rewrite pass as valid, which is the key usage caveat an agent needs.

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