Skip to content

MCP Tools

The MCP Server exposes 7 tools. This page lists each one as tools/list returns it, the defaults the server applies, the CLI command it matches, and the shape of its result. Every example result below came from a real tools/call against a one-file Rust demo repository (src/main.rs with a deeply nested function, an unused private function and some noisy comments).

  • Every result is one content item of type text. The text is the pretty-printed JSON report described for each tool.
  • The input schema type is always object. Only codeknife_reuse has a required property (query). Defaults are not part of the schema; the tables below take them from the server code.
  • Arguments of the wrong JSON type are treated as absent, without an error. For example "top":"1" (a string) falls back to the default of 8: on a demo, codeknife_reuse returned 3 candidates with "top":"1" and 1 candidate with "top":1.
  • Tool output never depends on the global --format or --max-items flags.

These appear in several schemas. They mean the same thing everywhere.

Property Type Default Meaning
path string server root Repository root. Relative values resolve against the server root.
no_cache boolean server --no-cache Do not read or write .codeknife/ caches.
strict boolean server --strict Load strict thresholds.
changed boolean false Scope the run to files changed in git (working tree, or since since).
since string none Base git ref for changed and loosening checks.

The server reads strict, no_cache, changed and since from every call, including tools whose schema does not list them. That means strict works on codeknife_fix, codeknife_reuse, codeknife_blast and codeknife_test even though their schemas omit it.

Tool CLI equivalent Result
codeknife_check codeknife check Run report (same as check --format json)
codeknife_fix codeknife fix Fix report
codeknife_dossier codeknife dossier Dossier
codeknife_reuse codeknife reuse Reuse report
codeknife_blast codeknife blast Run report (same as blast --format json)
codeknife_test codeknife test Smart test outcome
codeknife_verify codeknife verify Verify report

Description: “Run deterministic multi-blade static analysis quality gate (arch, clones, dead, slop, sec, tests, churn, deps, docs, guard).”

Property Type Required Default Schema description
path string no server root Repository root path override (defaults to server cwd).
no_cache boolean no server flag Disable reading/writing .codeknife/ caches.
changed boolean no false Scope checks to git working-tree/since diff.
since string no none Base git ref for changed diff and loosening checks.
strict boolean no server flag Enable strict Uncle Bob / greenfield thresholds.
max_items integer no none Maximum findings to emphasize.

Runs the same static suite as codeknife check with the default --tier standard, applies codeknife.baseline, and returns the run report. There is no way to pass --deep, --tier full, --coverage or --map-out through this tool; coverage is auto-discovered.

Result (trimmed):

{
"command": "check",
"root": "/.../sloppy",
"files_scanned": 1,
"elapsed_ms": 7,
"errors": 0,
"warnings": 5,
"infos": 3,
"passed": false,
"findings": [
{
"id": "8ed604003525a8b7",
"rule": "CK_CMT_APOLOGY",
"blade": "comments",
"severity": "warning",
"location": {
"file": "src/main.rs",
"start_line": 18,
"end_line": 18,
"symbol": "messy"
},
"message": "MUST-RESHAPE: workaround/apology comment found",
"fix_hint": "Refactor the underlying function/type or encode this constraint as a type/test, then delete the comment.",
"impact_score": 65.0
},
...
],
"notes": [
"no coverage file found (running complexity-only mode); generate one with: cargo llvm-cov --lcov --output-path lcov.info",
"analyzed 1 commit(s) over the last 90 day(s)"
]
}

The report can also carry loosenings and pr_brief. A demo call with "changed":true on a repository with an uncommitted edit included pr_brief; the same call without changed did not. The field list is on Output Formats & Exit Codes.

Description: “Run deterministic zero-LLM cascading autofix engine (dry-run unless write=true).”

Property Type Required Default Schema description
path string no server root Repository root path override (defaults to server cwd).
no_cache boolean no server flag Disable reading/writing .codeknife/ caches.
write boolean no false Write edits to disk (defaults to false / dry-run).
verify boolean no false Run verify_cmd and bisect-rollback breaking patches.
verify_cmd string no none Custom shell command used for transactional rollback.
aggressive boolean no false Also inline 1-caller wrappers, inject HTTP timeouts, and prune unused package.json deps.
toolchains boolean no false Also run native ecosystem formatters/fixers when write=true.
max_passes integer no 3 Maximum cascading autofix passes (default 3).

