Skip to main content
Glama

Query attributed spend

get_spend

Query local receipt ledger to get AI usage cost aggregated by any dimension (provider, model, route, customer) within an optional time range. Returns USD totals per group and flags unresolvable pricing count.

Instructions

Query Inferrail's local receipt ledger, aggregated by a dimension (provider, model, route, or any business attribute name such as 'customer' or 'agent'), optionally restricted to a time window. Returns known cost in USD (as a decimal string, never a float) per group, plus a count of requests whose pricing was unresolvable -- those are never silently folded into the cost total as zero. Reads a local file only; makes no network call and cannot incur provider cost.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
byNocustomer
sinceNo
untilNo
receipts_pathNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.4.5

TDQS

A4.4/5.0
Behavior5/5

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

With no annotations, the description fully carries the behavioral burden. It explicitly states it reads a local file, makes no network call, cannot incur provider cost, returns cost as a decimal string (never a float), and does not silently fold unresolvable pricing into zero. This is highly transparent about side effects and return format.

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?

The description is two sentences, front-loaded with the primary purpose and then adding essential behavioral details. There is no redundancy or filler; every sentence contributes value.

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

Completeness4/5

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

Given the tool has 4 parameters, 0% schema coverage, and no annotations, the description does a good job of covering purpose, behavior, and parameter meanings. It lacks explicit parameter-level details like date formats or file path defaults, but the presence of an output schema and the clarity of the description make it sufficient for an agent to call correctly.

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 0%, so the description must compensate. It explains the 'by' parameter as an aggregation dimension with examples (provider, model, route, customer, agent) and the time window via 'since' and 'until'. However, it does not explicitly explain 'receipts_path' (though it implies a local file), nor does it mention defaults or date formats. The description covers the core semantics but leaves some details to inference.

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 states the tool's purpose: it queries the local receipt ledger, aggregates by a dimension (provider, model, route, or business attribute), and optionally restricts to a time window. This is a specific verb and resource, and it is distinct from the sibling get_health, which presumably checks health rather than spend.

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?

The description gives clear context about when to use the tool (e.g., it reads a local file only, makes no network call, cannot incur provider cost), but it does not explicitly mention alternatives or when not to use it. The sibling get_health implies a different purpose, but no direct exclusion is stated.

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