tac
Reverse lines in a file or stdin, outputting the last line first. Useful for LIFO processing or inverting line order.
Instructions
Reverse the order of input lines (last line first). Read-only, no side effects. Returns JSON with reversed lines by default; use --raw for plain output. Use to invert line order for LIFO processing. Not for sorting — use 'sort --reverse' for reverse-sorted order. See also 'sort', 'cat'.
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": "tac"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| raw | No | Write reversed text without a JSON envelope. | |
| paths | No | Files to reverse, or '-' for stdin. Defaults to stdin. | |
| encoding | No | Text encoding (default: utf-8). Use 'auto' for BOM/autodetection. | utf-8 |
| max_lines | No | Maximum JSON lines to emit. | |
| show_encoding | No | Include encoding detection metadata in JSON result. | |
| encoding_errors | No | How to handle encoding errors (default: replace). | replace |
| encoding_profile | No | Locale-aware encoding fallback profile for auto-detection. |