gemini_count_tokens
Count tokens in text using a Gemini model to estimate API usage and costs.
Instructions
Count the number of tokens in the provided text using a Gemini 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": {
"text": "<text>"
},
"name": "gemini_count_tokens"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| text | Yes | The text to count tokens for | |
| model | No | Model to use (default: gemini-3.1-pro-preview) |