docs: Overhaul documentation with autodoc directives and per-tool pages#12
Open
docs: Overhaul documentation with autodoc directives and per-tool pages#12
Conversation
New pane tools: snapshot_pane (rich capture with cursor/mode/scroll metadata), wait_for_content_change (detect any screen change), select_pane (directional navigation), swap_pane, pipe_pane, display_message (tmux format string queries), enter_copy_mode, exit_copy_mode, paste_text (bracketed paste via tmux buffers). New session tool: select_window (navigate by ID/index/direction). New window tool: move_window (reorder or cross-session moves). Models: PaneSnapshot, ContentChangeResult. Tests: 22 new tests covering all new tools.
Document snapshot_pane, wait_for_content_change, display_message, select_pane, select_window, swap_pane, move_window, pipe_pane, enter_copy_mode, exit_copy_mode, and paste_text with usage guidance, JSON examples, and parameter tables following existing patterns. Update tools/index.md with new grid cards and expanded "Which tool do I want?" decision guide covering navigation, layout, scrollback, and paste workflows.
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.
tony
added a commit
that referenced
this pull request
Apr 15, 2026
… + libtmux_mcp_ prefix
why: Three sibling modules had each rolled their own tmux argv
builder:
* buffer_tools.py defined ``_tmux_argv`` inline.
* wait_for_tools.py defined an identical ``_tmux_argv`` inline
(docstrings differed; bodies were byte-for-byte identical).
* pane_tools/io.py::paste_text rebuilt the same socket-aware
argv by hand.
Two code-review findings converged on this file set:
* Important #4 (Loom review): paste_text called ``subprocess.run``
with no ``timeout=`` at all, so a hung tmux could block the
tool call indefinitely. Adjacent sibling buffer tools had the
timeout but paste_text did not.
* Suggestion #11/#12: the duplicate helpers and the parallel
inline build in paste_text are one refactor, not three.
Also: paste_text's internal ``mcp_paste_<uuid>`` buffer name did
not share the ``libtmux_mcp_`` namespace the new buffer_tools
module established, so an operator auditing MCP-owned buffers
via ``list-buffers | grep libtmux_mcp_`` would miss
paste-through buffers.
what:
- Hoist ``_tmux_argv`` into src/libtmux_mcp/_utils.py as an internal
helper with a NumPy-style docstring + two doctests (socket_name
only; socket_path only). Honours ``server.tmux_bin`` if set.
- Delete the inline ``_tmux_argv`` definitions in
src/libtmux_mcp/tools/buffer_tools.py and
src/libtmux_mcp/tools/wait_for_tools.py; import the shared helper.
The now-unused ``Server`` TYPE_CHECKING import is also dropped.
- Update src/libtmux_mcp/tools/pane_tools/io.py::paste_text:
* Replace the inline argv construction with ``_tmux_argv(server,
"load-buffer", "-b", buffer_name, tmppath)``.
* Add ``timeout=5.0`` on the ``subprocess.run`` call, matching the
sibling buffer tools.
* Add an explicit ``except subprocess.TimeoutExpired`` branch with
the same shape buffer_tools landed in the previous commit.
* Rename the buffer prefix from ``mcp_paste_<uuid>`` to
``libtmux_mcp_paste_<uuid>``.
- Update tests/test_pane_tools.py::test_paste_text_does_not_leak_named_buffer
to assert the new prefix (and updates the docstring rationale).
- Add tests/test_utils.py::test_tmux_argv_honours_socket_and_binary
parametrized over four cases: socket_name only, socket_path only,
both set, and explicit tmux_bin override.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Builds on #11. Overhauls the documentation system:
fastmcp-resource,fastmcp-resourcesummary,fastmcp-model,fastmcp-model-fields,fastmcp-modelsummarydirectives plus{resource},{resourceref},{model},{modelref}roles. Fix_MODEL_CLASSESstaleness (PaneSnapshot and ContentChangeResult were missing).server/,session/,window/,pane/). Grid cards on index pages serve as navigation. sphinxcontrib-rediraffe redirects for old paths.SphinxContentsFilterto raiseSkipNodefor badge nodes — same pattern Sphinx uses forvisit_image. Badges render in headings but are stripped from toctree/sidebar. CSS removescode.literalbackground in sidebar.New directives & roles
fastmcp-resource,fastmcp-resourcesummary,fastmcp-model,fastmcp-model-fields,fastmcp-modelsummary{resource},{resourceref},{model},{modelref}Page structure
Test plan
uv run ruff check . --fix --show-fixespassesuv run ruff format .— no changesuv run mypy— no issuesuv run py.test --reruns 0 -vvv— 251 tests passjust build-docs— builds clean