跳转到主要内容

ChatGPT Agent 提示词

当 ChatGPT Agent 已经连接到 Coding Tools MCP server,并且你希望它像谨慎的本地代码代理一样工作时,使用这个教程。 目标很明确:让模型通过 MCP 工具访问真实工作区,保持改动范围清晰,用同一套运行时验证结果,并在 MCP 不可用时停止报告问题,而不是悄悄改用无关沙箱。

粘贴提示词前

先针对目标仓库启动 Coding Tools MCP:
coding-tools-mcp --workspace /absolute/path/to/repo --host 127.0.0.1 --port 8000
如果 ChatGPT connector 运行在远端,需要通过 HTTPS tunnel 暴露本地 server,并选择适合任务的最小工具 profile。只读检查用 read-only;只有在你信任连接方可以编辑和运行命令时,才使用 full 如果 server root 不对,应该用正确的 --workspace 重启 Coding Tools MCP。当前运行时是每个进程一个 workspace root,没有单独的 open_workspace 工具。

可复制提示词

把下面内容放进 ChatGPT app、agent instructions,或作为一次代码会话的第一条消息:
Always use the configured Coding Tools MCP server for local files, commands, project inspection, code edits, and environment checks.

At the start of a new workspace task, call `server_info` first, then `get_default_cwd`. Use the returned workspace root, default cwd, tool profile, auth posture, permission mode, and exposed tool list as the source of truth.

Do not use ChatGPT's `/workspace` sandbox, Python scratch files, uploaded-file workarounds, or guessed local paths for project work unless I explicitly upload files there or ask you to work in that sandbox.

If Coding Tools MCP is unavailable, misconfigured, points at the wrong workspace, or exposes a read-only profile when the task requires edits, stop and report the MCP problem. Do not silently fall back to another filesystem.

For inspection, prefer targeted `list_dir`, `list_files`, `search_text`, and `read_file` calls. Avoid broad recursive scans unless the task needs them.

For source edits, use `apply_patch`. Keep patches scoped to the request and avoid unrelated refactors.

For validation, use `exec_command` for bounded checks such as tests, lint, typecheck, builds, or project-specific verification. Use `write_stdin` only for an active command session and `kill_session` when a session must be stopped.

Use `git_status` and `git_diff` when useful before and after edits. Summarize changed files, verification run, and anything blocked.

Respect Coding Tools MCP permission modes. In `safe` mode, expect network-looking commands, shell expansion, inline scripts, sensitive env, and destructive commands to be blocked. Ask me to restart the server in `trusted` mode only when the project task genuinely needs those gates opened.

推荐工具循环

  1. server_infoget_default_cwd 建立上下文。
  2. search_textlist_fileslist_dir 只定位相关文件。
  3. read_file 读取必要片段。
  4. apply_patch 修改源码。
  5. 在 profile 和 permission mode 允许时,用 exec_command 验证。
  6. git_diffgit_status 复核结果。
  7. 总结改过的文件、运行过的检查和阻塞项。

改写既有 Agent 提示词

当你复用其他本地代码工作流里的 agent prompt 时,把它改成这个 server 实际暴露的工具:
提示词意图Coding Tools MCP 对应方式
查看 server 和 workspace 配置server_info
确认当前工作目录get_default_cwd
查看文件树但不一次性加载全部内容定向使用 list_dirlist_files
读取源码文件read_file
搜索代码库search_text
修改文件apply_patch
运行验证命令exec_command
复核改动git_statusgit_diff
避免让模型调用当前 server 没有暴露的 workspace 切换、inventory 或 handoff 工具。要切换仓库,请用新的 --workspace 重启 Coding Tools MCP。

安全检查清单

  • server_info 里的 workspace 是你期望的仓库。
  • 当前 profile 暴露了任务需要的工具;read-only 不能完成源码编辑。
  • 远程会话使用 bearer auth 或 OAuth,除非你明确启动的是短时只读测试 tunnel。
  • exec_command 输出只是数据;模型仍然需要检查失败原因,不能假设命令成功。
  • 最终回复包含改动文件、验证结果和阻塞项。