Skip to main content
Glama
kitepon
by kitepon

pty_send

Send commands or prompts to a PTY session for immediate execution, with output retrieved separately through pty_read. Supports agent dispatch for non-blocking submission and automatic completion detection.

Instructions

セッションへテキストを送る。通常PTYへは送信のみ(出力は pty_read で取得)。agent session(launcher起動)への send は自動で dispatch になる: TUI の ready gate と submit 分離を通して即返り、receipt の event_cursor を返す。dispatch した子は投げっぱなしでよい=親はここで待たない。完了通知はreceiptの wait_process.executablewait_process.args をそのまま親のターンを塞がない別プロセスAPIへ渡して受け、PowerShell 7のStart-Processだけは windows_start_process_argument_list を単一文字列として渡す。exit を完了通知として扱う(exit 0=done / 3=timeout(既定600秒・未完了) / 4=closed。receiptのoutcomeが正で、done以外は未完了。ポーリング不要)。wait_command は人間向け互換表示でありprocess境界へ使わない。foreground実行で親のターンを塞がない。結果回収は 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 無しでも自動検出して完了確定する(POSIX shell と PowerShell に対応。PowerShell の rc は成功0/失敗1。fish/csh/tcsh は未対応として送信前に拒否)。 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
harnessYes
launch_idYes
session_idYes
event_cursorYes
wait_processYes
submit_residueYes
Install Server

TDQS

A4.8/5.0
Behavior5/5

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

With no annotations available, the description carries the full burden of behavioral disclosure, and it does so thoroughly: it explains send-only semantics, dispatch behavior with event_cursor receipt, fire-and-forget semantics, exit codes (0/3/4), no polling needed, foreground non-blocking execution, and the force:true caveat. This is far beyond what schema or annotations could convey.

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 a dense single paragraph rather than a structured output, which hurts scannability. However, nearly every clause carries actionable information — alternatives, exit codes, constraints — so the length is earned. It starts with the core purpose and then layers on detail, but a bulleted structure would improve readability.

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?

The description covers the full calling context: normal PTY vs agent dispatch, output retrieval, completion semantics, exit codes, sibling routing, and caveats like foreground execution and force mode. Since an output schema exists, return values don't need to be explained in prose. Nothing critical is missing for an agent to invoke this tool correctly.

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?

The schema already covers 86% of parameters, so the baseline is 3. The description adds cross-parameter context that the schema does not: the mark+enter interplay for completion detection, force:true being restricted to non-Claude agent sessions and incompatible with active turns, and the relationship between receipt fields and process API usage. These are meaningful semantics beyond the schema.

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 opens with a clear statement of what the tool does: sends text to a session. It also explicitly differentiates itself from siblings by stating that output must be retrieved via pty_read, and that agent-session sends become automated dispatch, distinguishing it from pty_key, claude_turn, and claude_approval.

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 concrete routing guidance: use pty_read for result collection, use claude_turn for durable turns, use claude_approval for the approval UI, and do not use wait_command across process boundaries. It also clarifies when force:true is appropriate, which tells the agent exactly when this tool is or isn't the right choice.

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

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/kitepon/aiterm-mcp'

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