{
"name": "ct-view",
"description": "Show one file's lines by range, or the regions around a pattern with context, instead of dumping the whole file. --range A:B (1-based inclusive; also A:, :B, A) prints a span; --match PATTERN prints the windows around matching lines with --context lines on each side (overlapping windows merge, like grep -C). Read-only, no allow-gate. With --json, emits {tool, path, total_lines, shown, lines:[{n,text}], matched?}. Exit status: 0 shown, 1 if --match matched nothing, 2 on a read or usage error. --match uses substring->glob->regex promotion, searched unanchored per line. Invoke as `ct view ...` or `ct-view ...`.",
"input_schema": {
"type": "object",
"properties": {
"path": {
"type": "string",
"description": "The file to view (positional, required)."
},
"range": {
"type": "string",
"description": "Line range A:B (1-based, inclusive); also A: (to end), :B (from start), or A (one line)."
},
"match": {
"type": "string",
"description": "Show only lines matching this pattern (substring->glob->regex promoted, searched unanchored), with --context lines around each hit."
},
"context": {
"type": "integer",
"description": "Lines of context shown around each --match hit. Default: 2.",
"default": 2
},
"limit": {
"type": "integer",
"description": "Cap the number of lines emitted."
},
"plain": {
"type": "boolean",
"description": "Suppress the line-number gutter in text output."
},
"json": {
"type": "boolean",
"description": "Emit a structured JSON result instead of text."
},
"timeout": {
"type": "number",
"description": "Abort with exit 2 (and a one-line message) if the view exceeds SECS seconds (fractional allowed)."
},
"heartbeat": {
"type": "number",
"description": "Print a liveness pulse every SECS seconds (fractional allowed) while the run is in progress."
},
"heartbeat-emit": {
"type": "string",
"description": "Heartbeat line template. Tokens: {ELAPSED} (whole seconds so far) {TOOL}. Default: \"[{ELAPSED}s]\"."
},
"heartbeat-to": {
"type": "string",
"enum": ["stderr", "stdout"],
"description": "Stream heartbeat pulses are written to. Default: stderr."
}
},
"required": ["path"]
}
}