Skip to main content
Glama

claim_next_workspace_thread

Claims the next available work item across all readable workspace channels in one call, with optional filters and waiting. Returns the claimed thread and lease ID, or null if none is claimable.

Instructions

Claim the next piece of work across every channel of your workspace that you may read, in one call: the same selection, filters, lease and result as claim_next_thread, without the channel argument. Use claim_next_thread to draw from one channel only, claim_thread to take one thread by id, and get_workspace_queue_depth to count ready work before you ask. With wait_ms set and nothing claimable it holds the call open until work becomes claimable and claims it, so a worker needs no polling loop. A private channel's threads go only to its members and a DM's only to its participants. Returns the thread with its claim_lease_id, attributes and pin {uri, content_hash}, or null when nothing is claimable or you are at the workspace's work-in-progress limit. 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": {
      "workspace_id": "<workspace_id>"
    },
    "name": "claim_next_workspace_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
wait_msNowith nothing claimable, wait up to this long for work to become claimable (a new thread, a dependency finishing, a claim released or expiring) and claim it, instead of answering null at once. The claimant's wake-up: no polling loop. Omitted or 0, one try
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)
workspace_idYesyour own workspace (whoami's workspace_id)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv479.0.0

TDQS

A4.7/5.0
Behavior5/5

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

Annotations only declare the write/idempotency profile; the description adds substantial behavior beyond them: the long-poll hold-and-claim semantics, channel/DM visibility rules ('a private channel's threads go only to its members'), the null return when at the workspace WIP limit, and the required thread:transition permission. These are the auth, blocking and edge-case facts an agent needs before invoking.

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?

Purpose is front-loaded in the first clause, then alternatives, then long-poll behavior, then visibility rules, then return/permission. Every sentence carries distinct operational information 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?

With no output schema, the description still supplies the return shape ('the thread with its claim_lease_id, attributes and pin {uri, content_hash}, or null'), plus the permission gate and the long-poll edge case. For a 7-parameter, non-idempotent claiming tool this covers everything an agent needs to call it correctly.

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 description coverage is 100% and the parameter descriptions are already very detailed (tie-breaking for lane, footprint rule for repo, lease expiry for lease_secs), so the description's value is mostly the framing 'the same selection, filters, lease and result as claim_next_thread.' It restates wait_ms behavior rather than adding new syntax or constraints beyond the schema, so the 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 with scope: 'Claim the next piece of work across every channel of your workspace that you may read, in one call,' and immediately anchors it to claim_next_thread 'without the channel argument.' An agent can distinguish it from claim_next_thread and claim_thread 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 routes between three siblings: claim_next_thread for a single channel, claim_thread to take one thread by id, and get_workspace_queue_depth to count ready work first. It also states the condition that selects the long-poll mode ('With wait_ms set and nothing claimable'), so no inference is required.

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