MCP tools
kraft admin mcp serves these tools over stdio. The Kraft plugin
registers it in the agent it is installed in, and kraft admin init registers
it for Claude Code. For an agent without the plugin, see
Register Kraft with your agent.
The tool names and parameters are a public interface: they keep their shape between minor releases. See Versioning and stability.
Same as the CLI
Each tool calls the same client function as its kraft command, and --json prints that function's payload, with three differences:
get_work_itemreturns a trimmed item (its status, current node, pending gate, attachments, progress, stop reason, usage, any policy override, any concerns a task raised about its own work, andnext_node_id, and not its chain or sessions).kraft view show --jsonprints the full detail, with the effective chain, worker sessions and stop.approve_gate,reject_gate,resume_work_item,retry_work_item,raise_budget,skip_work_item,complete_work_itemandcancel_work_itemanswer asget_work_itemdoes. The CLI's--jsonprints the item's whole row, with its frozen chain.list_work_itemslists every repo.kraft view listis scoped to the repo you are in unless--allor--reposays otherwise.
work_item_id is optional wherever a tool takes it. Left out, it is the work item whose worktree or session you are in.
Errors
A refused call is an error result whose text ends with the line the command prints, such as kraft: 404: unknown work item, so the agent can see why.
An argument the API cannot read names the field and what is wrong with it: kraft: 422: label: Input should be 'must_fix', 'question' or 'nit'.
Who may call what
The last column of each table below, and the Human mark, say what an agent may do.
| Mark | Meaning |
|---|---|
| Human, in the What it does column | A decision the agent should ask a person about first. |
refused, in the Own item column | The tool fails when a Kraft worker aims it at the item it is running. The API behind it refuses the same call from a worker session. |
API only: any item, in the Own item column | The tool has no check of its own. The API refuses it from any Kraft session, on any item, as the second exception says. |
| A blank Own item cell | A worker may use the tool on its own item. |
Three exceptions:
- An escalation turn is not a worker, so neither the client nor the API refuses it the
refusedtools on the item it is helping with. Four are still refused to it:approve_gate,reject_gate,raise_budgetandset_work_item_policy, because a gate and a spending cap are a person's call.
In practice a turn can useretry_work_itemon aneeds_humanitem, which Kraft records and performs once the turn ends,complete_work_item,cancel_work_item,set_agent_overrides, andset_node_overridesfor a node that has not started. The API answers it409for these:skip_work_item,resume_work_itemandescalate_work_item, while any escalation turn is running, the caller's own included.pause_work_item: a turn runs only on an item that isneeds_humanorpaused, and pause takes only a running one.set_attachments: a turn runs only on an item that has started, and a started item's documents are fixed.
- The API refuses
add_review_comment,submit_review,resolve_threadandreopen_threadfrom any Kraft session, a worker or an escalation turn, on any item and not only its own. kraft item abandon,item archiveanditem restorehave no tool. A worker is refusedabandonon its own item too.
Read
| Tool | What it does | Parameters | Command | Own item |
|---|---|---|---|---|
list_work_items | Lists work items. Abandoned and cancelled items show only when you ask for abandoned. | status: paused, active, queued, blocked, waiting, rate_limited, needs_human, completed or abandoned. | kraft view list | |
get_work_item | Returns the item, trimmed: see Same as the CLI. | work_item_id. | kraft view show | |
get_gate_artifact | Returns the spec or plan the pending gate decides, and the digest a chain revision gate needs. | work_item_id. | kraft view artifact | |
get_attachment | Returns the spec or plan the item was filed with, as Kraft stored it then: readable before the item starts. | kind (required: spec or plan), work_item_id. | kraft view docs --attachment | |
search | Searches specs, plans and session summaries across repos. | q (required), limit (default 20). | kraft view search | |
list_threads | Lists review threads, drafts included. | work_item_id, open_only (default false). | kraft view threads | |
compare_changes | Compares two review targets. A target is base, attempt:N, last_review or latest. | work_item_id, from_ (default base), to (default latest), nodes (comma-separated node ids), ignore_whitespace (default false). | kraft view compare |
File and connect
| Tool | What it does | Parameters | Command | Own item |
|---|---|---|---|---|
create_work_item | Files the item paused. See Creating a work item. | title (required), repo, chain, description, attachments, auto_gate (default true), implements_beads, depends_on, policy, base_branch, skip_nodes, budget_usd, node_overrides, and chain_template (the pre-2.0 name of chain, still read; chain wins when both are given). | kraft item create | |
ensure_repo | Connects the repo if it is not connected yet. See Connecting a repo. | path (default: the current directory), test_command, setup_command. | kraft repo connect |
Creating a work item
Some create_work_item parameters have a default or a shape:
repodefaults to the repo of the item you are in.chaindefaults to the repo'sdefault_chain, elsedefault.attachmentsis[{"kind": "spec" or "plan", "path": ...}], at most one of each. Apathis resolved against the repo and against the working tree you are standing in, relative to that tree or absolute.auto_gatedefaults to true.depends_onis work item ids this item comes after. You still start it; started while one is unfinished it is blocked, and Kraft starts it when they complete. They cannot be added later.budget_usdsets a dollar cap. This tool can set a cap but not lift one.
The tool warns, in repo_warning, when the repo declares no setup command or no test command, which would stop the item.
A call that files an item with a spec attached:
{"title": "fix the flaky test", "attachments": [{"kind": "spec", "path": ".engineering/specs/x.md"}]}
An attached document trims the node whose gate it satisfies, so nobody approves again what was already agreed.
Connecting a repo
When it connects a repo, ensure_repo proposes both commands from the repo's task runner, CI and lockfiles, or takes the ones given ("" for none). It returns every candidate it found.
With test_command: "" the repo is saved disabled: a repo with no tests passes every work item's verification untested, so a person enables it, not the agent. An already-connected repo is left as it is.
Act on a work item
| Tool | What it does | Parameters | Command | Own item |
|---|---|---|---|---|
approve_gate | Approves a pending gate. Human. | work_item_id, gate (default: the pending one), digest (a chain revision gate needs it). | kraft item approve | refused |
reject_gate | Rejects the pending gate and sends the chain back to work. Human. | note (required), work_item_id, gate, node (where the chain re-enters). | kraft item reject | refused |
pause_work_item | Pauses the item and ends its running sessions. A queued item leaves the queue, back to where it was. | work_item_id. | kraft item pause | refused |
unblock_work_item | Drops what a blocked or paused item still comes after, or only dependency. A blocked item with nothing left to wait for then starts on its own. Human. | work_item_id, dependency. | kraft item unblock | refused |
resume_work_item | Starts a paused item, including one just filed. Queues the item when every slot is busy, and blocks it when it comes after an unfinished item. | work_item_id, steer, steers ({task path: steer}). | kraft item resume | refused |
retry_work_item | The only way back onto a stopped item. It does not reset a breached cap's counters, so an item that stopped on a cap stops again. Queues the item when every slot is busy. | work_item_id, steer, path (node, node.step or node.step.task), restart (default false). | kraft item retry | refused |
raise_budget | Raises the dollar cap that stopped the item and retries it; queues the retry when every slot is busy. See Raising a dollar cap. Human. | budget_usd (required; null for no cap), work_item_id. | kraft item raise-budget | refused |
skip_work_item | Advances past the current node or gate without running it. Human. | work_item_id, note, path. | kraft item skip | refused |
complete_work_item | Ends the item as completed. Human. | reason (required), work_item_id, close_beads (default false). | kraft item complete | refused |
cancel_work_item | Ends the item as cancelled. The worktree stays. Human. | reason (required), work_item_id. | kraft item cancel | refused |
escalate_work_item | Sends a message into the item's escalation thread. | message (required), work_item_id. | kraft item escalate | refused |
Raising a dollar cap
raise_budget raises the item's own cap, or the item-wide budget_usd of its policy, which it merges into the item's policy override, keeping its other fields.
Any other cap's stop is refused. A node's budget_usd or a token_budget comes with a pointer to kraft item set-policy (here, set_work_item_policy), which replaces the whole override, so pass the fields it already has too. A stop on budget.daily_usd is refused too: raise it in policy.yaml, or wait for local midnight. Raise a cap that stopped an item lists every refusal. See Raise a cap on a stopped item.
Change a work item's setup
These refuse with 409 once the item, or the node, has started, except the
policy tool, which binds from the next node entered.
| Tool | What it does | Parameters | Command | Own item |
|---|---|---|---|---|
set_chain | Switches a not-yet-started item's chain. | chain (required), work_item_id. | kraft item set-chain | |
set_attachments | Revises a not-yet-started item's spec or plan, or drops one. | work_item_id, spec, plan (paths), drop (["spec"], ["plan"] or both). | kraft item set-attachments | refused |
set_agent_overrides | Sets the model and effort of every agent node. Replaces the whole override: a field you leave out goes back to the chain's own binding. | work_item_id, model, escalate_model, effort, clear (default false). | kraft item set-overrides | refused |
set_node_overrides | Sets one node's agent overrides. | node_id (required), work_item_id, auto_escalate, auto_escalate_stuck, auto_escalate_delay_s, model, effort, extra_prompt, clear (default false). | kraft item set-node-override | refused |
set_work_item_policy | Gives the item its own policy override. Replaces the whole stored override. | work_item_id, policy (item-wide fields, plus paths for per-scope fields; item-wide budget_usd may be "none", no dollar cap), clear (default false). | kraft item set-policy | refused |
Review
| Tool | What it does | Parameters | Command | Own item |
|---|---|---|---|---|
add_review_comment | Leaves a draft comment. See Review comment parameters. | body (required), work_item_id, thread_id (to reply), file_path, start_line, end_line, side, start_side, quote, label, suggestion. | kraft item comment | refused |
resolve_thread | Resolves a review thread. | thread_id (required). | kraft item resolve | API only: any item |
reopen_thread | Reopens a resolved review thread. | thread_id (required). | kraft item reopen | API only: any item |
submit_review | Sends the drafts. Human. | outcome (required: comment, request_changes or approve), work_item_id, summary, node. | kraft item review | refused |
Review comment parameters
sideisoldornew, defaultnew:end_line's side.start_sideisstart_line's side, when the range crosses sides.quoteis the range's lines, each led by its diff mark; left out, Kraft quotes them from the diff.labelismust_fix,questionornit.suggestionis for new-side lines only.
For Kraft's own workers
| Tool | What it does | Parameters | Command | Own item |
|---|---|---|---|---|
report_progress | Reports that the worker started a plan task. | task (required): the N of the plan's ## Task N heading. work_item_id. | kraft item progress | |
reply_to_thread | Answers a review thread. | thread_id, body (both required), claim (fixed, answered or should_fix). | kraft item reply | |
set_mr_labels | Labels the merge request and re-creates its pipeline. | labels (required), work_item_id. | kraft item mr-label | |
permission_request | Not for an agent to call: Kraft passes it to Claude Code as --permission-prompt-tool. See Permission gate. | tool_name, input (both required), tool_use_id. | none |
Related
- CLI: the verb behind each tool, with its flags and output.
- Use Kraft from your agent: how to register these tools with an agent, and how to check that it works.
- Permission gate: how Kraft answers a worker's asks, and what
permission_requestis for.