Same options as codeknife fix. See Autofix Engine for what each fix does.

Result from a dry run (trimmed):

{
"dry_run": true,
"passes": 1,
"applied": [
{
"id": "cmt:src/main.rs",
"rule": "CK_CMT_STRIP",
"description": "Remove 3 strippable comment(s) in src/main.rs",
"safety": "safe",
"edits": [
{
"file": "src/main.rs",
"start_byte": 32,
"end_byte": 93,
"replacement": ""
},
...
]
},
...
],
"reverted": [],
"skipped_conflicts": 0,
"files_modified": [
"src/main.rs"
],
"notes": []
}

In a dry run, applied lists the patches that would be applied; nothing is written.

Description: “Synthesize grouped Root-Cause Work Orders, blast radius, arch rules, reuse peers, and budgeted source excerpts.”

Property Type Required Default Schema description
path string no server root Repository root path override (defaults to server cwd).
no_cache boolean no server flag Disable reading/writing .codeknife/ caches.
changed boolean no false Scope checks to git working-tree/since diff.
since string no none Base git ref for changed diff and loosening checks.
target string no none Optional file path, suffix, or symbol name to focus on.
strict boolean no server flag Use strict thresholds.
top integer no 8 Maximum root-cause work orders to include (default 8).
budget integer no 12000 Excerpt character budget (default 12000).

Same as codeknife dossier, without --coverage (coverage is auto-discovered). See Dossier.

Result with "top":2,"budget":400 (trimmed):

{
"mode": "repo",
"summary": {
"files_scanned": 1,
"total_findings": 8,
"errors": 0,
"warnings": 5,
"infos": 3,
"autofixable_findings": 1,
"judgment_findings": 4,
"work_order_count": 2,
"risk_level": "medium"
},
"target": null,
"work_orders": [
...
],
"excerpts": [
{
"file": "src/main.rs",
"start_line": 1,
"end_line": 11,
"content": " 1 | // SPDX-License-Identifier: MIT\n 2 | // ========= SECTION =========\n 3 | // Step 1: Added as requested\n 4 | pub fn messy(a: bool, b: bool, p1: i32, p2: i32, p3: i32, p4: i32) -> i32 {\n 5 | // increment p1\n 6 | let mut x = p1 + p2;\n 7 | if a {\n 8 | if b {\n 9 | if x > 0 {\n 10 | if p3 > 0 {\n 11 | if p4 > 0 {\n ... [truncated to --budget]\n"
}
],
"test_commands": [],
"guardrails": [
"Run `codeknife fix --write --verify` before hand-editing autofixable hygiene or dead code.",
"No suppression attributes (#[allow], @ts-ignore) or .unwrap()/panic macros in production code.",
"Do not weaken codeknife.toml or edit codeknife.baseline by hand; re-verify via `codeknife verify`."
]
}

Description: “Pre-write Reuse Oracle: search existing codebase helpers, types, and import paths before writing new code.”

Property Type Required Default Schema description
path string no server root Repository root path override (defaults to server cwd).
no_cache boolean no server flag Disable reading/writing .codeknife/ caches.
query string yes none Natural-language intent or keyword query describing needed functionality.
lang string no none Optional language filter: rust, ts, js, python, go.
snippet string no none Optional code snippet for structural overlap matching.
top integer no 8 Maximum reuse candidates to return (default 8).

lang accepts rust, rs, ts, typescript, js, javascript, py, python, go and golang. Any other value fails the call with error: unsupported language `<value>` (use rust, ts, js, python, go). A missing query fails with error: missing required string parameter `query` . See Reuse Oracle.

Result for "query":"messy flag":

{
"query": "messy flag",
"scanned_items": 2,
"candidates": [
{
"symbol": "sloppy_demo::messy",
"name": "messy",
"kind": "fn",
"visibility": "public",
"file": "src/main.rs",
"start_line": 4,
"end_line": 20,
"language": "rust",
"score": 44.15199,
"signature": "pub fn messy(a: bool, b: bool, p1: i32, p2: i32, p3: i32, p4: i32) -> i32",
"doc_summary": "SPDX-License-Identifier: MIT ========= SECTION ========= Step 1: Added as requested",
"matched_terms": [
"messy"
],
"inbound_callers": 0,
"reuse_hint": "use sloppy_demo::messy;"
}
]
}

