Skip to main content
Glama
almahdi
by almahdi

pty_read

Destructive

Read output from a terminal session's buffer, either sequentially or by searching with regex patterns to filter specific lines.

Instructions

Reads output from a PTY session's buffer.

The PTY maintains a rolling buffer of output lines. Use offset and limit to paginate through the output.

Two modes:

  1. Standard mode (no pattern): Returns consecutive lines

  2. Search mode (with pattern): Filters lines by regex, returns matches with line numbers

The buffer stores up to PTY_MAX_BUFFER_LINES (default: 50000) lines. Older lines are discarded when the limit is reached.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesThe PTY session ID (from pty_spawn)
offsetNoLine number to start reading from (0-based, defaults to 0)
limitNoNumber of lines to read (defaults to 500)
patternNoRegex pattern to filter lines (enables search mode)
ignoreCaseNoCase-insensitive pattern matching (default: false)
Behavior4/5

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

Annotations provide readOnlyHint=false, destructiveHint=true, etc., but the description adds valuable behavioral context beyond that: it explains the rolling buffer mechanism, buffer size limit (PTY_MAX_BUFFER_LINES), and that older lines are discarded, which clarifies the destructive nature. No contradiction with annotations.

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 with the core purpose, followed by structured details (modes, buffer info) in bullet-like form. Every sentence adds value—no fluff—and it's appropriately sized for the tool's complexity.

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

Completeness4/5

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

Given no output schema and rich annotations, the description is mostly complete: it covers purpose, usage, behavior, and parameters. However, it lacks details on return format (e.g., what data structure is returned) and error handling, which could aid the agent further.

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 already documents all parameters well. The description adds some semantics by explaining the two modes (standard vs. search) and how offset/limit work for pagination, but this mostly reinforces rather than extends the schema details.

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 verb ('Reads') and resource ('output from a PTY session's buffer'), specifying it accesses a rolling buffer. It distinguishes from siblings like pty_write (writes), pty_kill (terminates), pty_spawn (creates), and pty_list (lists sessions), making the purpose specific and differentiated.

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

Usage Guidelines4/5

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

The description provides clear context on when to use it (e.g., to paginate through output, with or without regex filtering) and mentions the buffer size limit, but does not explicitly state when not to use it or name alternatives among siblings (e.g., no comparison to pty_list for session info).

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/almahdi/mcp-terminal'

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