Skip to content

Commit bac1ae7

Browse files
committed
mcp(docs[tools/sessions]): document list_servers discovery tool
The new ``list_servers`` tool (added earlier in the branch) wasn't documented anywhere under ``docs/`` — agents and human readers discovering the tool from a client's tool list had no docs page to land on. The conf.py area-map already routes ``server_tools`` → ``sessions``, so the natural home is ``docs/tools/sessions.md`` between ``get_server_info`` and ``create_session``. Adds the standard four-part section: ``{fastmcp-tool}`` directive, Use-when / Avoid-when / Side-effects narrative, an example JSON request + response (including a second example with ``extra_socket_paths`` for the custom-path case), and the ``{fastmcp-tool-input}`` schema directive. Calls out the scope caveat (custom ``tmux -S /path/...`` daemons are not in the canonical scan) up front so readers don't reach for the tool in the wrong situation. Also adds a grid-item-card to ``docs/tools/index.md`` so the discovery overview links to the new section.
1 parent 2e11c7e commit bac1ae7

2 files changed

Lines changed: 76 additions & 0 deletions

File tree

docs/tools/index.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,12 @@ Wait for text to appear in a pane.
111111
Get tmux server info.
112112
:::
113113

114+
:::{grid-item-card} list_servers
115+
:link: list-servers
116+
:link-type: ref
117+
Discover live tmux servers under `$TMUX_TMPDIR`.
118+
:::
119+
114120
:::{grid-item-card} show_option
115121
:link: show-option
116122
:link-type: ref

docs/tools/sessions.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,76 @@ Response:
7575
```{fastmcp-tool-input} server_tools.get_server_info
7676
```
7777

78+
---
79+
80+
```{fastmcp-tool} server_tools.list_servers
81+
```
82+
83+
**Use when** you need to discover other live tmux servers on this
84+
machine — for example, when an agent's tools were configured for the
85+
default server but the user is also running a separate tmux for a
86+
side project.
87+
88+
**Avoid when** you already know the socket name or path you want to
89+
target — pass it directly to the tool that needs it via `socket_name`.
90+
91+
**Side effects:** None. Readonly. Stale socket files are filtered
92+
via a kernel-fast UNIX `connect()` probe so the call stays under one
93+
second even on machines with thousands of orphaned `tmux-<uid>/`
94+
inodes.
95+
96+
**Scope:** Only servers under `${TMUX_TMPDIR:-/tmp}/tmux-<uid>/` are
97+
discovered by the canonical scan. Custom `tmux -S /some/path/...`
98+
daemons that live outside that directory must be supplied via
99+
`extra_socket_paths`.
100+
101+
**Example:**
102+
103+
```json
104+
{
105+
"tool": "list_servers",
106+
"arguments": {}
107+
}
108+
```
109+
110+
Response:
111+
112+
```json
113+
[
114+
{
115+
"is_alive": true,
116+
"socket_name": "default",
117+
"socket_path": null,
118+
"session_count": 3,
119+
"version": "3.6a"
120+
},
121+
{
122+
"is_alive": true,
123+
"socket_name": "ci-runner",
124+
"socket_path": null,
125+
"session_count": 1,
126+
"version": "3.6a"
127+
}
128+
]
129+
```
130+
131+
To include a custom-path daemon:
132+
133+
```json
134+
{
135+
"tool": "list_servers",
136+
"arguments": {
137+
"extra_socket_paths": ["/home/user/.cache/tmux/socket"]
138+
}
139+
}
140+
```
141+
142+
Paths that do not exist, are not sockets, or have no listener are
143+
silently skipped.
144+
145+
```{fastmcp-tool-input} server_tools.list_servers
146+
```
147+
78148
## Act
79149

80150
```{fastmcp-tool} server_tools.create_session

0 commit comments

Comments
 (0)