Skip to content

Commit 0acfb06

Browse files
owtaylorclaude
andauthored
docs: auto-generate tool documentation from MCP server metadata (#394)
Add a script that introspects the server's registered tools at runtime and generates per-category markdown pages under docs/tools/, ensuring documentation exactly matches the JSON schema advertised by the server. - Add scripts/generate_tool_docs.py to generate docs from tool metadata - Generate one page per category (system-info, services, logs, etc.) - Include parameter details with types, defaults, and constraints - Include structured return types with nested field expansion - Filter out internal tools (hidden_from_model) and the host parameter - Replace hand-written docs/tools.md placeholder with generated pages - Add docs/tools/ to .gitignore (generated at build time, not committed) - Document the generation step in contributing.md Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent b9473ed commit 0acfb06

6 files changed

Lines changed: 445 additions & 61 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ htmlcov/
3939

4040
# Documentation build
4141
site/
42+
docs/tools/
4243

4344
# IDEs
4445
.vscode/

AGENTS.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,6 @@ Types: `feat`, `fix`, `docs`, `test`, `refactor`, `perf`, `chore`
5151

5252
## Docs
5353

54-
Full details: `docs/contributing.md` | Architecture: `docs/architecture.md` | API: `docs/api/`
54+
Full details: `docs/contributing.md` | Architecture: `docs/architecture.md`
55+
56+
Tool docs under `docs/tools/` are auto-generated — run `uv run python scripts/generate_tool_docs.py` after adding or modifying tools.

docs/contributing.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,26 @@ Coverage reports are generated in `coverage/htmlcov/index.html`.
238238

239239
---
240240

241+
## Building Documentation
242+
243+
The [Tools](tools/system-information.md) pages are auto-generated from the server's runtime tool
244+
metadata. You must run the generation script before building the docs:
245+
246+
```bash
247+
# Generate tool documentation, then build the site
248+
uv run python scripts/generate_tool_docs.py
249+
uv run mkdocs build --strict
250+
251+
# Or for local preview
252+
uv run python scripts/generate_tool_docs.py
253+
uv run mkdocs serve
254+
```
255+
256+
The generated files live in `docs/tools/` (gitignored). If you add or
257+
modify a tool, re-run the generation script to update the docs.
258+
259+
---
260+
241261
## Security Guidelines
242262

243263
### Read-Only Operations Only

docs/tools.md

Lines changed: 0 additions & 59 deletions
This file was deleted.

mkdocs.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,14 @@ nav:
6666
- Security Best Practices: security.md
6767
- Architecture: architecture.md
6868
- Debug Logging: debugging.md
69-
- Tools: tools.md
69+
- Tools:
70+
- System Information: tools/system-information.md
71+
- Services: tools/services.md
72+
- Processes: tools/processes.md
73+
- Logs: tools/logs.md
74+
- Network: tools/network.md
75+
- Storage: tools/storage.md
76+
- Script Execution: tools/script-execution.md
7077
- Contributing: contributing.md
7178

7279
extra:

0 commit comments

Comments
 (0)