Skip to main content
Glama

kb_apply_plan

Destructive

Apply approved bootstrap, compile, migration, or entity-deletion plans after revalidating plan hashes and live snapshots, with transactional or journaled recovery.

Instructions

Apply an explicitly approved kibi.bootstrap-plan.v1, kibi.compile-plan.v1, kibi.migration-plan.v2, or entity-deletion plan after revalidating its canonical hash and live snapshots. Compile plans apply all-or-nothing: a durable journal records every source write and store mutation before the first write, all steps commit in one store transaction, and an interrupted application is completed or rolled back by the next mutating call. Bootstrap actions are dependency-ordered, sequential, source-first, and recoverable from a typed journal.

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": "kb_apply_plan"
  }
}

Input Schema

NameRequiredDescriptionDefault
planNoThe complete bootstrap, compile, migration or hash-bound entity-deletion plan object to apply.
asyncNoMCP only: when true, run as a background job and return a kibi.job.v1 receipt to poll with kb_job_status.
workspaceRootNoOptional absolute path of the workspace this call is about, such as your git worktree, when it is not the server's.
approvedPlanHashNoExact SHA-256 planHash returned by kb_plan_bootstrap, kb_compile_intent, or another approved plan after human review.
approvedActionIdsNoRequired for migration-plan.v2: the exact action IDs approved for this application.
recoveryJournalIdNoRecovery journal id from a committed_with_repairs result or PLAN_APPLY_RECOVERY_REQUIRED error, to resume.

Output Schema

NameRequiredDescriptionDefault
dataYesSynchronous apply result, or a kibi.job.v1 receipt when async:true detached the apply into a background job (poll kb_job_status with the jobId).
errorNo
statusYes
effectsYes
operationYes
diagnosticsYes
nextActionsYes
kibiProtocolYes
resultVersionYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed14 schema fields changedv0.1.10
    • changedInput schema / properties / approvedActionIds / description
      Previous value: -"Required for migration-plan.v2. Exact action IDs explicitly approved for this application: automatic actions, or review actions with a cli invocation that Kibi executes only when approved by id (for example semantic_inventory_rederive_drop_grounding)."New value: +"Required for migration-plan.v2: the exact action IDs approved for this application."
    • changedInput schema / properties / async / description
      Previous value: -"MCP only. When true, start the apply as a background job and return a kibi.job.v1 receipt immediately instead of holding the request open; poll kb_job_status with the returned jobId for the final result. Use for large bootstrap plans (hundreds of actions) that can outlast a client's request timeout. The MCP server registers kb_job_status only when KIBI_MCP_OPTIONAL_TOOLS includes it; otherwise async applies synchronously. A synchronous apply sends notifications/progress after each bootstrap action when the request carries a progressToken. The CLI ignores this field."New value: +"MCP only: when true, run as a background job and return a kibi.job.v1 receipt to poll with kb_job_status."
    • changedInput schema / properties / plan / description
      Previous value: -"The complete kibi.bootstrap-plan.v1, kibi.compile-plan.v1, kibi.migration-plan.v2, or hash-bound kibi.entity-deletion-plan.v1 object. Migration plans require approvedActionIds and reject blocked actions and review actions Kibi cannot execute."New value: +"The complete bootstrap, compile, migration or hash-bound entity-deletion plan object to apply."
    • changedInput schema / properties / recoveryJournalId / description
      Previous value: -"Typed recovery journal identifier returned by a committed_with_repairs result or a PLAN_APPLY_RECOVERY_REQUIRED error. Recovery replays only the immutable journal and never the original plan request; a compile-plan journal (plan-apply-*) is completed or rolled back deterministically and reports which. A bootstrap journal left `applying` by a process that died mid-action is resumed without edits: the interrupted action is re-applied and a source lock held by the dead process is reclaimed and recorded in the journal."New value: +"Recovery journal id from a committed_with_repairs result or PLAN_APPLY_RECOVERY_REQUIRED error, to resume."
    • changedInput schema / properties / workspaceRoot / description
      Previous value: -"Optional absolute path of the workspace this call is about when it differs from the one the server started in, for example the git worktree you are working in. The server answers from that workspace's knowledge base when it is a worktree of the same repository or lies under the client's MCP roots; otherwise it answers from its own workspace and adds a workspace_mismatch diagnostic. Host hooks fill this in automatically where available."New value: +"Optional absolute path of the workspace this call is about, such as your git worktree, when it is not the server's."
    • removedOutput schema / properties / diagnostics / items / properties / severity / anyOf
      Removed value: -[
      -  {
      -    "const": "info",
      -    "type": "string"
      -  },
      -  {
      -    "const": "warning",
      -    "type": "string"
      -  },
      -  {
      -    "const": "error",
      -    "type": "string"
      -  }
      -]
    • addedOutput schema / properties / diagnostics / items / properties / severity / enum
      Added value: +[
      +  "info",
      +  "warning",
      +  "error"
      +]
    • addedOutput schema / properties / diagnostics / items / properties / severity / type
      Added value: +"string"
    • removedOutput schema / properties / effects / items / properties / status / anyOf
      Removed value: -[
      -  {
      -    "const": "completed",
      -    "type": "string"
      -  },
      -  {
      -    "const": "failed",
      -    "type": "string"
      -  },
      -  {
      -    "const": "not_applicable",
      -    "type": "string"
      -  }
      -]
    • addedOutput schema / properties / effects / items / properties / status / enum
      Added value: +[
      +  "completed",
      +  "failed",
      +  "not_applicable"
      +]
    • addedOutput schema / properties / effects / items / properties / status / type
      Added value: +"string"
    • removedOutput schema / properties / status / anyOf
      Removed value: -[
      -  {
      -    "const": "success",
      -    "type": "string"
      -  },
      -  {
      -    "const": "committed_with_repairs",
      -    "type": "string"
      -  },
      -  {
      -    "const": "error",
      -    "type": "string"
      -  }
      -]
    • addedOutput schema / properties / status / enum
      Added value: +[
      +  "success",
      +  "committed_with_repairs",
      +  "error"
      +]
    • addedOutput schema / properties / status / type
      Added value: +"string"
  2. First observedv0.1.0

