Skip to content

Commit 25272a0

Browse files
committed
mcp(refactor[display_message]): sharpen description + title for LLM discoverability
why: the name 'display_message' reads to an LLM like "show a notification to the user" — the opposite of what the tool does (evaluate a tmux format string and return the expanded value). _BASE_INSTRUCTIONS already had corrective prose to compensate, which is structural evidence the name is doing the wrong job. Rewording the docstring summary and the MCP title lets the description carry the meaning without touching the wire-name. A hard rename to evaluate_format is deliberately deferred behind telemetry. what: - Rewrite the first sentence of display_message's docstring so FastMCP-indexed description leads with 'Evaluate a tmux format string... and return the expanded value.' — FastMCP pulls description from the docstring when no description= kwarg is given (fastmcp/tools/function_tool.py:225-227). - Change the mcp.tool registration title from 'Display Message' to 'Evaluate tmux Format String' in pane_tools/__init__.py. - Refresh the corrective sentence in _BASE_INSTRUCTIONS to match the new wording and name-check the title shift. - Complete the truncated '## Act' section in display-message.md and lead with the new framing; retitle the page to reflect the MCP title.
1 parent bbfffae commit 25272a0

4 files changed

Lines changed: 18 additions & 13 deletions

File tree

docs/tools/pane/display-message.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
# Display message
1+
# Evaluate tmux format string (display_message)
22

33
```{fastmcp-tool} pane_tools.display_message
44
```
55

66
**Use when** you need to query arbitrary tmux variables — zoom state, pane
77
dead flag, client activity, or any `#{format}` string that isn't covered by
8-
other tools.
8+
other tools. Despite the historical name (`display_message` is the tmux verb
9+
it wraps), this tool does **not** display anything to the user; it expands
10+
the format string with `display-message -p` and returns the value.
911

1012
**Avoid when** a dedicated tool already provides the information — e.g. use
1113
{tooliconl}`snapshot-pane` for cursor position and mode, or
@@ -33,5 +35,3 @@ zoomed=0 dead=0
3335

3436
```{fastmcp-tool-input} pane_tools.display_message
3537
```
36-
37-
## Act

src/libtmux_mcp/server.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,11 @@
5959
"READ TOOLS TO PREFER: snapshot_pane returns pane content plus "
6060
"cursor position, mode, and scroll state in one call — use it "
6161
"instead of capture_pane + get_pane_info when you need context. "
62-
"display_message evaluates any tmux format string (e.g. "
63-
"'#{pane_current_command}', '#{session_name}') against a target, "
64-
"which is often cheaper than parsing captured output.\n\n"
62+
"display_message evaluates a tmux format string (e.g. "
63+
"'#{pane_current_command}', '#{session_name}') against a target "
64+
"and returns the expanded value — cheaper than parsing captured "
65+
"output. (The tool is named after the tmux 'display-message -p' "
66+
"verb it wraps; its MCP title is 'Evaluate tmux Format String'.)\n\n"
6567
"WAIT, DON'T POLL: for 'run command, wait for output' workflows "
6668
"use wait_for_text (matches text/regex on a pane) or "
6769
"wait_for_content_change (waits for any change). These block "

src/libtmux_mcp/tools/pane_tools/__init__.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,11 @@ def register(mcp: FastMCP) -> None:
120120
mcp.tool(title="Pipe Pane", annotations=ANNOTATIONS_SHELL, tags={TAG_MUTATING})(
121121
pipe_pane
122122
)
123-
mcp.tool(title="Display Message", annotations=ANNOTATIONS_RO, tags={TAG_READONLY})(
124-
display_message
125-
)
123+
mcp.tool(
124+
title="Evaluate tmux Format String",
125+
annotations=ANNOTATIONS_RO,
126+
tags={TAG_READONLY},
127+
)(display_message)
126128
mcp.tool(
127129
title="Enter Copy Mode",
128130
annotations=ANNOTATIONS_CREATE,

src/libtmux_mcp/tools/pane_tools/meta.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,11 @@ def display_message(
2626
window_id: str | None = None,
2727
socket_name: str | None = None,
2828
) -> str:
29-
"""Query tmux using a format string.
29+
"""Evaluate a tmux format string against a target and return the expanded value.
3030
31-
Expands tmux format variables against a target pane. Use this as a
32-
generic introspection tool to query any tmux variable, e.g.
31+
Read-only introspection tool — expands any tmux format variable
32+
against a target pane and returns the substituted text. Use this
33+
when no dedicated tool covers the field you want, e.g.
3334
'#{window_zoomed_flag}', '#{pane_dead}', '#{client_activity}'.
3435
3536
Parameters

0 commit comments

Comments
 (0)