Skip to main content
Glama
kitepon
by kitepon

pty_read

Fetch terminal session output incrementally with token-reduced updates, and recover long responses truncated by the screen tail.

Instructions

セッションの出力をトークン削減して読む(既定は前回読取位置からの増分)。削減: 制御文字除去 / 反復圧縮 / head+tail 折りたたみ+復元ヒント+メタ併記。agent_transcript:true は agent session の直近完了ターンの最終 assistant メッセージを公開されたharness記録から平文で返す。長い回答が screen tail で切れた時の回収用。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
rawNo削減せず生テキスト
rtkNo直前コマンド別の自前 reducer(git/grep/pytest 等)で縮約
fullNo増分でなく全文
waitNo完了まで待つ(dead / mark sentinel 自動検出 / until / 出力静止∧シェル復帰 / timeout)
linesNo末尾 N 行のみ
untilNoこの文字列が出たら完了とみなす(既定はリテラル部分一致。`$ ` や `[..]` もそのまま探せる)
screenNo描画済みスクリーン(TUI 向け)
timeoutNowait の最大待ち秒数
line_rangeNo全文からの行範囲 "A:B"
session_idYes
until_regexNountil を正規表現として扱う(既定 false=リテラル部分一致。メタ文字を使いたい時のみ true)
operation_idNoClaude operationの期待ID。agent_transcript:true時だけ指定し、古い別operationの結果を拒否する
agent_transcriptNoagent session の直近完了ターンの最終 assistant メッセージを返す。Claudeはlaunch相関付きStop hook result、他harnessは通常transcript/session historyを使う。長い回答がscreen tailで切れた時の回収用

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
modeYes
textYes
schemaYes
vendorYes
harnessYes
turn_idYes
raw_charsYes
session_idYes
Install Server

TDQS

A4.1/5.0
Behavior4/5

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

With no annotations provided, the description carries the full burden and does substantial work: it discloses the token-reduction pipeline (control-character removal, repetition compression, head+tail folding, restoration hints), the incremental read-offset default, and agent_transcript source semantics with operation_id rejection. It does not explicitly flag side effects like advancing the read cursor, but it is far from opaque.

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 one dense paragraph but stays focused: main action, default behavior, reduction details, and the special agent_transcript mode. Each clause earns its place, and the core read action is front-loaded. It could be broken into bullets for scannability, but there is no filler.

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?

The tool has 13 parameters and an output schema, and the description supplies essential high-level context that the schema alone does not: the reduction pipeline, the default cursor behavior, and the recovery purpose of agent_transcript. It does not walk through every wait/until/timeout combination, but the schema's 92% coverage and existing output schema compensate.

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 coverage is 92%, so the baseline is 3. The description reinforces the purpose of key parameters such as agent_transcript and the incremental-read default that clarifies full, but it mostly echoes what the detailed schema descriptions already state rather than adding new per-parameter semantics.

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 verb (read), resource (session output), and qualifier (token-reduced). It goes on to define the default incremental behavior and the agent_transcript special mode, distinguishing it from pty_send/key/list which act on the session rather than read from it. The action–resource pairing is unambiguous even without naming a sibling.

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

Usage Guidelines4/5

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

The description states a clear default (incremental from last read position) and names a concrete recovery scenario for agent_transcript: '長い回答が screen tail で切れた時の回収用'. It provides clear context without explicit exclusions or named alternatives, which fits the 'clear context, no exclusions' level.

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