Skip to main content
Glama

claim_host

Idempotent

Acquire an exclusive lock on a host for a workstream before running tasks; automatically takes over stale locks from crashed workers. Keep the lock fresh with heartbeats and release it when finished.

Instructions

Claim exclusive use of a host. Fails if another owner holds a fresh lock — a stale lock (heartbeat older than its TTL, e.g. from a crashed worker) is taken over automatically. Always report a phase (what you are doing); the server flags a lock STUCK when its heartbeat is fresh but the phase has not moved for too long, so keep the phase current (pass a new phase to heartbeat_host) as you progress. Heartbeat while you work; release with release_host when done.

Input Schema

NameRequiredDescriptionDefault
noteNoFree text for the dashboard, e.g. the current step
forceNoTake over even if another owner's lock is still fresh
ownerYesWho is asking: workstream/session id, e.g. 'ws/occluder-wire', 'p-1a2b3c4d', 'coord-session'
phaseNoWhat you are doing, e.g. 'compile', 'test' — powers stuck detection
host_idYesHost id from list_hosts, e.g. 'build-pc'
ttl_secNoLock lifetime without heartbeat, seconds (min 60)

Output Schema

NameRequiredDescriptionDefault
noteNofree text from the owner, e.g. the current step
freshYesheartbeat within ttl (False = stale, can be taken over)
ownerYes
phaseNowhat the owner is doing ('', 'compile', 'test', ...); '' = not reported
stuckNofresh heartbeat but the phase has not moved past the server's threshold (liveness != progress)
age_secYesseconds since the last heartbeat
host_idYes
ttl_secYes
acquired_atYes
phase_sinceNowhen the current phase started (NULL when no phase)
heartbeat_atYes
stuck_reasonNowhy the server marked this lock stuck
phase_age_secNoseconds since the phase was last changed

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.6/5.0
Behavior4/5

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

Annotations already declare readOnlyHint=false and idempotentHint=true, so the safety profile is covered; the description adds substantial unstated behavior—stale-lock takeover, STUCK detection driven by phase freshness, and the expectation to keep phase current. It doesn't explain force or the TTL interaction explicitly, which is the only real gap.

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?

Four sentences, front-loaded with the core operation, then failure semantics, then the phase/heartbeat obligation and release step. Dense and useful throughout, though the phase guidance is slightly repetitive.

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?

For a lock-mutation tool with an output schema, the description covers acquisition, failure, takeover, stuck detection, and release—everything an agent needs to invoke it correctly.

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

Parameters4/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 adds meaning by tying phase to server-side stuck detection and to heartbeat_host updates, which the schema only hints at. It does not discuss force or ttl_sec semantics, so it exceeds baseline without being exhaustive.

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 ('Claim exclusive use of a host') and positions the tool within a lifecycle by naming heartbeat_host and release_host. An agent can tell it apart from those siblings without opening any 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?

Explicitly explains the core condition: fails when another owner holds a fresh lock, but a stale lock is taken over automatically. It goes on to prescribe the follow-up flow (heartbeat while working, release_host when done), leaving little to inference.

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