Skip to main content
Glama
kitepon
by kitepon

pty_observe

Observe a terminal session's existence, pane and harness liveness, state, process identity, screen changes, and CPU activity as structured data without exposing screen text or raw argv.

Instructions

指定sessionの存在、paneとharnessの生存、状態と理由、native process identity、画面変化とCPU活動を構造化して観測する。画面本文と生argvは返さない。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cursorNo前回のactivity.cursor。省略・session再作成時は活動差分をnullで返す
remoteNo別端末のAitermで実行する時のSSH接続情報。hostだけならssh_configの接続名として使う。Aitermは接続情報を保存・管理しない。passphraseは会話記録に残るため、ssh-agentかpassphrase_env(環境変数名)を推奨する。
session_idYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
stateYes
existsYes
reasonYes
schemaYes
harnessYes
activityYes
launch_idYes
pane_aliveYes
session_idYes
token_hintYes
observed_atYes
pane_processYes
harness_aliveYes
harness_processYes
process_identityYes
parent_deliveriesNo
pending_child_deliveriesNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv0.49.0
    • addedOutput schema / properties / activity / properties / post_startup_process_count
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "number"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ]
      +}
    • addedOutput schema / properties / pending_child_deliveries
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "number"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ]
      +}
  2. Changed1 schema field changedv0.39.1
    • addedInput schema / properties / remote
      Added value: +{
      +  "additionalProperties": false,
      +  "description": "別端末のAitermで実行する時のSSH接続情報。hostだけならssh_configの接続名として使う。Aitermは接続情報を保存・管理しない。passphraseは会話記録に残るため、ssh-agentかpassphrase_env(環境変数名)を推奨する。",
      +  "properties": {
      +    "host": {
      +      "pattern": "^(?!-)[A-Za-z0-9._%:\\[\\]-]{1,255}$",
      +      "type": "string"
      +    },
      +    "identity_file": {
      +      "minLength": 1,
      +      "type": "string"
      +    },
      +    "passphrase": {
      +      "minLength": 1,
      +      "type": "string"
      +    },
      +    "passphrase_env": {
      +      "pattern": "^[A-Za-z_][A-Za-z0-9_]*$",
      +      "type": "string"
      +    },
      +    "port": {
      +      "maximum": 65535,
      +      "minimum": 1,
      +      "type": "integer"
      +    },
      +    "ssh_options": {
      +      "items": {
      +        "pattern": "^[A-Za-z][A-Za-z0-9]*=[^\\r\\n]*$",
      +        "type": "string"
      +      },
      +      "maxItems": 32,
      +      "type": "array"
      +    },
      +    "user": {
      +      "pattern": "^(?!-)[A-Za-z0-9._@\\\\-]{1,128}$",
      +      "type": "string"
      +    }
      +  },
      +  "required": [
      +    "host"
      +  ],
      +  "type": "object"
      +}
  3. Addedv0.35.0

TDQS

A4.2/5.0
Behavior4/5

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

No annotations are provided, so the description carries the full disclosure burden, and it does disclose the output boundary (screen body and raw argv are withheld) plus the observation dimensions, implying a passive/read-only call. It says nothing about permissions, the cost of remote SSH execution, or repeat-call/rate behavior, which are the remaining gaps for an unannotated tool.

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 dense sentences: the first front-loads the full observation scope, the second front-loads the critical negative (what is not returned). Every clause maps to a distinct observable, and no sentence is 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?

An output schema exists, so return-value shape needn't be spelled out, and the description correctly covers the non-obvious parts: what is observed and what is deliberately withheld. It stops short of explicitly pointing to pty_read for screen content, which is the one piece of context an agent choosing between these siblings would benefit from.

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 67% and the two documented parameters (cursor, remote with its SSH auth guidance) are already fully explained in the schema, so the description's only contribution is implying that session_id targets the session being observed. With the baseline-3 rule for high schema coverage and no added syntax or format detail, 3 is appropriate.

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?

States a specific verb (observe) and enumerates exactly what is observed: session existence, pane/harness liveness, status and reason, native process identity, screen changes and CPU activity. The closing clause 'does not return screen body or raw argv' distinguishes it from the sibling pty_read without requiring the agent to open either schema.

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 definition gives clear context on what this call is for (structured state/health observation) and an explicit exclusion (no screen text or raw argv), which steers agents away from using it as a content read. It does not, however, name pty_read or pty_list as the alternatives or state a when-to-use trigger explicitly, so routing is inferred rather than stated.

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