Description: “Trace transitive caller cone, covering tests, entrypoints, and cross-language SQL/HTTP/env boundary contracts.”

Property Type Required Default Schema description
path string no server root Repository root path override (defaults to server cwd).
no_cache boolean no server flag Disable reading/writing .codeknife/ caches.
changed boolean no false Scope checks to git working-tree/since diff.
since string no none Base git ref for changed diff and loosening checks.
symbol string no none Target symbol name or qualified name to trace.

Same as codeknife blast. The baseline is applied. See Blast Radius.

Result for "symbol":"messy":

{
"command": "blast",
"root": "/.../sloppy",
"files_scanned": 1,
"elapsed_ms": 5,
"errors": 0,
"warnings": 0,
"infos": 1,
"passed": true,
"findings": [
{
"id": "1a7c44ba7984a48e",
"rule": "CK_BLAST_IMPACT",
"blade": "blast",
"severity": "info",
"location": {
"file": "src/main.rs",
"start_line": 4,
"end_line": 20,
"symbol": "sloppy_demo::messy"
},
"message": "Blast radius for `sloppy_demo::messy`: 0 upstream caller(s) across 1 file(s), 0 entrypoint(s), 0 test(s)",
"fix_hint": "Add tests covering the affected entrypoints before modifying this symbol.",
"impact_score": 35.0,
"metric_value": 1.0,
"picture": {
"kind": "bar",
"label": "blast",
"length": 1,
"most": 30
}
}
]
}

Description: “Select and optionally execute blast-scoped minimal test commands covering changed files.”

Property Type Required Default Schema description
path string no server root Repository root path override (defaults to server cwd).
no_cache boolean no server flag Disable reading/writing .codeknife/ caches.
changed boolean no false Scope checks to git working-tree/since diff.
since string no none Base git ref for changed diff and loosening checks.
dry_run boolean no true Return affected test plan and commands without executing (default true).
test_cmd string no none Explicit test command override.

Target files are the changed set when changed is true. Otherwise they are the files git reports as changed (against since when given), and if there are none, every analyzed file. See Smart Test Selection.

Result with no arguments:

{
"plan": {
"changed_files": [
"src/main.rs"
],
"targeted_tests": [],
"commands": [
"cargo check --workspace --all-targets"
],
"notes": [
"no direct test unit match; using fallback repo verify command"
]
},
"passed": true,
"failed_commands": []
}

Description: “Single-call end-to-end verification: optional deterministic autofix, strict static check, smart tests, and work orders.”

Property Type Required Default Schema description
path string no server root Repository root path override (defaults to server cwd).
no_cache boolean no server flag Disable reading/writing .codeknife/ caches.
changed boolean no false Scope checks to git working-tree/since diff.
since string no none Base git ref for changed diff and loosening checks.
strict boolean no server flag Use strict thresholds.
fix boolean no false Apply deterministic zero-LLM autofixes before verifying.
aggressive boolean no false Include aggressive fixes when fix=true.
toolchains boolean no false Run native formatters/fixers when fix=true.
skip_tests boolean no false Skip smart test execution.
test_cmd string no none Explicit test command override.

Same as codeknife verify, without --coverage. With "fix":true the fixes are written to disk. See Verify Pipeline.

Result with "skip_tests":true (trimmed):

{
"passed": false,
"elapsed_ms": 9,
"fix": null,
"check_passed": false,
"errors": 0,
"warnings": 5,
"infos": 3,
"loosenings": [],
"tests": null,
"work_orders": [
{
"id": "WO-e7740bb0",
"rank": 1,
"category": "complexity",
"title": "[complexity] CK_ARCH_DEEP_NESTING in `sloppy_demo::messy`",
"file": "src/main.rs",
...
}
],
"notes": [
"no coverage file found (running complexity-only mode); generate one with: cargo llvm-cov --lcov --output-path lcov.info",
"analyzed 1 commit(s) over the last 90 day(s)"
]
}

fix holds a fix report when "fix":true, and tests holds a smart test outcome unless tests were skipped. work_orders is empty when passed is true.

A tool that fails returns isError: true with the error text. See MCP Server for the full list.