Tools
Tool Reference
Complete reference for all 72 LeanCTX context layer tools, organized by category.
LeanCTX provides 72 MCP tools organized into six categories. Each tool is used by the AI automatically - you don't need to learn or type any of these commands.
Core Tools - File & Code
The foundation. These handle file reading, directory exploration, command execution, and code search - the operations that make up 90% of AI coding interactions.
| Tool | What it does | Savings |
|---|---|---|
ctx_read | Smart file read with 10 read modes + session caching | up to 99% |
ctx_multi_read | Batch file reads in one call | fewer round-trips |
ctx_tree | Compact project structure maps | 34-60% |
ctx_shell | Shell commands with 95+ pattern compression. Use raw=true for uncompressed output. | |
ctx_search | Regex code search with compact results | 50-80% |
ctx_edit | Context-aware file editor with create, replace, and replace_all | - |
ctx_delta | Show only changed lines since last read | 80-95% |
ctx_smart_read | Intelligent single-call read with auto-mode | varies |
View full Core Tools documentation →
Intelligence Engine
Tools that go beyond compression - they understand your workflow, detect intent, deduplicate context, and intelligently manage token budgets.
| Tool | What it does |
|---|---|
ctx_fill | Priority-based context filling with a token budget |
ctx_intent | Semantic intent detection + auto file loading |
ctx_context | Multi-turn context state overview |
ctx_graph | Persistent project dependency graph (build, related, symbol, impact) |
ctx_dedup | Cross-file deduplication analysis |
ctx_response | Bi-directional response compression |
ctx_discover | Shell history analysis for missed compression opportunities |
ctx_preload | Proactive context loader - caches task-relevant files at session start |
ctx_semantic_search | Hybrid semantic search (BM25 + embeddings) - find code by meaning, even without keyword overlap |
ctx_overview | Project overview with structure, entry points, and key files |
ctx_prefetch | Pre-load files based on task context and changed files |
ctx_index | Build and refresh the code-intelligence index (symbols, graph, tree-sitter) |
ctx_compress_memory | Compress memory/config markdown (preserve code/URLs) + create .original backup |
ctx_impact | Impact analysis: trace dependency chains and build graphs |
ctx_architecture | Graph-based architecture analysis: clusters, layers, cycles |
ctx_analyze | Entropy analysis - recommends optimal compression mode |
View full Intelligence Engine documentation →
Session & Monitoring
Session persistence, performance monitoring, compression analysis, and benchmarking - everything you need to measure and optimize your token savings.
| Tool | What it does |
|---|---|
ctx_session | Cross-chat session memory (task, findings, decisions) |
ctx_compress | Compact context checkpoint for chat continuation |
ctx_benchmark | Real token counts per mode - single file or project-wide |
ctx_metrics | Session statistics with USD cost estimates |
ctx_radar | Drift radar — surface context drift and stale files over time |
ctx_cache | Explicit cache management (status, clear, invalidate) |
ctx_gain | Query token savings, GainScore (0–100), cost breakdowns, task classifications, and per-agent statistics. Powered by the GainEngine with embedded ModelPricing. |
ctx_heatmap | File access heatmap - find hot files and cold directories |
View full Session & Monitoring documentation →
Memory & Multi-Agent
Cross-session memory, multi-agent coordination, and task-aware project orientation. New in v2.7.0.
| Tool | What it does |
|---|---|
ctx_knowledge | Persistent project knowledge store - remember facts across sessions |
ctx_agent | Multi-agent coordination - register, post, handoff tasks, sync status |
ctx_share | Multi-agent context sharing - push/pull cached file contexts between agents |
ctx_task | Task delegation and tracking across agents |
ctx_cost | Cost attribution - track token spend per agent and tool |
View full Memory & Multi-Agent documentation →
Workflow & Orchestration
State machines, context handoff, sandboxed code execution, and quality feedback loops.
| Tool | What it does |
|---|---|
ctx_workflow | State-machine workflows with step ordering and evidence |
ctx_handoff | Context transfer between sessions or agents |
ctx_execute | Sandboxed code execution in 11 languages |
ctx_feedback | Quality feedback: latency, token counts, model info |
View Workflow & Orchestration docs →
Analysis & Navigation
Tree-sitter-powered symbol navigation, call graphs, route extraction, and structural outlining.
| Tool | What it does |
|---|---|
ctx_symbol | Find symbol definitions across 18 languages |
ctx_callgraph | Caller and callee graph for a function across the codebase |
ctx_outline | Structural outline of a file |
ctx_routes | Extract HTTP routes from web frameworks |
ctx_smells | Code smell detection with graph-enriched scoring (long functions, deep nesting, complexity) |