Skip to main content
Glama

tail

Poll a background job's recent stdout, stderr, or merged output without re-reading lines already seen. Returns the last N events plus dropped-loss and truncation signals.

Instructions

Get the most recent output a background job has produced, for polling without re-reading everything already seen. Returns the last N real events of stdout, stderr, or both (merged in real line-materialization order, default). Once a selected stream has lost some of its own history - either under its own byte/line window cap while the job is still running, or because the job finished and its output later became eligible for job-output retention (see GHANTIKA_JOB_RETENTION_MS/GHANTIKA_MAX_RETAINED_JOBS) - the response discloses a bounded "dropped" count for that stream plus "droppedBeforeCursor" (the lowest seq still retained, or the stream's highest-ever-assigned seq - possibly 0 if no line was ever materialized - when nothing survives) - never which specific lines were lost, and never which of the two causes applied. "dropped" is ordinarily a count of complete lines, but it also counts two narrower events the same way: a not-yet-newline-terminated fragment discarded on reclaim, and a chunk arriving for a stream after its job is already reclaimed - neither is a materialized line, but each is real, permanent loss, so both count too rather than leaving the stream falsely indistinguishable from one that never received anything. For stream:"stdout"/"stderr" this is a scalar pair at the top level; for stream:"both" it is a nested object keyed by stream ({stdout?:{...}, stderr?:{...}}), since each stream's own loss is independent. Three distinct signals, never conflate them: "dropped" means this stream lost something forever; "truncated" means this specific call's own response window (from lines being smaller than what is available, or from that same loss) does not contain everything currently available; "next_cursor" is simply where to resume paging - it carries no information about loss on its own.

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": {
      "job_id": "<job_id>"
    },
    "name": "tail"
  }
}

Input Schema

NameRequiredDescriptionDefault
linesNoHow many of the most recent real output events to return (a positive integer). Defaults to 100. If more than are available, all available events are returned.
job_idYesThe job id returned by a prior run call.
streamNoWhich stream to read. Defaults to "both" (merged in real line-materialization order; see output's docs for the exact merge scheme).

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.2/5.0
Behavior5/5

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

With no annotations, the description carries the full burden and does so thoroughly: it explains that dropped counts are bounded and anonymous, that retention can cause loss, that truncated is response-window-specific, and that next_cursor conveys no loss signal. It also discloses per-stream independent loss and the nested vs scalar dropped shape.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The first two sentences front-load purpose and return shape well, but the middle is an extremely dense, clause-heavy sentence covering retention cap rules, droppedBeforeCursor edge cases, and two narrower loss events. The content is relevant, yet the description is hard to scan and could be broken into shorter, more structured statements.

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?

Given that there are no annotations or output schema, the description does substantial work explaining return-side loss fields, truncation, cursor semantics, and per-stream structure. It still never describes the shape of an individual event item and points to 'output's docs' for the exact merge scheme, so it is not fully self-contained.

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 100%, so the input schema already defines job_id, lines, and stream. The description reinforces the 'both' merge semantics and the scalar/nested dropped output shape, but adds little input meaning beyond the schema's own stream description.

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 opening sentence names a specific verb ('Get') and resource ('most recent output a background job has produced') and states the tail/polling scope. It distinguishes this from a full re-read with 'without re-reading everything already seen.'

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?

It gives a clear polling use case and explains the default 'both' stream and last-N behavior. However, it never names a sibling such as follow or output as an alternative, nor does it state when not to use this tool.

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

Deploy Server

Other Tools