Skip to main content
Glama
quolu
by quolu

pty_send

Send text or commands to a persistent PTY session. For agent sessions, dispatches input asynchronously and returns an event cursor to track completion.

Instructions

セッションへテキストを送る。通常PTYへは送信のみ(出力は pty_read で取得)。agent session(launcher起動)への send は自動で dispatch になる: TUI の ready gate と submit 分離を通して即返り、receipt の event_cursor を返す。dispatch した子は投げっぱなしでよい=親はここで待たない。完了通知は aiterm-wait --session <id> --cursor <event_cursor> を親のターンを塞がない別プロセスとして起動して受け、exit を完了通知として扱う(exit 0=done / 3=timeout(既定600秒・未完了) / 4=closed。receiptのoutcomeが正で、done以外は未完了。ポーリング不要)。この待ちコマンドを foreground で実行して親のターンを塞ぐことはしない(receipt が実際の起動形を示す)。結果回収は pty_read(agent_transcript:true)、Claude の durable turn は claude_turn を使う。force:true は非Claude agent sessionへの手動介入用の素送信。aiterm相関付きClaudeの承認UIはclaude_approvalを使う。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
rawNo送信前サニタイズを無効化
rtkNo既知コマンドを rtk 形へ委譲して送る(rtk 不在なら素通し)
markNo完了 sentinel(終了コード付き)で包む。pty_read(wait:true) が until 無しでも自動検出して完了確定する(ネスト中や非シェル前面でも効く確実な完了検出。手で until を組む必要なし)。 enter:false と併用すると sentinel が実行されず完了検出が発火しない(送信後に pty_key("Enter") で実行される)。
textYes送る文字列(コマンド/prompt)。UTF-8で最大64KiB
enterNo末尾で Enter を送る(agent dispatch では常に submit)
forceNo破壊的コマンドゲートを越える。非Claude agent sessionではdispatchせず素送信する。aiterm相関付きClaudeのactive turnには使えない
session_idYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
modeYes
schemaYes
vendorYes
launch_idYes
session_idYes
event_cursorYes
submit_residueYes
Behavior5/5

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

With no annotations provided, the description carries the full transparency burden. It thoroughly discloses behavior: automatic dispatch, immediate return with receipt event_cursor, fire-and-forget semantics, a separate aiterm-wait process with exit codes (0/3/4), explicit 'no polling', and guidance not to block the parent turn. These are critical behaviors beyond what schemas or annotations reveal.

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

Conciseness3/5

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

The content is information-dense and every clause has purpose, but the description is a single long, run-on paragraph with nested parentheses and qualifications. It would benefit from bullet points or clearer segmentation. It is front-loaded with a clear first sentence, but overall structure hinders quick scanning.

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

Completeness5/5

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

Given the tool's complexity and absence of annotations, the description is remarkably complete. It covers normal PTY behavior, agent dispatch, completion handling via aiterm-wait, result retrieval via pty_read, durable turns via claude_turn, manual force:true mode, and even references claude_approval. No critical context appears missing.

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

Parameters4/5

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

Schema coverage is high (86%) and the schema already documents each parameter in detail. The description adds semantic context beyond the schema by explaining how session_id and the returned event_cursor are used with aiterm-wait, and how force:true relates to non-Claude sessions. This enriches the parameter meaning without redundancy.

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 tool's core verb and resource: 'セッションへテキストを送る' (send text to a session). It further differentiates between normal PTY send and agent-session dispatch, and explicitly names sibling tools like pty_read and claude_turn for related operations, making the purpose unambiguous.

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 gives explicit when-to-use guidance: use pty_read for output, use claude_turn for Claude durable turns, and use claude_approval for approval UI. It also explains the automatic dispatch behavior for agent sessions and when to use force:true for non-Claude manual intervention. This clearly distinguishes from 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/quolu/aiterm-mcp'

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