Skip to main content
Glama

Gemini Count Tokens Tool

gemini_count_tokens_tool
Read-only

Counts 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.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
modelNoModel to count tokens for.flash
contentYesThe text content to count tokens for.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.3.0

TDQS

B3.2/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

readOnlyHint=true already tells the agent this is a safe read operation. The description adds nothing beyond that – no info on rate limits, model selection behavior, or output format. With annotations covering the safety profile, this is marginal.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

One short sentence, front-loaded and efficient. No wasted words, though also no structure beyond the single clause.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Output schema exists so return values needn't be explained. But for a tool with a model parameter and 100% schema coverage, the description should at least mention model impact or usage context. It's minimally adequate but leaves gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so both parameters are documented in the schema itself. The description doesn't add any semantic detail about model defaults or content format beyond what's in the schema. Baseline 3 when schema does the work.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource: counting tokens in content. It's clear what the tool does, though it doesn't differentiate from siblings (all Gemini tools, none doing token counting) – but the purpose itself is unambiguous.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this versus alternatives, which model to pick, or what happens with different models. An agent has to infer usage from the name and parameters alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.