Description
When MCP tools are added, removed, or renamed, automatically sync all related documentation. Ensure the tool counts and lists in instructions, skills, and README always match the code.
Trigger Conditions
In the following situationsmusttrigger this Skill:
- Added a
register_*_tools()function or a@mcp.tool()decorator - Modified
tool_registry.py'sTOOL_CATEGORIES - Modified
tools/__init__.py'sregister_all_tools() - Deleted or renamed any MCP tool
- User explicitly requests "sync tools" / "tool sync"
Automatically synced documentation (6 total)
| # | Document | Updated Content | Update Method |
|---|---|---|---|
| 1 | presentation/mcp_server/tool_registry.py |
TOOL_CATEGORIES dict |
Manual — add/remove tool categories |
| 2 | presentation/mcp_server/tools/__init__.py |
register_all_tools() |
Manual — import + call the register function |
| 3 | presentation/mcp_server/instructions.py |
SERVER_INSTRUCTIONS tool list | 🤖 --update-docs Auto |
| 4 | .github/copilot-instructions.md |
Tool Categories table | 🤖 --update-docs Auto |
| 5 | .claude/skills/pubmed-mcp-tools-reference/SKILL.md |
Full tool reference | 🤖 --update-docs Auto |
| 6 | README.md + README.zh-TW.md |
Tool count badge | 🤖 --update-docs Auto |
Execution Flow
Step 1: Manual modification (handled by AI Agent)
Ensure the following two "source" files are correct:
# 1. tool_registry.py — 新增分類
TOOL_CATEGORIES = {
...
"new_category": {
"name": "新分類名稱",
"description": "分類描述",
"tools": ["tool_name_1", "tool_name_2"],
},
}
# 2. tools/__init__.py — 註冊函數
from .new_module import register_new_tools
def register_all_tools(mcp, searcher):
...
register_new_tools(mcp) # 新增呼叫
Step 2: Run the auto-sync script
uv run python scripts/count_mcp_tools.py --update-docs
Step 3: Verify
# 檢查工具數量是否正確
uv run python scripts/count_mcp_tools.py
# 檢查驗證是否通過(TOOL_CATEGORIES 與 FastMCP runtime 同步)
uv run python scripts/count_mcp_tools.py --verbose
Step 4: Report results
🔄 MCP 工具同步完成
📊 統計:
- 工具總數: XX → YY (+N)
- 分類數: XX → YY (+N)
- 更新文件: N 個
📝 已更新:
✅ tool_registry.py - 新增 "image_search" 分類
✅ tools/__init__.py - 新增 register_image_search_tools
✅ instructions.py - 工具列表已同步
✅ copilot-instructions.md - Tool Categories 已同步
✅ SKILL.md (tools-reference) - 已重新生成
✅ README.md - 工具數量已更新
✅ README.zh-TW.md - 工具數量已更新
⚠️ 驗證: PASSED ✅
Important Rules
🔴 Must comply
- Must be run after any tool change
count_mcp_tools.py --update-docs - Modify the source first(tool_registry.py + tools/init.py), then run the script
- Verification must pass —
TOOL_CATEGORIESmust stay in sync with the FastMCP runtime
⚠️ Notes
count_mcp_tools.pywill automatically detectTOOL_CATEGORIESall categories in (dynamically obtained, no longer hardcoded)instructions.pyOnly updates the tool list block; handwritten content such as search strategies will not be overwrittenpubmed-mcp-tools-referenceSKILL will be fully regenerated- CHANGELOG updates are handled separately by the
changelog-updaterskill
Relationship with Other Skills
- git-precommit: calls this Skill's sync step before commit
- git-doc-updater: also triggers a tool sync check when documentation is updated
- ddd-architect: reminds to run tool sync when adding new feature modules