Documentation

Tool Reference

Complete reference for all 61 LeanCTX context layer tools, organized by category.

LeanCTX provides 61 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.

ToolWhat it doesSavings
ctx_readSmart file read with 10 read modes + session cachingup to 99%
ctx_multi_readBatch file reads in one callfewer round-trips
ctx_treeCompact project structure maps34-60%
ctx_shellShell commands with 60+ pattern compression. Use raw=true for uncompressed output.
ctx_searchRegex code search with compact results50-80%
ctx_editContext-aware file editor with create, replace, and replace_all-
ctx_deltaShow only changed lines since last read80-95%
ctx_smart_readIntelligent single-call read with auto-modevaries

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.

ToolWhat it does
ctx_fillPriority-based context filling with a token budget
ctx_intentSemantic intent detection + auto file loading
ctx_contextMulti-turn context state overview
ctx_graphPersistent project dependency graph (build, related, symbol, impact)
ctx_dedupCross-file deduplication analysis
ctx_responseBi-directional response compression
ctx_discoverShell history analysis for missed compression opportunities
ctx_preloadProactive context loader - caches task-relevant files at session start
ctx_semantic_searchHybrid semantic search (BM25 + embeddings) - find code by meaning, even without keyword overlap
ctx_overviewProject overview with structure, entry points, and key files
ctx_prefetchPre-load files based on task context and changed files
ctx_graph_diagramMermaid diagrams for dependency graph or call graph
ctx_compress_memoryCompress memory/config markdown (preserve code/URLs) + create .original backup
ctx_impactImpact analysis: trace dependency chains and build graphs
ctx_architectureGraph-based architecture analysis: clusters, layers, cycles
ctx_analyzeEntropy 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.

ToolWhat it does
ctx_sessionCross-chat session memory (task, findings, decisions)
ctx_compressCompact context checkpoint for chat continuation
ctx_benchmarkReal token counts per mode - single file or project-wide
ctx_metricsSession statistics with USD cost estimates
ctx_wrappedSavings report card (weekly / monthly / all-time)
ctx_cacheExplicit cache management (status, clear, invalidate)
ctx_gainQuery token savings, GainScore (0–100), cost breakdowns, task classifications, and per-agent statistics. Powered by the GainEngine with embedded ModelPricing.
ctx_heatmapFile 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.

ToolWhat it does
ctx_knowledgePersistent project knowledge store - remember facts across sessions
ctx_agentMulti-agent coordination - register, post, handoff tasks, sync status
ctx_shareMulti-agent context sharing - push/pull cached file contexts between agents
ctx_taskTask delegation and tracking across agents
ctx_costCost 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.

ToolWhat it does
ctx_workflowState-machine workflows with step ordering and evidence
ctx_handoffContext transfer between sessions or agents
ctx_executeSandboxed code execution in 11 languages
ctx_feedbackQuality feedback: latency, token counts, model info

View Workflow & Orchestration docs →


Analysis & Navigation

Tree-sitter-powered symbol navigation, call graphs, route extraction, and structural outlining.

ToolWhat it does
ctx_symbolFind symbol definitions across 18 languages
ctx_callersFind all call sites of a function
ctx_calleesFind all functions called by a symbol
ctx_outlineStructural outline of a file
ctx_routesExtract HTTP routes from web frameworks
ctx_smellsCode smell detection with graph-enriched scoring (long functions, deep nesting, complexity)

View Analysis & Navigation docs →