Claim task(s)
claim_taskClaim the next queued task for a worker, ensuring each task is handled by exactly one consumer. Use count to fetch multiple tasks and leaseMs to set a custom lease time.
Instructions
Claim the next task(s) off a queue for worker (competing consumers — each task goes to exactly one claimer). An empty queue returns {tasks:[]} (not an error). Each returned task carries a fencingToken and visibilityDeadline — keep them: ack/nack/extend need the token, and the task returns to the queue if you do not ack/extend before the deadline. count prefetches several; leaseMs overrides the task default lease.
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": {
"queue": "<queue>",
"worker": "<worker>"
},
"name": "claim_task"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| count | No | prefetch up to N tasks (default 1) | |
| queue | Yes | ||
| worker | Yes | a stable id for this worker (appears in the task as claimedBy) | |
| leaseMs | No | lease length; omit to use the task default |