basename
Extract the final filename from a full file path, stripping directory prefixes. Optionally remove a suffix from the basename.
Instructions
Return the final path component, stripping all directory prefixes. Read-only, no side effects. Returns JSON with the stripped filename. Use to extract filenames from full paths. Not for extracting directory portions — use 'dirname' for the inverse operation. See also 'dirname', 'realpath'.
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": {
"paths": "<paths>"
},
"name": "basename"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| raw | No | Write one basename per line without a JSON envelope. | |
| paths | Yes | Paths to transform. | |
| suffix | No | Remove suffix from each basename when present. |