Skip to main content
Glama

LLM Pricing

import_session_usage

Bulk-import a completed session's usage in a single call — the retroactive counterpart to record_usage, for when a session wasn't instrumented live. Use when a calling agent (e.g. VS Code Copilot Chat) already has a session's turn-by-turn history in its own local store and wants this server to report on it exactly as if it had been tracked live. Accepts a list of entries under one shared session_id; each entry resolves its input and output tokens independently, either from exact counts when known or by estimating from raw turn text using this server's existing token counter. Cost is always computed server-side from current pricing, never trusted from the caller. A malformed entry (no usable tokens/text on one side, or an unresolvable model_name) is reported as its own per-entry failure and does not fail the rest of the batch. Idempotent like record_usage — resubmitting the same entries (same request_id, or the same session_id/model/occurred_at/token-or-text when request_id is omitted) is a no-op. Recorded usage is then readable via analyze_session_usage and GET /usage/session/{session_id}.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
org_idNoOptional organisation ID to attribute this usage to
entriesYesUsage entries to import, one per turn/call in the session
session_idYesShared session ID to tag every entry in this batch with

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.8/5.0
Behavior5/5

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

No annotations are provided, so the description carries the full behavioral burden and does so: server-side-only cost computation ('never trusted from the caller'), per-entry failure isolation that does not fail the batch, and detailed idempotency semantics including the derived key when request_id is omitted. These are exactly the traits an agent needs and cannot get from structured fields.

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 key routing constraint is front-loaded and every sentence carries information, but the passage is long and a couple of clauses (the read-back endpoints, batch-cap detail) could be trimmed without loss. Dense rather than padded, so a 4 rather than a 5.

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 compensates by naming exactly where the imported data becomes readable ('analyze_session_usage and GET /usage/session/{session_id}'). Idempotency, failure mode, token resolution, and cost provenance are all covered for a mutation-shaped, unannotated tool.

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?

Schema description coverage is 100%, so the baseline is 3; the description adds genuine semantic value by explaining how the two token fields interact with the two text fields (exact counts vs. estimation via the server's counter) and the shared session_id tagging of every entry. It stops short of enumerating every field, but the schema already covers those.

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 ('Bulk-import a completed session's usage in a single call') and immediately positions itself relative to a sibling ('the retroactive counterpart to record_usage'). An agent can distinguish it from record_usage without opening any schema.

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?

Gives an explicit when-to-use scenario ('when a calling agent ... already has a session's turn-by-turn history in its own local store') and names the alternative it complements (record_usage, with analyze_session_usage as the read path). Nothing is left to inference about when this tool applies versus live recording.

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.