Skip to main content
Glama

LLM Pricing

analyze_session_usage

Analyze one specific session's actual recorded LLM usage (tagged via record_usage's session_id) on demand: total input/output tokens, total actual cost, and a per-model breakdown if more than one model was used. Also runs the session's own observed token pattern through the same routing engine behind recommend_model / POST /router/recommend to produce a grounded recommendation — or confirm the current choice is already optimal — with the estimated dollar savings or increase versus this session's actual cost. Returns has_data: false with no recommendation if the session_id has no recorded usage. Advisory only — never switches or reroutes anything.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
org_idNoOptional organisation ID filter — scopes the lookup to usage events recorded under that org_id, same as get_usage_summary's org_id
session_idYesThe session_id previously used when calling record_usage

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.1/5.0
Behavior4/5

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

With no annotations, the description carries the full burden and largely succeeds: it discloses the edge case ('Returns has_data: false with no recommendation if the session_id has no recorded usage') and the side-effect profile ('Advisory only — never switches or reroutes anything'). It does not cover auth/permission needs or rate limits, keeping it short of a 5.

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?

The core purpose is front-loaded in the opening clause, and the parenthetical cross-references are informative rather than wasteful. It is dense for a single paragraph but every clause (data source, return shape, edge case, advisory nature) earns its place.

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?

No output schema exists, and the description compensates by explaining the return payload (tokens, cost, per-model breakdown, recommendation, savings/increase) and the no-data case. For a moderately complex analysis tool this is close to complete, lacking only permissions and pagination/format details.

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%, so both parameters are already documented, and the schema's session_id text ('previously used when calling record_usage') mirrors the description. The description adds only marginal framing ('tagged via record_usage's session_id'), so the baseline 3 is appropriate.

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+resource ('Analyze one specific session's actual recorded LLM usage') and enumerates exactly what it returns (input/output tokens, actual cost, per-model breakdown, and a grounded recommendation). It clearly distinguishes itself from siblings by naming record_usage (the data source), recommend_model (the shared engine), and get_usage_summary's org_id semantics.

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?

Establishes clear context — 'on demand' analysis of a session previously tagged via record_usage's session_id, with a cross-reference to recommend_model for the routing logic. However it stops short of explicit when-to-use/when-not-to-use rules or exclusions versus siblings like get_usage_summary.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.