Skip to main content
Glama

Poll Next Task

poll_next_task

Atomically 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

NameRequiredDescriptionDefault
agent_idNoWorker agent identifier claiming tasks (defaults to AGENT_NAME env var, e.g., "workbuddy").

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.3.0
    • changedInput schema / properties / agent_id / description
      Previous value: -"Current worker agent identifier (defaults to AGENT_NAME env var, e.g., \"workbuddy\")"New value: +"Worker agent identifier claiming tasks (defaults to AGENT_NAME env var, e.g., \"workbuddy\")."
  2. First observedv0.1.0

TDQS

A4.4/5.0
Behavior4/5

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

Annotations already disclose readOnlyHint=false and idempotentHint=false, and the description reinforces this with the exclusive-ownership semantics, claim_token, and exec_ttl_sec that come with a claim. It also warns about disk-side consequences (never editing pointer files for read-only/proposal tracks) with ADR references, which is real behavior beyond the annotations. What's missing is what happens on duplicate claims or whether a claim can be lost mid-work, though release_contract/extend_ttl siblings imply that lifecycle.

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?

Front-loaded one-sentence summary followed by clearly headed sections, so an agent can stop reading after the first line. The Delivery Track Rules block is long for a polling tool, but it carries decision-relevant constraints that aren't available elsewhere; a small trimming pass would make it a 5.

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?

No output schema exists, and the description compensates by spelling out both the success payload (has_task, contract fields, claim_token) and the empty/stale shape (stale_error, remediation). Combined with the usage exclusions and write-mode rules, an agent has everything needed to call it and act on the result.

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?

Only one optional parameter and schema coverage is 100%, so the schema already documents agent_id and its env-var default. The description adds only the framing that tasks are scoped to "this agent" / "your agent_id," which barely extends the schema. Baseline 3 applies when the schema does the work.

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?

Opening sentence gives a specific verb and resource ("atomically claim the oldest pending SUBMITTED contract") plus the state transition SUBMITTED→CLAIMED, which uniquely identifies it among siblings like dispatch_contract or release_contract. The Purpose section restates the scope without vagueness.

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?

Explicit "When to use" and "When NOT to use" with named alternatives: inspect_mesh_state for non-claiming inspection and dispatch_contract for creating work. It goes further by giving conditional rules keyed on contract.task_type and contract.write_mode that determine what the agent may do after claiming.

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