Skip to main content
Glama

MCPFax Agent Continuity

Acquire a mutual-exclusion lease

lease
Idempotent

Mutual exclusion so two instances of the same agent do not both process one item. Returns acquired:true with a fence token (FREE), or acquired:false naming the current holder and when the lease expires. ACQUIRED:FALSE MEANS YOU DO NOT HOLD THE LOCK — you must NOT proceed, and must not treat the refusal as advisory: stop work on that resource, wait retry_after_seconds, or do something else. acquired:null means we could not determine the state, which is also not permission to proceed. YOU ARE GIVEN TWO NUMBERS AND THEY DO DIFFERENT JOBS. fence is a CREDENTIAL: a large integer drawn fresh and independently for every acquisition, so it is never 1, never a step from the fence you held last time, and not computable from any number of fences you have ever been given. Treat it as a secret — it is the one thing that tells you apart from another instance using your holder label. generation is the ORDER: a counter that strictly increases on every fresh acquisition and never resets, not on expiry and not on release. It is not a secret, it is the number to compare and the number to hand to an external store that must reject stale writers. A revived holder from an earlier generation therefore cannot renew or release a lease someone else now holds — not because its number is smaller, but because it does not have the new one. RE-ACQUIRING A LEASE YOU HOLD IS A RENEWAL ONLY IF YOU PRESENT ITS fence — a holder LABEL is not proof, because two instances of the same agent are exactly the callers most likely to share one, and we will not hand the same lock to both. A live lease requested under its own label without the fence is REFUSED with acquired:false, same_holder_label:true and held_by, never silently renewed. A renewal keeps your fence and stays free. $0.002 is charged the first time you are refused by a given holder; being refused again by the SAME holder is free. Costs $0.002 USDC per call via x402 on Base, and ONLY when acquired === false, and this refusal by this holder has not been billed before; otherwise the same call returns the full answer and settles nothing. Authenticate with Authorization: Bearer , or pass agent_key as an argument if your host cannot set headers. Equivalent HTTP route: POST /v1/lease.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
keyYesResource being locked. Namespace-scoped, hashed before storage. Example: 'queue/orders'.
fenceNoOptional: the fence token you were given for this key. Supply it to RENEW the lease you already hold. Omit it and a live lease is refused rather than renewed, because a holder label alone cannot tell you apart from another instance using the same one. It is a CREDENTIAL, not a counter: each acquisition draws an independent large integer, so it is never 1, never the last one plus one, and cannot be computed from any fence you have held before. The value below is a shape, not a value that will work. Example: '3170294857216913'.
scopeNoOptional unit of work, so resume_packet can report the leases you still hold. IT IS ALSO WHAT MAKES THIS LEASE RECOVERABLE: a dead-man switch releases only leases recorded against a scope, so a lease taken without one is invisible to it and a dead holder's lock will block the work for the lease's full TTL. Pass it on every lease you want a switch to be able to give back. Example: 'permit-review-2026-08'.
holderYesWho is asking — an instance id you choose. Required, and it MUST BE UNIQUE PER LIVE INSTANCE: two concurrently running copies that send the same holder are two different callers, and only one of them can hold the lock. Use a per-process value (a uuid, a pod name), not a role name every replica shares. Example: 'worker-3-6f2a91'.
agent_keyNoYour agent_secret, if your MCP host cannot set the Authorization header. Prefer the header.
ttl_secondsNoLease lifetime. Default 60, max 3600. Example: '60'.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • addedInput schema / properties / agent_key / examples
      Added value: +[
      +  "the agent_secret that register returned"
      +]
  2. Changed5 schema fields changed
    • addedInput schema / properties / fence / examples
      Added value: +[
      +  3170294857216913
      +]
    • addedInput schema / properties / holder / examples
      Added value: +[
      +  "worker-3-6f2a91"
      +]
    • addedInput schema / properties / key / examples
      Added value: +[
      +  "queue/orders"
      +]
    • addedInput schema / properties / scope / examples
      Added value: +[
      +  "permit-review-2026-08"
      +]
    • addedInput schema / properties / ttl_seconds / examples
      Added value: +[
      +  60
      +]
  3. First observed

TDQS

A4.7/5.0
Behavior5/5

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

Annotations only indicate readOnly=false, idempotent=true, destructive=false. The description goes far beyond that: it explains refusal vs null semantics, fence as a credential vs generation as an order, dead-man switch recoverability via scope, billing only on first refusal by a holder, and authentication options. This is exactly the operational detail an agent needs and the annotations do not provide.

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?

The description is long but dense and front-loaded: the first sentence gives the core purpose and the critical refusal warning is capitalized early. Some redundancy exists in the fence/generation explanation and repeated 'do not proceed' warnings, but given the high stakes of distributed locking, the length is largely justified.

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?

With no output schema present, the description compensates by covering all three response possibilities: acquired:true with fence, acquired:false with holder and expiry, and acquired:null as indeterminate. It also covers billing, auth, HTTP route, renewal, and scoping edge cases. For a six-parameter tool with this much behavioral nuance, nothing important is missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, but the description adds significant meaning beyond the schema. It explains why fence is a credential and never predictable, why holder must be unique per live instance, why scope makes a lease recoverable, and how omitting fence causes a refusal rather than renewal. This materially improves correct parameter usage.

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?

The description opens with a specific verb and resource: 'Acquire a mutual-exclusion lease' and immediately states the purpose: 'Mutual exclusion so two instances of the same agent do not both process one item.' It clearly distinguishes the tool's core behavior from siblings like lease_release and lease_renew through acquired states, renewal rules, and refusal semantics.

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?

It gives strong contextual guidance: use this to lock a resource before processing, renew by presenting the fence, and do not proceed on acquired:false or null. It also explains when a lease is refused vs renewed. However, it never explicitly names sibling tools like lease_renew or lease_release as the alternative for those actions, 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.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources