Source of truth: rust/src/server/registry.rs and the tool definitions it registers.
lean-ctx registers 76 MCP tools (granular profile). Each entry below lists the tool name, what it does, and its parameters (* marks required).
Multi-agent coordination: shared message bus, persistent diaries, stigmergic scent field. Actions: register (agent_type+role), post (message+category), read (poll), status (active|idle|finished), handoff (transfer task+summary), sync (agents + messages + scent: claims/stuck/hot), claim/release (atomic file/task claim, message=target), brief (sub-agent briefing pack: message=task, priority=budget), return (distill sub-agent report into knowledge: message='category/key: value' lines), diary (log discovery/decision/blocker/progress/insight), recall_diary, diaries, list, info.
Parameters: action*, agent_type, category, message, role, status, to_agent
Entropy analysis — recommends optimal compression mode for a file.
Parameters: path*
Graph-based architecture analysis. Actions: overview|clusters|communities|layers|cycles|entrypoints|hotspots|health|module.
Parameters: action, format, path, root
Context artifact registry + BM25 index. Actions: list|status|index|reindex|search|remove.
Parameters: action*, format, name, project_root, query, top_k
Benchmark compression modes for a file or project.
Parameters: action, format, path*
Cache ops: status|clear|invalidate.
Parameters: action*, path
Invoke any non-core lean-ctx tool by name. arch: ctx_architecture, ctx_impact, ctx_callgraph, ctx_refactor, ctx_symbol, ctx_routes, ctx_smells debug: ctx_benchmark, ctx_verify, ctx_analyze, ctx_profile, ctx_review memory: ctx_semantic_search, ctx_artifacts batch: ctx_fill, ctx_execute, ctx_pack, ctx_plan, ctx_compile agent: ctx_agent, ctx_share, ctx_task, ctx_handoff, ctx_workflow util: ctx_compress, ctx_cache, ctx_metrics, ctx_dedup, ctx_cost, ctx_heatmap, ctx_preload Discover more: name=ctx_discover_tools, arguments={query}.
Parameters: arguments, name*
Call graph query: callers/callees (multi-hop BFS), trace path between symbols, risk classification by caller count.
Parameters: action, depth, direction, file, from, symbol, to
Local shadow git history of the agent's changes (separate from the user's .git). actions: snapshot (record current state) | log (list checkpoints) | diff (vs a checkpoint) | restore (revert files). Snapshot before+after a change to capture exactly what the LLM modified; diff/restore to review or roll back. Never touches the user's repository.
Parameters: action, from, limit, message, path, ref, to
Context compilation (CFT). Builds minimal context package via greedy knapsack + Boltzmann view selection. Modes: handles|compressed|full.
Parameters: budget, mode
Task composer: one call returns keywords + semantically ranked files + exact match locations + the top symbol's body inline. Replaces the search→read→outline→read chain.
Parameters: path, task*
Context checkpoint for long conversations.
Parameters: include_signatures
Compress a memory/config file (CLAUDE.md, .cursorrules) preserving code, URLs, paths. Creates .original.md backup.
Parameters: path*
Session context overview — cached files, seen files, session state.
Parameters: none
Universal context manipulation (Context Field Theory). Actions: exclude|include|pin|unpin|set_view|set_priority|mark_outdated|reset|list|history. Overlay-based, reversible, scoped.
Parameters: action*, reason, scope, target, value
Cost attribution (local-first). Actions: report|agent|tools|json|reset.
Parameters: action, agent_id, limit
Cross-file dedup: analyze or apply shared block references.
Parameters: action
Incremental diff — sends only changed lines since last read.
Parameters: path*
Find missed compression opportunities in shell history.
Parameters: limit
Search available lean-ctx tools by keyword. Returns matching tool names and descriptions.
Parameters: query
Edit a file via search-and-replace. Use when the IDE's Edit tool requires Read but Read is unavailable.
Parameters: create, new_string, old_string, path, replace_all
Run code in sandbox (11 languages). Only stdout enters context. Raw data never leaves subprocess. Languages: javascript, typescript, python, shell, ruby, go, rust, php, perl, r, elixir.
Parameters: action, code, intent, items, language, path, timeout
Retrieve archived/firewalled tool output (zero-loss). Use the ID from an [Archived:/Firewalled: ...] hint.
Parameters: action, end_line, head, id, json_keys, json_path, query, search, session_id, start_line, tail
Harness feedback for LLM output tokens/latency (local-first). Actions: record|report|json|reset|status.
Parameters: action, agent_id, intent, latency_ms, limit, llm_input_tokens, llm_output_tokens, model, note
Budget-aware context fill — auto-selects compression per file within token limit.
Parameters: budget, paths, task
Gain report (includes Wrapped via action=wrapped).
Parameters: action, limit, model, period
Read a remote git repository via a cached shallow clone (not HTML scraping). modes: overview (tree + README) | tree (file list) | read (a file) | grep (search). Accepts repo URLs and GitHub/GitLab blob/tree links (ref + path auto-detected). https-only, SSRF-guarded, bounded. Use instead of ctx_url_read when you need a whole repo's files/structure.
Parameters: max_tokens, mode, path, query, ref, timeout_secs, url*
Find files by glob pattern. Prefer over native Glob for consistency.
Respects .gitignore; supports multi-root via paths array.
Parameters: ignore_gitignore, max_results, path, paths, pattern*
Code graph: dependencies, symbol usages, impact/blast radius, Mermaid diagrams, git-diff impact.
Parameters: action*, depth, format, kind, path, project_root, since, to
Context Ledger Protocol (hashed, deterministic, local-first). Actions: create|show|list|pull|clear|export|import.
Parameters: action, apply_knowledge, apply_session, apply_workflow, filename, format, path, paths, privacy, write
File access heatmap — shows most frequently accessed files.
Parameters: action, path
Graph-based impact analysis. Actions: analyze|diff|chain|build|update|status.
Parameters: action, depth, format, path, root
Index orchestration. Actions: status|build|build-full.
Parameters: action*, project_root
Structured intent input (optional) — submit compact JSON or short text; server also infers intents automatically from tool calls.
Parameters: project_root, query*
Persistent project knowledge across sessions (facts, patterns, gotchas, typed relations).
Parameters: action*, as_of, category, confidence, examples, key, mode, pattern_type, query, resolution, severity, trigger, value
Context ledger ops: status|reset|evict. Manages persistent context pressure.
Parameters: action*, targets
Load/unload specialized tool categories on demand. Categories: arch, debug, memory, metrics, session. Core is always loaded.
Parameters: action*, category
Session token stats, cache rates, per-tool savings.
Parameters: none
Batch read files in one call. Same modes as ctx_read.
Parameters: fresh, mode, paths*
Multi-repo management: add/remove roots, cross-repo search with Reciprocal Rank Fusion (RRF). Enables searching across multiple project directories simultaneously.
Parameters: action*, alias, max_results, path, query, roots
List all symbols in a file (functions, structs, classes, methods) with signatures. Much fewer tokens than reading the full file.
Parameters: kind, path*
Task-relevant project map — use at session start.
Parameters: path, task
Context Package Manager. Actions: pr (PR context), create (build package from project), list, info, remove, install, export, import, auto_load, summary.
Parameters: action*, apply, author, base, depth, description, diff, enable, file, format, layers, level, name, project_root, scope, tags, version
Save or resume portable context packages — self-contained JSON bundles with session state, summaries, and knowledge. Use to hand off context between agents, persist session snapshots for later, or onboard a new agent into a previous session's context. Actions: save (export current session), resume (import from a package file), list (show saved packages), info (inspect a package without importing).
Parameters: action, description, path
Context planning (CFT). Computes optimal context plan with Phi scoring, budget allocation, and policy-driven view selection.
Parameters: budget, profile, task*
Plugin management. Actions: list (show installed plugins), enable (activate a plugin), disable (deactivate a plugin), info (show plugin details), hooks (list available hook points).
Parameters: action*, name
Predictive prefetch — prewarm cache for blast radius files (graph + task signals) within budgets.
Parameters: budget_tokens, changed_files, max_files, root, task
Proactive context loader — caches task-relevant files, returns L-curve-optimized summary (~50-100 tokens vs ~5000 for individual reads).
Parameters: path, task*
Export a machine-readable ContextProofV1 (Verifier + SLO + Pipeline + Provenance). Writes to .lean-ctx/proofs/ by default.
Parameters: action*, filename, format, max_evidence, max_ledger_files, project_root, write
External context providers (GitHub, GitLab, Jira, Postgres, MCP, custom REST).
Parameters: action*, iid, labels, limit, mode, provider, resource, state, status
Full context budget breakdown: system prompt, messages, tools, reads, shell — all tracked token usage.
Parameters: format
Read a file. Prefer over native Read/cat/head/tail (cached, compressed). Unchanged re-reads cost ~13 tokens. Auto-selects mode. fresh=true forces a disk re-read.
Parameters: fresh, mode, path*, start_line
LSP/IDE refactoring. action=one pipe-delimited value below. Reads (references/definition/implementations/declaration/type_hierarchy/symbols_overview/inspections) need a language server or the JetBrains backend. Symbol edits (replace/insert_before/insert_after_symbol) are name_path-addressed, IDE-first with a lossless headless fallback. Two-Phase ops (rename/move/safe_delete/inline _preview+_apply) need a JetBrains IDE (else BACKEND_REQUIRED) with a stateless plan_hash TOCTOU guard. rename/move/safe_delete block conflicts unless force=true; inline cannot be forced (→ UNSUPPORTED). reformat is Single-Phase, by name_path | path | path+line.
Parameters: action*, column, direction, end_line, expected_hash, force, keep_definition, line, mode, name_path, new_body, new_name, optimize_imports, path, plan_hash, propagate, scope, search_comments, search_text_occurrences, target_parent, target_path, text
PageRank-based repo map showing the most important symbols across the codebase, ranked by structural importance and session relevance.
Parameters: focus_files, max_tokens, path
Compress LLM response text (structural de-duplication).
Parameters: text*
Retrieve original uncompressed content from the session cache (CCR). Use when a compressed ctx_read output is insufficient.
Parameters: path*, query
Automated code review: combines impact analysis, caller tracking, and test discovery. Actions: review (single file), diff-review (from git diff), checklist (structured review questions).
Parameters: action*, depth, path
List HTTP routes/endpoints extracted from the project. Supports Express, Flask, FastAPI, Actix, Spring, Rails, Next.js.
Parameters: method, path
Cross-agent rules governance (ContextOps). Actions: sync (distribute rules to agents), diff (show drift), lint (check consistency), status (show sync state), init (create central config).
Parameters: action*, agent
Regex code search. Prefer over native Grep/rg/find (compact, .gitignore-aware).
Parameters: ext, ignore_gitignore, include, max_results, path, paths, pattern*
Semantic code search (BM25 + embeddings/hybrid + reranking). action=reindex|find_related.
Parameters: action, file_path, languages, line, mode, path, path_glob, query*, top_k
Cross-session memory: record task/finding/decision, restore previous session state.
Parameters: action*, session_id, value
Share cached file contexts between agents. Actions: push (share files from your cache to another agent), pull (receive files shared by other agents), list (show all shared contexts), clear (remove your shared contexts).
Parameters: action*, message, paths, to_agent
Run a shell command. Prefer over native Shell/Bash (compressed output). cwd persists across calls.
Parameters: command*, cwd, env, raw
Codify recurring patterns from this project's session diary + knowledge into versioned, git-committable .cursor/rules/skillify-*.mdc files. Actions: mine (distill & write/merge rules), list (show generated rules), status (config + counts), promote (copy a project rule to ~/.cursor/rules). Precision-biased; only acts when invoked; re-runs are idempotent.
Parameters: action, slug
Auto-select optimal read mode for a file.
Parameters: path*
Code smell detection. Actions: scan|summary|rules|file.
Parameters: action, format, path, root, rule
Record and recall AI session summaries — compact, semantically-recallable digests of what was done (task, files, decisions, next steps). Actions: recall (find past summaries by query; semantic when embeddings are warm, else lexical), record (snapshot the current session now), list (recent summaries). Summaries are also captured automatically on the checkpoint cadence.
Parameters: action, query, top_k
Read a specific symbol (function, struct, class) by name. Returns only the symbol code block instead of the entire file. 90-97% fewer tokens than full file read.
Parameters: file, kind, name*
Multi-agent task orchestration. Actions: create|update|list|get|cancel|message|info.
Parameters: action*, description, message, state, task_id, to_agent
Gateway to downstream MCP servers — unlimited external tools at ~constant context cost.
actions: find (query → top-N relevant tools as ChoiceCards) | call (proxy a server::tool) | list (servers+counts) | refresh.
Use find to discover, then call the chosen server::tool. Off by default ([gateway] config).
Parameters: action, arguments, query, tool
List a directory. Prefer over native ls/find (counts, compact tree).
Parameters: depth, path, paths, respect_gitignore, show_hidden
Fetch a web page, PDF, RSS/Atom feed, or YouTube URL as compressed, cited context. HTML→clean Markdown (tables→GFM), PDF→text, feeds→dated item list, YouTube→transcript; modes: auto|markdown|text|links|facts|quotes|transcript. GitHub blob/raw page URLs auto-resolve to the raw file. facts/quotes return claims with confidence + source. SSRF-guarded (http/https only, blocks private/loopback). Use for research/crawl instead of raw fetch.
Parameters: max_items, max_tokens, mode, query, timeout_secs, url*
Verification observability. Actions: stats (tool call statistics), proof|v2 (ContextProofV2 claim-based verification with Lean4 proofs).
Parameters: action, format
Workflow rails (state machine + evidence). Actions: start|status|transition|complete|evidence_add|evidence_list|stop.
Parameters: action, key, name, spec, to, value
Execute a shell command. Returns token-optimized compressed output (95+ patterns for git, npm, cargo, docker, tsc, etc). Equivalent to running the command in a terminal but with automatic output compression for efficiency.
Parameters: command*, cwd