Skip to main content
Glama

get_cost_totals

Reads the total LLM cost, tokens and requests of the workspace, or of one pipeline, over a date range.

Instructions

Reads the total LLM cost, tokens and requests of the workspace, or of one pipeline, over a date range.

Use this to answer how much a workspace or pipeline spent on LLM calls. Costs are in USD. Without dates the range is the last 30 days. start_date is inclusive and end_date exclusive, so for September 2026 pass 2026-09-01T00:00:00Z and 2026-10-01T00:00:00Z.

Check is_cost_complete before reporting total_cost. When it is false, total_cost is a lower bound, not the final figure: say so, and name the models in unpriced_models (LLM calls with no price on file) and mention pending_generation_count (calls whose cost is still being calculated, which usually clears within a minute). total_requests counts queries, not individual LLM calls; one query can make several LLM calls. :param pipeline_name: Restrict to this pipeline. Omit for the whole workspace. Needs Pipelines read as well as Costs read. :param start_date: Inclusive start as an ISO timestamp. Defaults to 30 days before end_date. :param end_date: Exclusive end as an ISO timestamp. Defaults to no upper bound. :returns: The cost totals, or an error message.

The output is automatically stored and can be referenced in other functions. Returns a formatted preview with an object ID (e.g., @obj_123). Use the object store tools in combination with the object ID to view nested properties of the object. Use the returned object ID to pass this result to other functions.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
end_dateNo
start_dateNo
pipeline_nameNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.1.31

TDQS

A4.7/5.0
Behavior5/5

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

With no annotations, the description carries the full burden and does so richly: it warns that total_cost may be a lower bound when is_cost_complete is false, explains unpriced_models and pending_generation_count (clearing within a minute), and notes total_requests counts queries not LLM calls. It also surfaces the required read permissions for the pipeline scope.

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?

Dense and front-loaded with the core purpose, semantics, and caveats in the critical first lines. The closing object-store paragraph is somewhat boilerplate and repeated ('object ID' several times), but the informational paragraphs largely earn their place.

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?

Despite having no output schema, the description explains the return path: a formatted preview with an object ID, that the output is auto-stored and referenceable, and that object-store tools can inspect nested properties. Combined with the cost caveats, an agent has everything needed to call and interpret it.

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

Parameters5/5

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

Schema coverage is 0%, so the description must compensate and it does: pipeline_name (restrict to pipeline, omit for workspace, permission requirement), start_date (inclusive ISO timestamp, defaults to 30 days before end_date), and end_date (exclusive, defaults to no upper bound), reinforced by a concrete September 2026 example.

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?

States a specific verb and resource ('Reads the total LLM cost, tokens and requests') plus the scope ('of the workspace, or of one pipeline, over a date range'). This is distinguishable from implicit siblings like get_cost_breakdown and get_cost_over_time by naming 'totals'.

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

Usage Guidelines4/5

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

Explicitly frames the use case ('Use this to answer how much a workspace or pipeline spent on LLM calls') and clarifies cost units (USD) and the workspace-vs-pipeline selection via pipeline_name. It does not name the alternative cost tools, so it stops short of full 5-level routing guidance.

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

Deploy Server

Other Tools