count_tokens
Estimate token counts for text or files before running local agents or summaries, so you can check if input fits within the model context limit.
Instructions
Estimate token counts for text/files (chars/4 heuristic — ±20% vs a real tokenizer; for input sizing, not billing). Use before run_local_agent/summarize to check fit vs num_ctx.
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": "count_tokens"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| glob | No | Glob pattern, e.g. 'src/**/*.ts' | |
| path | No | Single file path (read server-side — never enters your context) | |
| text | No | Inline text instead of files | |
| paths | No | Multiple file paths |