Skip to main content
Glama

tmux_capture_pane

Capture visible text from tmux terminal panes for automation and debugging. Specify session, pane, and lines to extract displayed content or scrollback history.

Instructions

Capture the visible content of a tmux pane. Returns the text currently displayed in the pane.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
session_nameYesName of the tmux session
pane_indexNoPane index (default: 0 for main pane)
linesNoNumber of lines to capture from scrollback (default: captures visible area, use -1 for entire scrollback)

Implementation Reference

  • The handler function that implements the tmux_capture_pane tool by executing the `tmux capture-pane` command with optional parameters for pane index and number of lines.
    async capturePane(args) {
      const { session_name, pane_index = "0", lines } = args;
    
      try {
        let cmd = `tmux capture-pane -t "${session_name}:${pane_index}" -p`;
    
        if (lines !== undefined) {
          if (lines === -1) {
            cmd += " -S -"; // Capture entire scrollback
          } else {
            cmd += ` -S -${lines}`;
          }
        }
    
        const { stdout } = await execAsync(cmd);
    
        return {
          content: [
            {
              type: "text",
              text: stdout,
            },
          ],
        };
      } catch (error) {
        throw new Error(`Failed to capture pane: ${error.message}`);
      }
    }
  • The input schema and metadata definition for the tmux_capture_pane tool, registered in the list of tools.
    {
      name: "tmux_capture_pane",
      description:
        "Capture the visible content of a tmux pane. Returns the text currently displayed in the pane.",
      inputSchema: {
        type: "object",
        properties: {
          session_name: {
            type: "string",
            description: "Name of the tmux session",
          },
          pane_index: {
            type: "string",
            description: "Pane index (default: 0 for main pane)",
          },
          lines: {
            type: "number",
            description:
              "Number of lines to capture from scrollback (default: captures visible area, use -1 for entire scrollback)",
          },
        },
        required: ["session_name"],
      },
    },
  • src/index.js:197-198 (registration)
    The switch case that registers and dispatches to the tmux_capture_pane handler in the CallToolRequestSchema handler.
    case "tmux_capture_pane":
      return await this.capturePane(args);
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It discloses the basic behavior (capturing visible content and returning text) but lacks details on permissions, error conditions, rate limits, or whether the capture is read-only (implied but not stated). It adds some context but is minimal for a tool with no annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is front-loaded and extremely concise—two sentences that directly state the tool's purpose and return value without any wasted words. Every sentence earns its place by providing essential information efficiently.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (3 parameters, no output schema, no annotations), the description is minimally adequate. It covers the basic purpose and return but lacks details on behavioral traits, error handling, and usage context. Without annotations or output schema, it should do more to compensate, but it's not entirely incomplete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema fully documents all parameters. The description adds no additional meaning beyond what the schema provides—it doesn't explain parameter interactions, default behaviors beyond schema hints, or edge cases. This meets the baseline for high schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('capture the visible content') and resource ('of a tmux pane'), distinguishing it from siblings like tmux_list_panes (which lists panes) or tmux_send_keys (which sends input). It precisely defines what the tool does without being vague or tautological.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention scenarios where tmux_capture_pane is preferred over tmux_list_panes (which might provide pane metadata) or other siblings, nor does it specify prerequisites or exclusions. Usage is implied only by the tool's name and purpose.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/MediocreTriumph/tmux-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server