Commit 34dcfd4
authored
feat(tools): Add 11 new MCP tools for agent workflows (#11)
Expands the MCP surface with tools that unblock common agent
workflows the initial tool set couldn't serve cleanly: rich pane
introspection, waiting on unspecified output, pane and window
navigation, layout rearrangement, scrollback and copy-mode
control, bracketed multi-line paste, generic tmux format-string
queries, and pane output logging. All tools ship with Pydantic
output models, user-facing documentation, and tests that run
against every tmux version in the CI matrix (3.2a through
master).
**New pane tools:**
- `snapshot_pane` — one-call capture returning content plus
cursor position, mode, scroll state, and pane metadata
- `wait_for_content_change` — block until any on-screen change;
complements `wait_for_text` when expected output is unknown
- `select_pane` — focus by pane_id or by direction
(up/down/left/right/last/next/previous)
- `swap_pane` — exchange two panes' positions within a window
- `pipe_pane` — start or stop streaming pane output to a file
- `display_message` — query arbitrary tmux format strings
- `enter_copy_mode` / `exit_copy_mode` — control scrollback
access, with optional immediate scroll-up on entry
- `paste_text` — deliver multi-line text via isolated tmux
buffers
**New session tool:**
- `select_window` — focus by id, index, or direction
(next / previous / last)
**New window tool:**
- `move_window` — reorder within a session or move across
sessions
**New models:** `PaneSnapshot` and `ContentChangeResult`, both
with full field-level typing for the richer return shapes.
**Correctness guarantees validated by test:**
- Directional navigation in `select_pane` and `select_window`
routes through absolute pane_ids and session-scoped tmux
subcommands, so targeting a non-active window or non-current
session cannot misroute focus to whatever the attached client
happens to have focused.
- `move_window` refreshes the window after the move, so
cross-session returns never carry stale session metadata
(libtmux's in-memory update skips refresh on the
destination-index-plus-session branch).
- `snapshot_pane` uses the printable Unicode `␞` delimiter —
the same choice as libtmux's `FORMAT_SEPARATOR` — so parsing
is immune to tmux's version-dependent control-character
escaping in `display-message` output.
- `pipe_pane` shell-quotes output paths and rejects empty
strings at the tool boundary instead of letting tmux emit a
broken pipe silently.
- `paste_text` uses per-call UUID-named tmux buffers, surfaces
load-buffer stderr as `ToolError`, and cleans up both the
named buffer and the temp file on every exit path.
- MCP annotation tiers corrected for non-idempotent operations:
`swap_pane`, `enter_copy_mode`, and `pipe_pane` advertise
`idempotentHint=false`.
**Docs:** per-module pages in `docs/tools/*.md` with usage
guidance, JSON examples, and parameter tables for every tool;
the tools index carries an expanded "Which tool do I want?"
decision guide; the README Tools table lists the full new
roster; the docs landing page highlights the headline
capabilities.14 files changed
Lines changed: 2086 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
9 | 16 | | |
10 | 17 | | |
11 | 18 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
20 | | - | |
21 | | - | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | | - | |
| 56 | + | |
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | | - | |
| 62 | + | |
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | | - | |
| 13 | + | |
| 14 | + | |
13 | 15 | | |
| 16 | + | |
14 | 17 | | |
15 | 18 | | |
16 | 19 | | |
| 20 | + | |
17 | 21 | | |
18 | 22 | | |
19 | 23 | | |
20 | 24 | | |
21 | 25 | | |
22 | 26 | | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
23 | 41 | | |
24 | 42 | | |
25 | 43 | | |
| |||
91 | 109 | | |
92 | 110 | | |
93 | 111 | | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
94 | 130 | | |
95 | 131 | | |
96 | 132 | | |
| |||
178 | 214 | | |
179 | 215 | | |
180 | 216 | | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
181 | 265 | | |
182 | 266 | | |
183 | 267 | | |
| |||
0 commit comments