Skip to main content
Glama

recompute_merkle_root

Read-onlyIdempotent

Recompute a Merkle root from a leaf and proof path to verify data integrity locally. Compare against expected root to detect tampering.

Instructions

Trustlessly recompute a dokimo-merkle-v1 root — LOCAL, no network, no trust.

Hash leaf in the leaf domain (H(0x00 ‖ leaf)) and replay proof_path — a list of [sibling_hash, side] where side is "L" or "R" — hashing internal nodes as H(0x01 ‖ left ‖ right). Compare the returned root to the root in an evidence package yourself; if it differs, the package was tampered with.

Returns {recomputed_root, merkle_scheme, steps}.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
leafYesThe raw leaf value (e.g. a JSON string like '{"k":"total_assets","v":"..."}'). Hashed in the leaf domain as H(0x00 ‖ leaf).
proof_pathYesOrdered Merkle proof path: a list of [sibling_hash_hex, side] pairs, where side is "L" if the sibling is on the left or "R" if on the right. Empty list for a single-leaf tree.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.7/5.0
Behavior5/5

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

Annotations already declare read-only and idempotent behavior; the description adds the exact hashing algorithm, domain separation, the no-network guarantee, the returned fields, and the caveat that comparison is the caller's responsibility. No contradiction with annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Every sentence earns its place: purpose, algorithm, caller responsibility, and return shape are packed into a compact, front-loaded description with no filler.

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 two-parameter pure computation tool, the description fully covers the algorithm, parameter semantics, return object, and the expected post-call action. The missing output schema is mitigated by explicitly listing the returned fields.

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 baseline is 3. The description adds operational meaning: leaf is hashed in the leaf domain, proof_path is replayed in order, and the side determines left/right ordering during internal-node hashing.

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 action ('recompute') and resource ('dokimo-merkle-v1 root'), with the key distinguishing trait 'LOCAL, no network, no trust.' It also implicitly differentiates itself from verify_evidence_package by instructing the caller to do the comparison themselves.

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?

Provides clear usage context: recompute locally and compare the returned root to the root in an evidence package; a mismatch signals tampering. It does not explicitly name alternative tools or state when not to use this tool, so it stops short of a 5.

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