tr
Translate or delete literal characters from input using character-by-character replacement. Supports deletion and squeezing repeats, outputting JSON or plain text.
Instructions
Translate or delete literal characters from files or stdin — character-by-character replacement (NO regex). Read-only, no side effects (reads input, writes to stdout). Use --delete to remove specific characters, --squeeze to collapse repeats. Returns JSON by default; use --raw for plain output. Use for simple character mapping. Not for regex-based substitution — use 'sed' externally. Not for column extraction — use 'cut'. See also 'cut', 'expand'.
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": {
"set1": "<set1>"
},
"name": "tr"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| raw | No | Write plain transformed text to stdout. | |
| set1 | Yes | Literal source/delete character set. GNU bracket/range syntax is not expanded. | |
| set2 | No | Literal replacement character set for translation. | |
| input | No | Input text. When provided, takes priority over stdin and --path. | |
| paths | No | Input file. Repeat for multiple files. | |
| delete | No | Delete characters in SET1. | |
| 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 |
| squeeze_repeats | No | Squeeze repeated output characters. | |
| encoding_profile | No | Locale-aware encoding fallback profile for auto-detection. |