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
| Name | Required | Description | Default |
|---|---|---|---|
| kind | No | only 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 | |
| lane | No | the 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 | |
| repo | No | only 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 | |
| engine | No | only 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_id | Yes | UUID of the channel to claim from. You must be able to read it. | |
| lease_secs | No | lease 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) |