Skip to main content
Glama

read_output

Reads a specified output stream from an execution, returning selected lines with slice-style ranges so you can inspect stdout, stderr, results, or tracebacks.

Instructions

读取一个 execution 的指定输出流。

选择与流

execution 的选择规则与 execution_status 相同。stream 只能为 combined、stdout、stderr、result 或 traceback。

行坐标

line_range 形如切片 start:stop:两端都是行号,都含在范围内, 端点都可以省略,省略即到边界,所以 : 就是整个流。:10 读前 10 行,-10: 读后 10 行,2:4 读第 2 到第 4 行,3:3 只读第 3 行。

负数按行号从尾部数,两端照样都含::-3 是到倒数第三行为止,不是去掉 末三行。所选范围的全部行一次返回,不必切成连续的小段。

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "read_output"
  }
}

Input Schema

NameRequiredDescriptionDefault
streamNo输出流;默认 ``combined``,其余值为 ``stdout``、``stderr``、 ``result`` 与 ``traceback``。combined
executionNo要读取的正整数执行编号。省略时使用当前记录,随后 使用最近记录。
max_charsNo每个返回行允许显示的最大字符数;必须为正数。超出 部分只在响应中裁切,不改变已保存文本或行坐标。
line_rangeNo行坐标 ``start:stop``,与切片同形;两端都含, ``:`` 是整条流。

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.4.0
    • changedInput schema / properties / line_range / description
      Previous value: -"``start:stop`` 行范围;已确定需要完整消费所选流时省略,\n工具会一次返回全部行,无需拆分为多个小范围。"New value: +"行坐标 ``start:stop``,与切片同形;两端都含,\n``:`` 是整条流。"
  2. Addedv0.1.13

TDQS

A3.7/5.0
Behavior3/5

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

There are no annotations, so the description must disclose the tool's behavior in full, and it does disclose the valid stream values, the inclusive-endpoint slicing, how negative indices are counted from the end, and the fact that the whole selected range is returned in a single call rather than in chunks. It omits important behavior: whether line numbers appear in the response, the shape of the output, the limits on how much can be returned, and whether the tool requires permissions or errors out when the execution is missing.

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 front-loaded with a one-line purpose, then split into clearly headed sections for stream selection and line coordinates. The line-coordinate section is long, but every sentence carries the coordinate semantics, and the examples prevent misuse.

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 four-parameter read tool with no annotations and no output schema, the description covers how to select the execution and the stream, the line-range grammar, and the max_chars truncation rule. It does not describe what the response itself looks like, nor what happens when the execution is invalid, so a small gap remains in understanding the input, but not enough to affect the decision to call.

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 100%, so a baseline of 3 would be acceptable, but the description goes well beyond the schema for the most error-prone parameter: line_range. It gives concrete examples (:10, -10:, 2:4, 3:3), clarifies that both endpoints are inclusive, and specifically corrects the common mistake that :-3 means 'drop the last three lines' rather than 'up to and including the third-from-last line'. This adds real meaning.

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 first line states a concrete verb and resource: read the specified output stream of an execution, and it enumerates the five valid streams (combined/stdout/stderr/result/traceback), so the agent understands what is returned. It does not explain how this differs from the sibling tool search_output, so the agent is left to infer the split between reading a range and searching.

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 says the ``execution`` argument is resolved by the same rules as ``execution_status``, and it documents the fallback from current record to most recent record, which implies how to call the tool. However, it gives no explicit guidance on when to use this tool rather than search_output, run_cell, or execution_status, and it states no exclusions or prerequisites.

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