Skip to main content
Glama
almahdi
by almahdi

pty_write

Destructive

Send input to active terminal sessions, including commands, text, and control sequences like Ctrl+C or arrow keys, for interacting with command-line programs.

Instructions

Sends input data to an active PTY session.

Use this tool to:

  • Type commands or text into an interactive terminal

  • Send special key sequences (Ctrl+C, Enter, arrow keys, etc.)

  • Respond to prompts in interactive programs

Common escape sequences:

  • Enter/newline: "\n" or "\r"

  • Ctrl+C (interrupt): "\x03"

  • Ctrl+D (EOF): "\x04"

  • Ctrl+Z (suspend): "\x1a"

  • Tab: "\t"

  • Arrow Up: "\x1b[A"

  • Arrow Down: "\x1b[B"

  • Arrow Right: "\x1b[C"

  • Arrow Left: "\x1b[D"

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesThe PTY session ID (from pty_spawn)
dataYesInput string to send (supports escape sequences)
Behavior4/5

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

Annotations already indicate destructiveHint=true (mutation) and non-idempotent, but the description adds valuable context: it specifies the tool is for interactive terminal input, supports escape sequences for special keys, and provides concrete examples of common sequences. This goes beyond annotations by detailing practical behavior and input formatting.

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

Conciseness4/5

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

The description is well-structured with a clear opening sentence followed by bullet points and a reference table for escape sequences. It's appropriately sized for the tool's complexity, though the escape sequence table is somewhat lengthy but necessary for clarity.

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 the tool's moderate complexity (interactive terminal input), no output schema, and rich annotations, the description is mostly complete. It covers purpose, usage, and input details but could benefit from mentioning error cases or dependencies (e.g., requires an active PTY session from pty_spawn).

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 both parameters. The description adds some value by explaining that 'data' supports escape sequences and providing examples, but it doesn't add significant meaning beyond what the schema provides (e.g., no details on 'id' format or data constraints).

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 ('Sends input data') and resource ('to an active PTY session'), distinguishing it from siblings like pty_read (receives output) or pty_spawn (creates session). It explicitly identifies the tool's function as transmitting user input to an interactive terminal.

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

Usage Guidelines5/5

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

The description provides explicit usage scenarios with bullet points: typing commands/text, sending special key sequences, and responding to prompts. It implicitly distinguishes from pty_read (for reading output) and pty_spawn (for creating sessions), though it doesn't explicitly name alternatives.

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