Skip to main content
Glama

gemini_token_usage

Read-only

Track cumulative token usage and estimated USD cost for Gemini generations. Call before and after a workflow or generation to measure spend, with optional reset for bracketing.

Instructions

Token usage for this session so far — what every generation has cost in tokens, added up. Call it before and after a workflow and subtract to get that workflow's cost; call it after a single generation for that call's. Reports tokens AND an estimated USD cost, priced per call against each call's own model and stamped with the date its rates were read (override with GEMINI_RATE_CARD). Note there is no account-balance endpoint to query — Google Cloud is post-paid and its billing data lags by hours — so this is the accurate way to attribute spend to a call.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
resetNoZero the running total after reporting it, so the next call measures from here. Use it to bracket a workflow without arithmetic.

Schema Changelog

Changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. Addedv1.11.1

TDQS

A4.9/5.0
Behavior5/5

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

Beyond the readOnlyHint annotation, the description discloses that the tool accumulates session-wide totals, supports resetting the running total, estimates USD cost using each call's own model and rate-card date, and honors the GEMINI_RATE_CARD override. It also explains the external billing constraint that motivates the tool's design. The description is fully consistent with the readOnlyHint.

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

Conciseness5/5

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

Every sentence earns its place: the first defines what the tool reports, the second covers the two main invocation patterns, the third explains the cost/rate-card behavior, and the fourth justifies why no account-balance endpoint exists. It is dense but not verbose, with the core purpose front-loaded.

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

Completeness5/5

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

Even without an output schema, the description adequately tells the agent what the tool returns (tokens plus estimated USD cost), how to interpret it, how to use reset, and what limitations apply. Given the tool's simple one-parameter interface, this is sufficient for correct selection and invocation.

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

Parameters4/5

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

The schema already documents the reset parameter at 100% coverage, so the baseline is 3, but the description adds real interpretive value by explaining that reset zeros the total after reporting and lets you bracket a workflow without arithmetic. This goes beyond the schema's literal parameter description.

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

Purpose5/5

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

The description clearly identifies the tool as a cumulative token-usage and cost reporter for the current session, with a specific verb implied by 'Call it' and 'Reports.' It is easily distinguished from the sibling generation, file, and model tools because it is the only one concerned with measuring spend rather than producing content.

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

Usage Guidelines5/5

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

The description gives explicit usage patterns: call before and after a workflow and subtract, or call after a single generation to get that call's cost. It also explains why this tool is necessary by noting there is no account-balance endpoint and that Google Cloud billing data lags, making this the accurate way to attribute spend.

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

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/chrischall/gemini-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server