跳转到主要内容

工具参考

本页列出 coding_tools_mcp.server 当前实现的工具。实际可见工具由 --tool-profile 决定。

Profiles

Profile暴露工具
full暴露全部实现工具。
read-only只暴露检查类工具,隐藏补丁、命令、cwd 修改和权限请求等工具。
compat-readonly-all兼容模式:把暴露工具注解为只读,但部分工具仍可能改变本地状态。

服务和工作区工具

工具用途关键输入
server_info返回服务元数据、协议信息、当前 profile 和能力信息。
check_exec_environment报告命令执行环境和隔离状态。
get_default_cwd返回运行时默认工作目录。
set_default_cwd修改后续相对命令操作使用的默认工作目录。path
set_default_cwd 不会在 read-only profile 中暴露。

文件和搜索工具

工具用途关键输入
read_file从工作区文件读取 UTF-8 文本。pathstart_lineend_linemax_bytesencoding
list_dir列出目录项,可递归。pathrecursivemax_depthmax_entriesinclude_hiddeninclude_ignoredsort
list_files按 glob 风格模式查找文件。pathpatternsglobexclude_patternsinclude_hiddeninclude_ignoredmax_resultssort
search_text用字面量或正则搜索文本。querypathregexcase_sensitiveinclude_globsexclude_globscontext_linesmax_results
注意:
  • read_file 只支持 utf-8,会拒绝看起来像二进制的文件。
  • read_file.max_bytes 上限为 1 MiB。
  • search_text 优先使用 rg,不可用时回退到 Python 扫描。
  • 默认忽略 .gitnode_modules、构建产物、虚拟环境和常见缓存目录。

编辑工具

工具用途关键输入
apply_patch在工作区内应用 unified patch。patchdry_run
apply_patchread-only 中隐藏。可以先用 dry_run 验证补丁。

命令工具

工具用途关键输入
exec_command在工作区中启动或运行命令。cmdworkdirtimeout_msyield_time_msmax_output_bytesstdinttyenv
write_stdin向运行中的命令 session 写入输入或轮询输出。session_idcharsyield_time_msmax_output_bytes
kill_session终止运行中的命令 session。session_idsignalwait_msmax_output_bytes
命令行为受权限模式影响。safe 会阻止网络特征命令、shell 展开、内联脚本、敏感环境和宽泛临时目录写入。trusted 允许常见本地开发流程,同时保留敏感环境过滤和可用时的 Landlock。dangerous 会关闭命令权限门禁。

Git 工具

工具用途关键输入
git_status返回仓库状态。pathinclude_untrackedmax_entries
git_diff返回 staged 或 unstaged diff。pathpathsstagedunstagedcontext_linesmax_bytes
git_log返回最近提交。pathrefmax_countskip
git_show查看某个 revision,可包含 diff。revpathpathsinclude_diffcontext_linesmax_bytes
git_blame返回指定行范围的 blame 信息。pathrevstart_lineend_linemax_lines
这些是 Git 查看工具,不会 commit、checkout、reset、push 或修改仓库状态。

权限工具

工具用途关键输入
request_permissions为受限操作请求权限。tool_namepermissionreasonargumentsscopettl_seconds
tool_name 可取 exec_commandapply_patch。权限名包括 networkdestructive_commandlong_timeoutsensitive_envshell_expansioninline_scriptprivileged_executablewrite_generated_or_ignored

图片工具

工具用途关键输入
view_image读取本地图片,并返回 MCP image payload 或 data URL。pathmax_bytesmax_widthmax_heightauto_resizeoutput
view_image 默认启用,除非设置 CODING_TOOLS_MCP_ENABLE_VIEW_IMAGE=0 或外层包装禁用该能力。输入文件必须位于工作区路径边界内。