Skip to main content
Glama

Receipts: Get session receipt

metrecept_get_session_receipt

Retrieves one signed, aggregated receipt for a session, covering every chat completion, web fetch and API call tagged with that session_id, plus totals, timestamps and a verify_url anyone can check in a browser.

Instructions

Get one signed, aggregated receipt for a session: every chat completion, web fetch and API call tagged with the same session_id, with event count, total billed USD, cache hits/misses, fetch and API counts, first/last timestamps, the compact JWS and a verify_url. Use it at the end of an agent run and put verify_url in the PR, ticket or email the run produced; anyone can verify it in a browser, no account needed. Not for a public savings snapshot: use metrecept_publish_savings_receipt. Not for tenant totals: use metrecept_get_usage. Read-only, makes no upstream call, not billed. An unknown id returns event_count 0, not an error. Requires a Metrecept API key (METRECEPT_API_KEY env on stdio, or Authorization: Bearer on remote HTTP); results are scoped to that key's tenant only.

Input Schema

NameRequiredDescriptionDefault
session_idYesThe same session_id passed on the tagged chat, fetch and API calls.

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.3.1
    • addedInput schema / properties / session_id / description
      Added value: +"The same session_id passed on the tagged chat, fetch and API calls."
  2. Addedv0.1.4

TDQS

A4.6/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: read-only, no upstream call, not billed, tenant-scoped by API key, and the non-obvious error semantics that an unknown id returns event_count 0 rather than an error. Auth mechanics for both stdio and remote HTTP are spelled out.

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?

Front-loaded with purpose and payload contents, then usage, then exclusions, then operational facts — a logical order with no filler sentences. It is on the long side for a single-parameter read and the enumerated receipt fields partially duplicate the output schema, costing a point.

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?

Given a single required parameter plus an output schema, everything an agent needs is present: what comes back in prose, auth requirements, tenant scoping, billing/upstream side effects, and empty-result behavior. Nothing material is left to guesswork.

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 100% and the session_id schema description already says it must match the id used on tagged calls, so the description's restatement adds little. It does contribute the useful behavioral note that an unrecognized session_id yields event_count 0, but no format or validation detail beyond the schema.

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 ('Get one signed, aggregated receipt for a session') and enumerates exactly what it aggregates (chat completions, web fetches, API calls sharing a session_id). It is immediately distinguishable from metrecept_publish_savings_receipt, metrecept_get_usage and metrecept_mint_receipt through explicit exclusions.

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 a concrete trigger ('at the end of an agent run') plus the follow-through action (put verify_url in the PR, ticket or email), and names two alternatives with the conditions that select them: publish_savings_receipt for public snapshots, get_usage for tenant totals. No inference required.

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