Skip to main content
Glama

Write to a terminal

terminal_write

Send raw input to an existing shell session, appending a newline so commands execute; optionally wait for and return the resulting output.

Instructions

Write raw input to a running session. By default a newline is appended so the shell executes it. Set wait to true to also return the output produced by this write.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "id": "<id>",
      "input": "<input>"
    },
    "name": "terminal_write"
  }
}

Input Schema

NameRequiredDescriptionDefault
idYesSession id (for example "term_1a2b3c4d") or the friendly name given at spawn time.
waitNoWait for output to go quiet and include the new output in the response. Default false.
inputYesText to send to the session stdin.
idleMsNoConsider the command finished after this many ms without new output. Default 400.
newlineNoAppend a newline after the input. Default true. Set false for REPLs or raw typing.
timeoutMsNoMaximum time to wait in milliseconds. Default 120000 for terminal_exec, 15000 for terminal_write, 30000 for terminal_run.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.2.0

TDQS

A3.8/5.0
Behavior4/5

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

The annotations already declare this is a non-read-only, non-idempotent, open-world operation without destructiveness, so the safety profile is covered. The description adds genuinely useful context beyond that: that a newline is appended by default causing the shell to execute the input, and that wait=true changes the response to include produced output. It does not cover timeout/idle quiet-detection behavior, but that is documented in the schema.

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?

Two short sentences with no filler. The core action is front-loaded and the default-execution consequence follows immediately, with the wait option last.

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?

For a stdin-write tool with full annotation coverage, a fully described six-parameter schema, and no output schema, the description supplies the behavior an agent most needs: that input executes by default and that output can be captured with wait. The remaining gap is routing guidance versus terminal_exec and terminal_run.

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 every parameter including id, input, wait, newline, idleMs and timeoutMs is already documented with defaults and bounds. The description restates the wait and newline defaults but adds no semantics not already present in the schema, so the baseline of 3 applies.

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

Purpose4/5

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

"Write raw input to a running session" names a specific verb and resource, and the newline note clarifies that the write feeds the shell's stdin rather than performing a higher-level action. It is clear on its own, but it never explicitly distinguishes itself from terminal_exec or terminal_run, which an agent must infer from the sibling list.

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

Usage Guidelines3/5

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

Usage is implied through mechanics rather than stated as guidance: "Set wait to true to also return the output produced by this write" and "Set false for REPLs or raw typing" tell the agent how to configure behavior. There is no explicit statement of when to choose terminal_write over terminal_exec or terminal_run, which is the main decision an agent faces here.

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