Skip to main content
Glama
kitepon
by kitepon

pty_close

Close an active PTY session to terminate it, discard logs and read position, and get a structured receipt. Retrying the same session ID is safe, returning 'closed' or 'already_closed'.

Instructions

セッションを閉じ、ログ/読取位置を破棄する。同じsession_idへの再試行は安全で、closed/already_closedのstructured receiptを返す。

Input Schema

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

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
schemaYes
outcomeYes
session_idYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. 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"
      +}
  2. Addedv0.22.0

TDQS

A3.8/5.0
Behavior4/5

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

Since no annotations are provided, the description carries the full burden. It discloses that logs and read position are discarded, that retries are safe, and that the return is a structured receipt with closed/already_closed states. This is more than a minimal statement of the action. It does not cover side effects like resource cleanup details or auth requirements, but for a close operation the disclosed behavior is adequate.

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?

The description is a single, efficient sentence that front-loads the primary action and then adds the key behavioral notes (retry safety, receipt type). No fluff or repetition.

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

Completeness3/5

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

The tool has a nested remote object and an output schema, but the description ignores the remote parameter entirely. While the output schema covers return values, the lack of any mention of the optional remote or the meaning of session_id leaves a gap for an agent. For a relatively simple close operation, the core behavior is covered, but parameter context is incomplete.

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

Parameters2/5

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

The description adds no explanation for either parameter. The schema has a detailed description for 'remote', but none for 'session_id'. Since the schema description coverage is 50% and the description fails to compensate for the undocumented required parameter, the agent gets no additional guidance. The description does not clarify what session_id represents or how the remote parameter affects execution.

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 states a specific verb ('close'), a specific resource (session), and the effect (discard logs/read position). It clearly distinguishes from sibling tools like pty_send or pty_read, even without naming them, because the action is unique and unambiguous.

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?

The description provides a usage hint by noting that retrying with the same session_id is safe, which implies it is idempotent. However, it does not explicitly state when to use this tool versus alternatives, nor does it mention any prerequisites or exclusions. The guidance is implicit rather than explicit.

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