TDQS

A4.6/5.0
Behavior5/5

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

Well beyond the annotations (destructive, non-idempotent, closed-world), the description discloses the transaction model: a durable journal records source writes and store mutations before the first write, compile steps commit in one store transaction, and an interrupted application is completed or rolled back by the next mutating call. Bootstrap ordering (dependency-ordered, source-first, recoverable from a typed journal) is also spelled out.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Three dense sentences, front-loaded with the action and accepted plan types, then prerequisites, then transactional semantics. No filler and no repetition of schema content.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With annotations, a full output schema, and 100% parameter coverage, the description supplies the missing behavioral layer (atomicity, journaling, recovery). Only minor gaps remain, such as the migration-specific approvedActionIds requirement being left implicit in the description.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% and already documents each parameter, so the description only needs to add meaning. It does so by tying approvedPlanHash to canonical hash revalidation and by naming the four accepted plan types; the migration-only approvedActionIds requirement is left entirely to the schema.

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?

Specific verb ('Apply') plus a precisely enumerated resource: an explicitly approved plan of types kibi.bootstrap-plan.v1, kibi.compile-plan.v1, kibi.migration-plan.v2, or entity-deletion. The 'apply an approved plan' framing cleanly separates it from the planning siblings (kb_plan_bootstrap, kb_compile_intent) that produce those plans.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Clear preconditions are stated: the plan must be explicitly approved and its canonical hash revalidated against live snapshots, and recoveryJournalId is described for resuming after a committed_with_repairs result or recovery-required error. It stops short of explicitly naming the sibling tools that generate the plan or of stating when not to call it.

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