count_tokens_file
Count tokens in a UTF-8 file using model-specific tokenizers, with optional model or encoding name for accurate token counts.
Instructions
Count tokens in a UTF-8 file.
Args:
file_path: Absolute path to the file.
model: Model or encoding name. Empty uses ANTHROPIC_TOKEN_COUNT_MODEL.
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": {
"file_path": "<file_path>"
},
"name": "count_tokens_file"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| model | No | ||
| file_path | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |