Skip to content

docs: Overhaul documentation with autodoc directives and per-tool pages#12

Open
tony wants to merge 4 commits intotui-toolingfrom
docs-overhaul-april-early-2026
Open

docs: Overhaul documentation with autodoc directives and per-tool pages#12
tony wants to merge 4 commits intotui-toolingfrom
docs-overhaul-april-early-2026

Conversation

@tony
Copy link
Copy Markdown
Member

@tony tony commented Apr 9, 2026

Summary

Builds on #11. Overhauls the documentation system:

  • Resource & model autodoc directives: Add fastmcp-resource, fastmcp-resourcesummary, fastmcp-model, fastmcp-model-fields, fastmcp-modelsummary directives plus {resource}, {resourceref}, {model}, {modelref} roles. Fix _MODEL_CLASSES staleness (PaneSnapshot and ContentChangeResult were missing).
  • Per-tool pages: Split 38 tools from 4 area pages into individual files organized by tmux hierarchy (server/, session/, window/, pane/). Grid cards on index pages serve as navigation. sphinxcontrib-rediraffe redirects for old paths.
  • Sidebar badge fix: Monkeypatch SphinxContentsFilter to raise SkipNode for badge nodes — same pattern Sphinx uses for visit_image. Badges render in headings but are stripped from toctree/sidebar. CSS removes code.literal background in sidebar.

New directives & roles

Type Count Items
Directives +5 fastmcp-resource, fastmcp-resourcesummary, fastmcp-model, fastmcp-model-fields, fastmcp-modelsummary
Roles +4 {resource}, {resourceref}, {model}, {modelref}
Custom nodes +4 resource badge, model badge, resource ref, model ref
Tests +44 resource collection, model collection, badge nodes, roles

Page structure

docs/tools/
├── index.md          (grid cards for all 38 tools)
├── server/index.md   (8 tools)
├── session/index.md  (5 tools)
├── window/index.md   (7 tools)
└── pane/index.md     (18 tools)

Test plan

  • uv run ruff check . --fix --show-fixes passes
  • uv run ruff format . — no changes
  • uv run mypy — no issues
  • uv run py.test --reruns 0 -vvv — 251 tests pass
  • just build-docs — builds clean
  • Sidebar verified via Playwright: no badges, no emoji leakage, no code background

tony added 4 commits April 8, 2026 18:04
Fix _MODEL_CLASSES staleness — replace hardcoded 10-model set with
dynamic discovery via _discover_model_classes() using Pydantic
introspection + __module__ filtering. PaneSnapshot and
ContentChangeResult now get correct cross-references.

Add 5 new directives: fastmcp-resource, fastmcp-resourcesummary,
fastmcp-model, fastmcp-model-fields, fastmcp-modelsummary.
Add 4 new roles: {resource}, {resourceref}, {model}, {modelref}.
Add 4 new custom nodes with blue (resource) and purple (model) badges.

Resource collection uses _ResourceCollector (mirrors _ToolCollector)
to capture URI templates, titles, and params from hierarchy.py without
executing tmux code. Model collection introspects BaseModel subclasses
via model_fields with proper default_factory handling.

Replace automodule dumps in reference/api/resources.md and models.md
with structured autodoc output. Add resource and model role demos.

Tests: 44 new tests across 3 files (251 total).
Move each of the 38 tools from 4 area pages (sessions.md, windows.md,
panes.md, options.md) into individual pages under docs/tools/.

Fix FastMCPToolSummaryDirective link generation to use anchor-only refs
instead of hardcoded area paths, making it page-layout-agnostic.

Add sphinxcontrib-rediraffe redirects for the 4 removed area pages
pointing to tools/index where the grid cards provide navigation.

Grid cards, {tool}/{toolref}/{tooliconl} roles, and all cross-references
continue working unchanged — Sphinx resolves labels globally via
StandardDomain regardless of which page contains the section.
Move tool pages from flat docs/tools/<tool>.md to hierarchy-based
subdirectories: server/, session/, window/, pane/.

- server/ (8): list-sessions, get-server-info, create-session,
  kill-server, show-option, set-option, show-environment,
  set-environment
- session/ (5): list-windows, create-window, rename-session,
  select-window, kill-session
- window/ (7): list-panes, split-window, rename-window,
  select-layout, resize-window, move-window, kill-window
- pane/ (18): all pane interaction tools

Update toctree paths to match new directory structure.
Monkeypatch SphinxContentsFilter to raise SkipNode for all badge node
types (_safety_badge_node, _resource_badge_node, _model_badge_node).
This is the same pattern Sphinx uses for visit_image in titles.

Badges stay inside nodes.title for proper heading rendering, but are
stripped during toctree text extraction so the sidebar shows clean
tool names without badge text or emoji leakage.

Add CSS to size badges at 0.5em within h1/h2 headings for medium
button appearance rather than full-scale heading text.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant