Skip to main content
Glama

Agent State Graph Differ, Belief Conflict Resolver & SHA-256 Hasher

diff_agent_memory_checkpoint
Read-onlyIdempotent

Compute structural diffs between agent state snapshots, flag belief contradictions, and generate RFC 7396 JSON Merge Patch deltas with canonical checkpoint hashes for multi-agent handoffs.

Instructions

Computes structural diffs between two agent state snapshots ('added_keys', 'mutated_keys', 'removed_keys'), flags boolean belief contradictions, generates an RFC 7396 JSON Merge Patch delta, and computes a canonical checkpoint hash. Use when checkpointing agent state or transmitting minimal RFC 7396 state deltas across multi-agent handoffs; for counting BPE tokens and auditing Lost-in-the-Middle prompt attention, use plan_context_token_budget instead. Read-only call (32 KB, 60 RPM): accepts 'previous_state_json' (with enum defaults), uses '?demo=true' or L402 (10 sats); HTTP 400 if invalid.

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": {
      "previous_state_json": "<previous_state_json>",
      "current_state_json": "<current_state_json>"
    },
    "name": "diff_agent_memory_checkpoint"
  }
}

Input Schema

NameRequiredDescriptionDefault
conflict_strategyNoResolution policy when keys conflict; defaults to 'prefer_current' when omitted.
current_state_jsonYesJSON string or object representing the updated agent state snapshot.
previous_state_jsonYesJSON string or object representing the prior agent state snapshot.

Output Schema

NameRequiredDescriptionDefault
added_keysYesState keys newly introduced in current_state.
mutated_keysYesModified keys with before/after values and belief_contradiction flag.
checkpoint_digestYesDeterministic cryptographic hash of the canonicalized merged state.
rfc7396_json_merge_patch_deltaYesMinimal RFC 7396 JSON Merge Patch payload transforming previous into current.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv1.3.3

TDQS

A4.6/5.0
Behavior5/5

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

Adds substantial context beyond the already-informative annotations (readOnly/idempotent/non-destructive): 32 KB payload cap, 60 RPM rate limit, demo-mode access, L402 payment cost (10 sats), and HTTP 400 behavior on invalid input. These operational constraints are not derivable from schema or annotations.

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?

Core purpose is front-loaded in the first sentence, usage/routing in the second, and operational limits in the third. Dense but well-organized; the parenthetical field list and metered detail are tight, though the sentence runs long.

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?

Output schema exists so return values need no explanation, and annotations cover the safety profile. The description nonetheless supplies rate limit, size cap, auth options, and failure mode — everything an agent needs to call this correctly.

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%, so baseline is 3. The description references 'previous_state_json' but attaches '(with enum defaults)', when the enum actually lives on conflict_strategy — a minor imprecision rather than added value. The schema already documents both state params and the conflict_strategy enum.

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 set: computes structural diffs between two state snapshots, flags belief contradictions, generates an RFC 7396 patch, and computes a checkpoint hash. Names concrete output fields ('added_keys', 'mutated_keys', 'removed_keys') that let an agent distinguish it from siblings without opening the 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?

Explicit when-to-use ('checkpointing agent state or transmitting minimal RFC 7396 state deltas across multi-agent handoffs') plus a named alternative for the adjacent token-budget use case: 'use plan_context_token_budget instead'. Both the positive and negative routing conditions are present.

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

Deploy Server

Other Tools