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 anddisplay_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.
A work item ID, there or in depends_on or dependency, may be the start of one: 4 characters or more that no other item's ID starts with. A worker session can't act on its own item by the start of its ID either.
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 can't 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. |
Four exceptions:
- An escalation turn isn't 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 hasn't started, except itsextra_prompt. 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.
- On a disabled repo, or a workspace that selects a disabled member, the API refuses
create_work_item, andresume_work_itemfor an item that has never started, from any Kraft session or MCP session: a person enables the repo in Settings › Repos first, since its commands run for every item. - The API refuses
add_review_comment,submit_review,resolve_thread,reopen_thread,add_worker,edit_worker,rotate_worker_token,list_workersandremove_workerfrom 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 or cancelled. Each row carries display_status beside status. | status: a stored or displayed status, not archived. A word both have, such as waiting, means the stored one. | 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 | |
forge_mr | Returns the item's merge request as the forge has it. Errors until the item has one. | work_item_id, repo (a workspace member's mount path). | kraft view mr | Added in 2.5 |
forge_pipelines | Lists the item's pipelines or workflow runs. | work_item_id, repo. | kraft view pipelines | Added in 2.5 |
forge_jobs | Lists the jobs of one pipeline, by an ID from forge_pipelines. | pipeline (required), work_item_id, repo. | kraft view jobs | Added in 2.5 |
forge_job_log | Returns the last lines of one job's log as {"log", "truncated"}. | pipeline, job (required), work_item_id, lines (default 200, 1 to 5000), repo. | kraft view job-log | Added in 2.5 |
forge_merged_mrs | Lists recently merged merge requests into the base branch. | work_item_id, limit (default 20, 1 to 100), repo. | kraft view merged | Added in 2.5 |
forge_labels | Lists the project's labels. | work_item_id, repo. | kraft view labels | Added in 2.5 |
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, in_place, skip_nodes, budget_usd, node_overrides, runner, chain_yaml and chain_template. A node's extra_prompt in node_overrides is refused: a person sets it. Added in 2.4 | kraft item create | |
ensure_repo | Connects the repo if it isn't connected yet. See Connecting a repo. A test_command ("" included) or a non-empty setup_command you pass saves the repo disabled, and the answer's held says why. | 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.chain_templateis its old name, still read;chainwins when both are given.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 can't be added later.budget_usdsets a dollar cap. This tool can set a cap but not lift one.runneris where the item's steps run: a machine or group fromworkers.yaml,anyorlocal. It wins over the library'srunner:.in_placetrueruns the item in the repo's own checkout,falsein a worktree. Unset, the repo'sworktreessetting decides.
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.
Commands passed to the tool are an agent's choice, and they run for every work item on the repo, so a test_command ("" included) or a non-empty setup_command saves the repo disabled, and the answer carries held: saved disabled: an agent chose its commands, which run for every work item on it, so no agent files work on it until a person has read them and enabled it in Settings › Repos.
With no commands, or only setup_command: "", the repo connects with Kraft's own proposal, enabled when it found a test command. An already-connected repo is left as it is.
Filing a one-off chain
Added in 2.5
create_work_item and set_chain take chain_yaml: the YAML a chain file holds, used by this one item and never added to the library. If it has custom content (its own prompts, commands, tools or gates), a person must review it in the web UI before the item can start. These tools can't approve it.
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), head (the final review needs the review_head that get_work_item returned). | 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. Added in 2.1 | work_item_id, dependency. | kraft item unblock | refused |
resume_work_item | Starts a paused item, including one just filed; its steer also answers a stop on an agent's question. 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 way back onto a stopped item. It doesn't 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, head (the final review needs it). | 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. kraft item raise-budget 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, chain_yaml (one of the two, see Filing a one-off chain), work_item_id. Added in 2.5 | 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. A call that doesn't name runner keeps the stored one. | work_item_id, model, escalate_model, effort, runner (a machine or group, any or local), clear (default false). Added in 2.4 | kraft item set-overrides | refused |
set_node_overrides | Sets one node's agent overrides. extra_prompt is refused: a person sets it. clear is the only way this tool drops one, and it resets the node. | node_id (required), work_item_id, auto_escalate, auto_escalate_stuck, auto_escalate_delay_s, model, effort, extra_prompt, reviewers, runner, clear (default false). runner also works on a started node. reviewers is a list of {"bot": LOGIN} or {"check": NAME}; [] expects none. Added in 2.4 | 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, head (an approve at the final review needs it). | 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.
Machines
Added in 2.4
| Tool | What it does | Parameters | Command | Own item |
|---|---|---|---|---|
add_worker | Registers a machine that may run steps. Human. Without ssh, the reply carries a one-time token and the command to run on the machine. | name (required), ssh, capacity (unset: the machine's own limit, else 1), repos, give_up_after, groups, enabled (false: takes no new steps). | kraft admin worker add | API only: any item |
edit_worker | Changes a machine, or local (only enabled, capacity and groups). Human. Only what you pass changes; the reply is its row. | name (required), enabled, capacity, unset_capacity, give_up_after, groups ([] clears), repos, every_repo, ssh. capacity and unset_capacity go not together, nor repos and every_repo. | kraft admin worker edit, enable, disable | API only: any item |
rotate_worker_token | A new token for a dial-in machine, returned once with the command to run. The old one stops working at once. Human. | name (required). | kraft admin worker rotate-token | API only: any item |
list_workers | Lists the machines: online or offline and why, whether each takes new steps, slots, repos, last seen, Kraft version, the items whose steps it holds, and why it can't be removed. | none | kraft admin worker list | API only: any item |
remove_worker | Removes a machine and revokes its token or ssh entry. Refused while a step runs on it, and for local. Human. | name (required). | kraft admin worker remove | API only: any item |
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 | |
rerun_failed_ci | Re-runs the failed CI jobs of the merge request, from a fix-loop repair that found they died outside the code. Once per fix attempt. Added in 2.6 | reason (required), work_item_id. | kraft item rerun-ci | |
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.