Skip to main content
Glama
aiterm-mcp
by kitepon

stream_send

Send up to 20 lines of structured input—user messages, control requests, or responses—to a running Claude session, with optional SSH targeting and launch-bound writes.

Instructions

machine席のclaudeへデータを送る(codex-machine席は user・control{request.subtype: interrupt・set_overrides・goal}・response{request_id, result|error} の3つ。docs/architecture/codex-machine-stream.md)。Claudeの許す形は3つだけで、中身は書き換えない(無いuuid/request_idだけ補う): user(message {role:user, content}。実行中なら同じturnへ入る。/goal もここ)、control_request(request.subtype は interrupt・set_model・apply_flag_settings・set_permission_mode・set_max_thinking_tokens)、control_response(response {subtype:success|error, request_id, response}。state.pendingにあるrequest_idの時だけ。expected_launch_idを指定すれば、その起動以外には書き込まない。can_use_toolへの答え: AskUserQuestionの選択は response.response.updatedInput.answers)。1回に1〜20行。

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": {
      "session_id": "<session_id>",
      "lines": "<lines>"
    },
    "name": "stream_send"
  }
}

Input Schema

NameRequiredDescriptionDefault
linesYes
remoteNo別端末のAitermで実行する時のSSH接続情報。hostだけならssh_configの接続名として使う。Aitermは接続情報を保存・管理しない。passphraseは会話記録に残るため、ssh-agentかpassphrase_env(環境変数名)を推奨する。
session_idYes
expected_launch_idNoBind this write to the launch that owns the pending answer

Output Schema

NameRequiredDescriptionDefault
itemsYes
schemaYes
acceptedYes
consumedYeshostがclaudeのstdinへ渡し終えたか
launch_idYes
session_idYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.70.127
    • addedInput schema / properties / expected_launch_id
      Added value: +{
      +  "description": "Bind this write to the launch that owns the pending answer",
      +  "pattern": "^[a-f0-9]{32}$",
      +  "type": "string"
      +}
  2. Changed1 schema field changedv0.70.112
    • addedInput schema / properties / remote / properties / ssh
      Added value: +{
      +  "additionalProperties": false,
      +  "description": "Pinned ssh: {known_hosts_file, host_key_alias?, identity_agent | identity_file, strict_host_key?: true} (absolute paths). Strict host checking against that file with that one identity, no user ssh config. Not combinable with identity_file, ssh_options, passphrase or passphrase_env. Needs Aiterm 0.70.101 on the other computer.",
      +  "properties": {
      +    "host_key_alias": {
      +      "pattern": "^(?!-)[A-Za-z0-9._%:\\[\\]-]{1,255}$",
      +      "type": "string"
      +    },
      +    "identity_agent": {
      +      "pattern": "^(\\/|[A-Za-z]:[\\\\/])[^\\s\"'`]*$",
      +      "type": "string"
      +    },
      +    "identity_file": {
      +      "pattern": "^(\\/|[A-Za-z]:[\\\\/])[^\\s\"'`]*$",
      +      "type": "string"
      +    },
      +    "known_hosts_file": {
      +      "pattern": "^(\\/|[A-Za-z]:[\\\\/])[^\\s\"'`]*$",
      +      "type": "string"
      +    },
      +    "strict_host_key": {
      +      "const": true,
      +      "type": "boolean"
      +    }
      +  },
      +  "required": [
      +    "known_hosts_file"
      +  ],
      +  "type": "object"
      +}
  3. Addedv0.70.91

TDQS

A3.7/5.0
Behavior4/5

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

With no annotations, the description carries the full burden and does disclose key behavior: payloads are not rewritten (only missing uuid/request_id are filled in), a user message joins the currently running turn, control_response is valid only against a pending request_id, and expected_launch_id pins the write to one launch. It omits failure/error behavior when a write is rejected and whether calls block.

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?

Every sentence carries real protocol information, but it is delivered as one dense run-on with deeply nested parentheses and slash-separated alternatives, making the three payload forms hard to scan. A bulleted breakdown of user / control_request / control_response would be far more front-loaded.

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 low-level protocol tool this is largely complete: the accepted shapes, their sub-fields, the pending-request constraint, and the launch binding are all present, and an output schema exists so return values need not be described. The remaining gap is how an agent obtains a valid session_id and what happens when a write fails.

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 50%, and the description compensates by spelling out what belongs in `lines` — the three permitted object shapes and their internal fields — plus the binding meaning of expected_launch_id. The `remote` object is covered by the schema's own description, so no meaning is lost, though session_id is never explained.

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?

The opening clause states a concrete verb and target ("machine席のclaudeへデータを送る") and the rest enumerates the exact payload shapes accepted, so the agent knows this is a raw stream-write tool rather than a PTY writer. It never explicitly contrasts itself with pty_send or stream_read, so the differentiation is inferred from the protocol detail rather than stated.

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?

It gives strong conditional guidance per payload form (control_response only when the request_id is in state.pending, /goal goes through the user form, AskUserQuestion answers go in response.response.updatedInput.answers). However, it offers no guidance on when to pick stream_send over siblings like pty_send, nor any prerequisites such as needing an existing session or a pending request.

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