verify_chain
Detect tampering in agent activity logs by verifying the SHA-256 hash chain. Optionally check a specific agent's records.
Instructions
Verify the integrity of the audit trail hash chain. Each entry's SHA-256 hash includes the previous entry's hash — if any record was modified, the chain breaks and this will report where.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| agent_id | No | Verify chain for a specific agent only. If omitted, verifies all entries. |
Implementation Reference
- index.js:175-198 (handler)Handles the 'verify_chain' tool call: sends a POST /v1/verify request with an optional agent_id, and returns whether the chain is intact or broken with details.
if (name === "verify_chain") { const body = args.agent_id ? { agent_id: args.agent_id } : {}; const result = await apiCall("POST", "/v1/verify", body); if (result.valid) { return { content: [ { type: "text", text: `Chain intact. ${result.entries_verified} entries verified, no tampering detected.`, }, ], }; } return { content: [ { type: "text", text: `Chain broken at sequence ${result.broken_at_sequence}. Reason: ${result.reason}`, }, ], }; } - index.js:109-117 (schema)Input schema for 'verify_chain' tool: accepts an optional agent_id string to filter verification to a specific agent.
inputSchema: { type: "object", properties: { agent_id: { type: "string", description: "Verify chain for a specific agent only. If omitted, verifies all entries.", }, }, }, - index.js:103-118 (registration)Registers 'verify_chain' as a tool in the ListToolsRequestSchema handler, providing its name, description, and input schema.
{ name: "verify_chain", description: "Verify the integrity of the audit trail hash chain. " + "Each entry's SHA-256 hash includes the previous entry's hash — " + "if any record was modified, the chain breaks and this will report where.", inputSchema: { type: "object", properties: { agent_id: { type: "string", description: "Verify chain for a specific agent only. If omitted, verifies all entries.", }, }, }, },