Skip to main content
Glama

cmd_output

Read-onlyIdempotent

Read plain-text output from a command run with line numbers, paging from a chosen line or filtering by text; check status and total lines, and call again while it is still running.

Instructions

Reads the output of one command run as plain text with line numbers (colours removed), finished or still running. Three ways: no options = the last 150 lines; fromLine (+ lines) = a window starting at that line; grep = only the lines that contain that text, with their line numbers (100 by default). The header gives the run's status and the total line count, so you can page with fromLine; at most 500 lines per call, and a very long reply is cut to the size limit. A run that is still going says so: call again for newer lines. WHEN TO USE: you need more than the last lines a cmd_* result or cmd_wait showed, such as the first compiler error or a whole test failure. To wait for the run to end use cmd_wait; to find a run id use cmd_list. An unknown run id is an error.

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": {
      "runId": "<runId>"
    },
    "name": "cmd_output"
  }
}

Input Schema

NameRequiredDescriptionDefault
grepNoOptional: plain text, not a pattern; only lines that contain it are shown, any letter case. Example: 'error CS', 'FAILED'.
guideNotrue: put the commands guide first in the result. Use on your first commands call, or when told it changed.
linesNoOptional: how many lines (default 150, or 100 with grep; 1 to 500).
runIdYesThe run number from a cmd_* result or cmd_list, for example 12.
fromLineNoOptional: first line to show (1-based). Omit for the last lines. Ignored with grep.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changedv0.2.2
    • changedInput schema / properties / fromLine / description
      Previous value: -"First line to show (1-based). Omit to show the last lines."New value: +"Optional: first line to show (1-based). Omit for the last lines. Ignored with grep."
    • changedInput schema / properties / grep / description
      Previous value: -"Only show lines that contain this text (case-insensitive)."New value: +"Optional: plain text, not a pattern; only lines that contain it are shown, any letter case. Example: 'error CS', 'FAILED'."
    • changedInput schema / properties / lines / description
      Previous value: -"How many lines (default 150, or 100 with grep; at most 500)."New value: +"Optional: how many lines (default 150, or 100 with grep; 1 to 500)."
    • changedInput schema / properties / runId / description
      Previous value: -"The run number."New value: +"The run number from a cmd_* result or cmd_list, for example 12."
  2. First observedv0.2.0

TDQS

A4.8/5.0
Behavior5/5

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

Goes well beyond readOnlyHint/idempotentHint: it discloses the 500-line cap per call, truncation to a size limit on long replies, the default windows (150 lines, 100 with grep), that the header carries status and total line count, and that a still-running run tells you to call again. These are the operational details an agent needs to page and avoid surprises.

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?

Front-loaded with the core behavior, then modes, then limits, then a separate WHEN TO USE block – easy to scan. A few figures duplicate the schema descriptions (150, 100, 1-500), which is minor redundancy but the sentences otherwise earn their place.

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

Completeness5/5

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

For a read tool with no output schema, the description explains the shape of the returned text (line numbers, header with status and total count), the paging strategy, and how to continue polling a live run. Nothing needed to invoke or interpret a call is missing.

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%, and the description still adds useful framing by grouping the parameters into three modes (no options, fromLine+lines, grep) and stating the interaction rule that fromLine is ignored with grep. Some numbers (150/100/500) are restated from the schema, so it adds framing rather than new parameter facts.

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 and resource ('Reads the output of one command run') plus the exact output format ('plain text with line numbers, colours removed'). It also names the modes and the sibling tools, so an agent can distinguish it from cmd_wait and cmd_list without opening any schema.

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

Usage Guidelines5/5

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

Contains an explicit WHEN TO USE block giving both the motivating scenario ('you need more than the last lines a cmd_* result or cmd_wait showed, such as the first compiler error') and the routing rules ('to wait for the run to end use cmd_wait; to find a run id use cmd_list'). It even states the failure condition for an unknown run id.

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