count_tokens
Count token usage for any text across supported AI models. Select a model to get exact or approximated token counts.
Instructions
Count how many tokens a piece of text would use for a given model.
Args: text: Your text/prompt to tokenize model: Model name, e.g. "claude-sonnet-5", "gpt-5". Call list_supported_models to see all options.
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": {
"text": "<text>"
},
"name": "count_tokens"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| text | Yes | ||
| model | No | claude-sonnet-5 |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |