tokens_count
Counts tokens under an OpenAI-compatible (tiktoken) encoding. Provide exactly one of model (e.g. "gpt-4o") or encoding ("o200k_base" or "cl100k_base"). No Claude/Anthropic tokenizer.
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": "tokens_count"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| text | Yes | ||
| model | No | e.g. gpt-4o; exactly one of model/encoding | |
| encoding | No | o200k_base or cl100k_base; exactly one of model/encoding |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| tokens | Yes | ||
| encoding | No |