Skip to main content
Glama

Release Contract to Queue

release_contract

Returns a claimed contract to the queue tail as SUBMITTED with a fresh queue window when the current agent cannot proceed, resetting claim state while preserving retry limits.

Instructions

Hand a CLAIMED contract back to the queue tail as SUBMITTED with a fresh queue window.

Behavior & Side Effects

  • Mutates database: Resets claimed_at=NULL, claim_token=NULL, updates queued_at=nowMs, resets extend_count=0 and toctou_strike=0, and increments release_count.

  • Preserves contract-level retry_count so schema validation retries cannot be laundered across releases.

  • Limits: Maximum 3 releases per contract; refused once past created_at + 4 * queue_ttl_sec.

Return Value

Returns { ok, contract_id, status: 'SUBMITTED' | 'CLAIMED' | 'TIMED_OUT', release_count, max_releases, remediation?, message }.

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": {
      "contract_id": "<contract_id>"
    },
    "name": "release_contract"
  }
}

Input Schema

NameRequiredDescriptionDefault
reasonNoOptional reason for releasing (e.g., "wrong context", "missing tool", "switching git branch"). Appended to error_reason history.
agent_idNoCurrent holder agent identifier. Must match target_agent of the claimed contract (defaults to AGENT_NAME env var).
claim_tokenNoExclusive lease token returned in contract.claim_token by poll_next_task (FC-301).
contract_idYesThe CLAIMED contract ID to release back to the queue tail as SUBMITTED.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.3.2
    • addedInput schema / properties / claim_token
      Added value: +{
      +  "description": "Exclusive lease token returned in contract.claim_token by poll_next_task (FC-301).",
      +  "maxLength": 128,
      +  "minLength": 1,
      +  "type": "string"
      +}
  2. Addedv0.3.0

TDQS

A4.3/5.0
Behavior5/5

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

Goes well beyond annotations: enumerates every mutated column (claimed_at, claim_token, queued_at, extend_count, toctou_strike, release_count), explains that retry_count is deliberately preserved to prevent laundering, and states the release cap and time window. This is exactly the mutation detail the readOnlyHint=false flag alone does not convey.

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?

Front-loads the one-sentence purpose, then sections behavior/side-effects, limits, and return value. Every bullet carries non-obvious information (state resets, retry_count preservation, cap) 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?

Compensates for the absent output schema by spelling out the return object and its status enum values, and covers destructive scope, limits, and failure remediation. An agent has everything needed to call it and interpret the result.

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%, and the schema already explains contract_id, claim_token, agent_id, and reason in detail. The description adds nothing about individual parameters beyond naming the returned fields, so the baseline 3 for a fully documented schema is appropriate.

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 plus the state transition: a CLAIMED contract is handed 'back to the queue tail as SUBMITTED with a fresh queue window.' The precondition (must be CLAIMED) and outcome distinguish it from siblings like extend_ttl or fail_contract without needing their schemas.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The CLAIMED precondition implies when it applies, and the 3-release / 4*queue_ttl_sec caps imply when it will be refused, but the description never states when to choose release over extend_ttl, fail_contract, or fulfill_contract. Guidance is implied rather than explicit.

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