Skip to content

mcp(pane_tools): Add wait_for_text tool for terminal automation #651

@tony

Description

@tony

Context

Terminal automation often requires waiting for specific output to appear (e.g., waiting for a build to finish, a prompt to return, or a specific string to appear). Currently, agents must poll capture_pane repeatedly, consuming tokens and turns.

Proposed Solution

Add a wait_for_text tool:

```python
def wait_for_text(
pattern: str,
pane_id: str | None = None,
timeout: float = 10.0,
match_case: bool = False,
socket_name: str | None = None,
) -> PaneContentMatch | str:
```

This would use libtmux's existing retry_until pattern internally, polling capture_pane at short intervals and returning when the pattern appears or the timeout expires. Tagged as TAG_READONLY.

Impact

Reduces agent token consumption and turn count for common "run command, wait for output" workflows. This is the most-requested missing tool for reliable terminal automation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    MCPMCP server (src/libtmux/mcp/)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions