Poll Next Task
poll_next_taskAtomically claims the oldest pending contract assigned to an agent and verifies local file fingerprints, enabling safe ownership transfer for queued work.
Instructions
Atomically claim the oldest pending SUBMITTED contract assigned to this agent and verify local file fingerprints.
Purpose
Retrieves and claims next available contract work for the current agent, transitioning it from SUBMITTED to CLAIMED.
Usage Guidelines
When to use: Call to discover and atomically take ownership of pending tasks assigned to your agent_id.
When NOT to use:
Do NOT use to non-destructively inspect queue depth or monitor status without claiming (use inspect_mesh_state).
Do NOT use to create contracts (use dispatch_contract).
Delivery Track Rules (check contract.task_type & contract.write_mode):
Read-only tasks (code_review / architecture_audit): NEVER edit pointer files on disk; place suggested diffs in structured_output.fixes (ADR-0004).
Mutation tasks with write_mode="direct": Edit target files on disk; post-mutation SHA-256 hashes are snapshotted at fulfill_contract (ADR-0006).
Mutation tasks with write_mode="proposal": NEVER edit pointer files on disk; deliver a unified diff via proposed_patch in fulfill_contract (ADR-0007).
Return Value
When work is claimed: { has_task: true, status: 'CLAIMED', contract: { contract_id, requester_agent, target_agent, task_type, write_mode, title, context_summary, workspace_root, pointers, contract_schema, claimed_at, exec_ttl_sec, claim_token } }.
When stale or empty: { has_task: false, status?, stale_error?, remediation?, message? }.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "poll_next_task"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| agent_id | No | Worker agent identifier claiming tasks (defaults to AGENT_NAME env var, e.g., "workbuddy"). |