Gemini Count Tokens Tool
gemini_count_tokens_toolCounts tokens in text for a chosen Gemini model, helping you estimate prompt size and manage API limits before sending content.
Instructions
Count the number of tokens in content.
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": {
"content": "<content>"
},
"name": "gemini_count_tokens_tool"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| model | No | Model to count tokens for. | flash |
| content | Yes | The text content to count tokens for. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||