Skip to main content
Glama

gemini_token_usage

Read-only

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.

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.

  1. Changed1 schema field changedv2.0.0
    • changedInput schema / $schema
      Previous value: -"http://json-schema.org/draft-07/schema#"New value: +"https://json-schema.org/draft/2020-12/schema"
  2. Addedv1.11.1

TDQS

A4.6/5.0
Behavior5/5

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

Annotations only cover readOnlyHint/openWorldHint, but the description adds substantial context: it reports both tokens and estimated USD, prices each call against that call's own model, stamps the rate date, supports a GEMINI_RATE_CARD override, and explains that Google Cloud billing lags by hours so this is the accurate attribution path.

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?

Purpose is front-loaded in the first clause, and the workflow-vs-single-call guidance follows immediately. The closing sentence about billing lag is useful but slightly long; overall it stays tight with no filler.

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?

With no output schema, the description carries the burden of describing the return values, and it does: tokens plus an estimated USD cost with a rate-date stamp. It also covers the reset workflow and the billing-lag caveat, so an agent needs nothing more to call and interpret it.

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 description coverage is 100%, and the sole `reset` parameter is already fully documented in the schema ('zero the running total after reporting it'). The description hints at the subtract-before/after pattern but adds no syntax or semantics beyond what the schema provides, so the baseline 3 applies.

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 opening sentence names the exact resource (token usage for the current session) and the scope (cumulative cost of every generation so far). No sibling tool reports usage or cost, so the agent can place it unambiguously. It is a specific verb+resource statement, not a restatement of the name.

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?

It states exactly when to call it: before and after a workflow to get the delta, or after a single generation to get that call's cost. It also explains why no alternative exists ('there is no account-balance endpoint to query'), closing off the natural substitute an agent might reach for.

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