文档

工具参考

所有 58 个 LeanCTX MCP 工具的完整参考,按类别组织。

LeanCTX 提供 58 个 MCP 工具,分为四个类别。每个工具由 AI 自动使用--您无需学习或输入任何命令。

核心工具--文件与代码

基础工具。处理文件读取、目录浏览、命令执行和代码搜索--占 AI 编程交互 90% 的操作。

工具功能描述节省
ctx_read智能文件读取,支持 10 read modes + 会话缓存up to 99%
ctx_multi_read单次调用批量读取文件减少往返次数
ctx_tree紧凑的项目结构图34-60%
ctx_shell支持 95+ 种模式压缩的 Shell 命令。使用 raw=true 获取未压缩输出。
ctx_search紧凑结果的正则表达式代码搜索50-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

查看完整核心工具文档 →


智能引擎

超越压缩的工具--它们理解您的工作流,检测意图,去除重复上下文,并智能管理 token 预算。

工具功能描述
ctx_fill基于优先级的上下文填充,带 token 预算
ctx_intent语义意图检测 + 自动文件加载
ctx_context多轮上下文状态概览
ctx_graph持久化项目依赖图(构建、关联、符号、影响)
ctx_dedup跨文件去重分析
ctx_response双向响应压缩
ctx_discoverShell 历史分析,发现未利用的压缩机会
ctx_preload主动上下文加载器 - 在会话开始时缓存任务相关文件
ctx_semantic_search混合语义搜索(BM25 + 向量嵌入)- 即使没有关键词重叠也能按含义找到代码
ctx_overviewProject overview with structure, entry points, and key files
ctx_prefetchPre-load files based on task context and changed files
ctx_graph_diagram依赖图或调用图的 Mermaid 图表
ctx_compress_memory压缩记忆/配置 Markdown(保留代码/URL)+ .original 备份
ctx_impactImpact analysis: trace dependency chains and build graphs
ctx_architectureGraph-based architecture analysis: clusters, layers, cycles
ctx_analyzeEntropy analysis - recommends optimal compression mode

查看完整智能引擎文档 →


会话与监控

会话持久化、性能监控、压缩分析和基准测试--衡量和优化 token 节省所需的一切。

工具功能描述
ctx_session跨对话的会话记忆(任务、发现、决策)
ctx_compress紧凑的上下文检查点,用于继续对话
ctx_benchmark按模式的实际 token 计数--单文件或全项目
ctx_metrics带美元成本估算的会话统计
ctx_wrapped节省报告卡(每周/每月/累计)
ctx_cache显式缓存管理(状态、清除、失效)
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

查看完整会话与监控文档 →


记忆与多代理

跨会话记忆、多代理协调和任务感知项目定向。v2.7.0 新增。

工具功能描述
ctx_knowledge持久化项目知识库--跨会话记忆事实
ctx_agent多代理协调 - 注册、发布、任务交接、状态同步
ctx_share多代理上下文共享 - 在代理之间推送/拉取缓存文件内容
ctx_taskTask delegation and tracking across agents
ctx_costCost attribution - track token spend per agent and tool
ctx_context多轮上下文状态概览

查看完整记忆与多代理文档 →


Workflow & Orchestration

State machines, context handoff, sandboxed code execution, and quality feedback loops.

工具功能描述
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.

工具功能描述
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)
ctx_smellsDetect code smells and anti-patterns

View Analysis & Navigation docs →