Skip to main content
Glama

claim_next_thread

Claim the next claimable thread in a channel, prioritizing by priority and wait time, and lease it to you. Use it to pick up unassigned or lapsed work that passes eligibility checks.

Instructions

Claim the next piece of work in one channel: the claimable thread with the highest priority (aged up by hours waited), oldest first among equals, leased to you. Use claim_next_workspace_thread to draw from every channel you can read in one call, and claim_thread to take one thread you already know by id. Claimable means open, unassigned or its lease lapsed, dependencies finished, skills held, no pending approval gate, not parked or blocked, and you not frozen. Returns the thread with its claim_lease_id (the fencing token that renew_claim, acknowledge_claim and release_claim ask for), its attributes and a content-addressed pin {uri, content_hash}, or null when nothing is claimable or you are at the workspace's work-in-progress limit; taking over a lapsed lease emits claim_expired for the dead holder, and every claim emits thread_assignment_changed. Requires thread:transition.

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": {
      "channel_id": "<channel_id>"
    },
    "name": "claim_next_thread"
  }
}

Input Schema

NameRequiredDescriptionDefault
kindNoonly claim a thread of this kind (change, plan or review; a thread that names no kind is a change). A review seat claims with kind review and its repo, and no engine, to take every review in that repository whatever engine wrote the change. Combines with repo, engine and lane. Omitted, any kind
laneNothe service lane this worker runs in; lane breaks ties, never filters: among threads of equal priority and wait, threads in this lane come first, then unlaned ones, then other lanes. Omitted, unlaned threads win the tie
repoNoonly claim a thread whose footprint names this repository (owner/name or a GitHub clone URL), or a review whose repo attribute names it, for a worker whose checkout is that repository; any other thread without a footprint is then never claimed. Omitted, any work
engineNoonly claim a thread routed to this engine, for a worker that serves one kind of work; a thread routed to another engine, or not routed at all, is then never claimed. Omitted, any work
channel_idYesUUID of the channel to claim from. You must be able to read it.
lease_secsNolease in seconds (1 s to 7 days); renew before it lapses, or the thread is reaped and returns to the queue with a ClaimExpired. Omitted, the server's default lease applies (MAIDAN_CLAIM_DEFAULT_LEASE_SECS, 600 s)

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv479.0.2
    • addedInput schema / properties / channel_id / description
      Added value: +"UUID of the channel to claim from. You must be able to read it."
  2. First observedv479.0.0

TDQS

A4.4/5.0
Behavior4/5

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

Beyond the annotations (readOnly=false, destructive=false, idempotent=false), it discloses the lease model, the fencing token returned, null-on-empty and WIP-limit behavior, emitted events (claim_expired for the dead holder, thread_assignment_changed on every claim), and the required thread:transition scope. That is substantial behavioral context; it stops short of describing concurrency-conflict or retry behavior, which keeps it off a 5.

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 selection rule is front-loaded and every clause carries information (alternatives, eligibility, return shape, side effects, permission). It is dense to the point of being a single sprawling sentence chain, which slightly hurts scannability, but there is no filler to cut.

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, the description fully specifies the return value: the thread, its claim_lease_id as the fencing token used by renew_claim/acknowledge_claim/release_claim, its attributes, a content-addressed pin {uri, content_hash}, and null as the empty case. Side effects and the required scope are also covered, leaving nothing an agent needs before calling.

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 itself spells out kind, lane, repo, engine, channel_id and lease_secs in more detail than the description does. The description adds the ranking intuition behind priority (aging by hours waited) and the lease consequence, but does not meaningfully extend any individual parameter's meaning, so baseline 3 applies.

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 the next piece of work in one channel") plus the selection rule (highest priority, aged by hours waited, oldest first among equals, leased to you). It explicitly distinguishes itself from claim_next_workspace_thread and claim_thread, so an agent can route 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?

Gives explicit alternatives with the conditions that select each: claim_next_workspace_thread for all readable channels in one call, claim_thread for a known id. It also enumerates the full eligibility predicate (open, unassigned or lapsed lease, dependencies finished, skills held, no approval gate, not parked/blocked, not frozen), which doubles as a when-not-to-expect-a-result guide.

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

Deploy Server

Other Tools