Skip to main content
Glama

verify_contract

Performs a read-only pre-flight check that audits on-disk pointer files against the baseline SHA-256 snapshot, confirming contract files are clean before fulfillment to prevent TOCTOU strikes.

Instructions

Read-only pre-flight consistency check (ADR-0004): audits on-disk pointer files against the baseline SHA-256 snapshot.

Purpose

Enables agents or automated scripts to verify that on-disk files match the contract's dispatched baseline before calling fulfill_contract, preventing accidental TOCTOU strikes.

Usage Guidelines

  • When to use: Call before fulfill_contract while holding a CLAIMED contract to confirm file cleanliness, or when investigating why a fulfill call was blocked.

  • When NOT to use:

    • Do NOT use to deliver results (use fulfill_contract).

    • Do NOT use to renew time (use extend_ttl).

  • ADR-0004 Rule: Pointers are an immutable review baseline. If verify_contract reports dirty files, restore or stash them (e.g., git stash or git checkout -- ) and deliver proposed changes inside structured_output.fixes.

Behavior & Side Effects

  • Zero side effects: Pure read-only operation. Never updates the database, never alters contract status, and never consumes a TOCTOU strike.

  • Complete pointer check: Verifies all pointer files on disk and returns every drifted file (reason: SIZE_MISMATCH, CONTENT_CHANGED, or FILE_MISSING).

Return Value

Returns { ok: true, valid: boolean, fulfillable: boolean, contract_id: string, status: ContractStatus, target_agent: string, toctou_strike: number, max_toctou_strikes: number, dirty_files: Array<{ path, reason, detail }>, message: string }. NOTE: valid only means every pointer still matches its dispatched baseline. fulfillable additionally requires the contract to be CLAIMED. A contract that already went terminal (FAILED / POINTER_STALE / COMPLETED) can report valid=true while fulfillable=false, so branch on fulfillable rather than valid before calling fulfill_contract.

Input Schema

NameRequiredDescriptionDefault
agent_idNoOptional caller agent identifier for audit logging. Does not restrict read-only verification.
claim_tokenNoOptional lease token for caller verification (FC-301).
contract_idYesThe contract ID whose on-disk pointer files should be verified against the baseline SHA-256 snapshot without mutating contract state.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.3.2
    • addedInput schema / properties / claim_token
      Added value: +{
      +  "description": "Optional lease token for caller verification (FC-301).",
      +  "maxLength": 128,
      +  "minLength": 1,
      +  "type": "string"
      +}
  2. Addedv0.3.0

TDQS

A4.6/5.0
Behavior5/5

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

With no annotations at all, the description carries the full burden and does so: zero side effects, never mutates DB, never alters contract status, never consumes a TOCTOU strike. It also discloses that all pointer files are checked and enumerates the drift reasons (SIZE_MISMATCH, CONTENT_CHANGED, FILE_MISSING).

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 one-line summary and well-structured under headers, with the critical branch-on-fulfillable warning placed last for emphasis. It is somewhat long, and the Behavior section partly re-states the read-only claim made in the opening line, but nearly every sentence carries actionable information.

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?

No output schema exists, and the description fully documents the return shape and the crucial valid vs. fulfillable distinction, including the terminal-state edge case. Combined with side-effect disclosure and the ADR-0004 rule, nothing an agent needs to call this correctly is missing.

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 description coverage is 100%, so contract_id, agent_id, and claim_token are already documented in the schema; the description adds no syntax or format detail for them. Baseline 3 applies since the schema does the heavy lifting on parameters.

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 ('pre-flight consistency check ... audits on-disk pointer files against the baseline SHA-256 snapshot') and immediately scopes it as read-only. The Usage Guidelines name the exact siblings it is not (fulfill_contract, extend_ttl), so an agent can route without opening either 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' (before fulfill_contract while holding a CLAIMED contract; when debugging a blocked fulfill) and 'When NOT to use' with named alternatives. It even supplies the remediation path (restore/stash, put changes in structured_output.fixes) when verification reports dirty files.

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