Skip to main content
Glama

Fail Contract

fail_contract
Destructive

Marks a claimed contract as terminally failed with a mandatory reason, recording status and completion time for requester visibility.

Instructions

Explicitly mark a CLAIMED contract as terminal FAILED with a mandatory failure reason.

Behavior & Side Effects

  • Destructive terminal transition: Sets status='FAILED', error_reason='WORKER_FAILED: ', and completed_at=nowMs.

Return Value

Returns { ok, contract_id, status: 'FAILED' | 'TIMED_OUT', 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>",
      "reason": "<reason>"
    },
    "name": "fail_contract"
  }
}

Input Schema

NameRequiredDescriptionDefault
reasonYesMandatory explanation of why the task cannot be completed. Stored in error_reason for the requester.
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 mark as terminal FAILED.

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/5.0
Behavior4/5

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

Annotations already flag destructiveHint=true and non-idempotent, but the description goes further by naming the exact fields written (status='FAILED', error_reason prefixed 'WORKER_FAILED:', completed_at) and the terminal nature of the transition. It stops short of saying whether the transition is reversible or what happens on claim_token/agent_id mismatch, and the 'TIMED_OUT' status in the return shape is left unexplained.

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?

A single front-loaded summary sentence followed by short, headed sections on side effects and return value. No filler, and the most decision-relevant fact (terminal destructive transition) comes first.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With no output schema, the description correctly documents the return object, and it covers the state mutation in detail. It is slightly incomplete on edge cases (timeout-induced FAILED vs TIMED_OUT, lease-token enforcement) that an agent would want before firing an irreversible call.

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 every parameter is already documented, including the mandatory nature of reason. The description reinforces that the reason is mandatory but adds no format, length, or content guidance beyond the schema.

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 ('mark a CLAIMED contract as terminal FAILED') plus the key precondition that the contract must be claimed, which cleanly separates it from siblings like fulfill_contract and release_contract without naming them.

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 'cannot be completed' framing in the reason parameter implies when to call it, but the description never states explicit when-not conditions or routes the agent to alternatives (e.g. release_contract to hand back a lease without failing, extend_ttl to buy time). For an irreversible terminal transition, that omission matters.

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