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
| Name | Required | Description | Default |
|---|---|---|---|
| lines | No | How 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_id | Yes | The job id returned by a prior run call. | |
| stream | No | Which stream to read. Defaults to "both" (merged in real line-materialization order; see output's docs for the exact merge scheme). |