Skip to main content
Glama

Get Session Stats

get_session_stats
Read-onlyIdempotent

Analyze a single conversation session to get detailed trace statistics: span count, services involved, time bounds, LLM success and error counts, latency percentiles, and token usage.

Instructions

Get detailed statistics for a single conversation/session.

Analyzes span count, distinct services, time bounds, LLM request/success/ error counts, latency percentiles, and token usage for every span sharing the given gen_ai.conversation.id.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoMaximum spans to analyze (default: 1000)
end_timeNoEnd time in ISO 8601 format
start_timeNoStart time in ISO 8601 format (e.g., 2024-01-01T00:00:00Z)
service_nameNoFilter by service name
conversation_idYesThe gen_ai.conversation.id to analyze

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed5 schema fields changedv0.11.0
    • addedInput schema / properties / conversation_id / description
      Added value: +"The gen_ai.conversation.id to analyze"
    • addedInput schema / properties / end_time / description
      Added value: +"End time in ISO 8601 format"
    • addedInput schema / properties / limit / description
      Added value: +"Maximum spans to analyze (default: 1000)"
    • addedInput schema / properties / service_name / description
      Added value: +"Filter by service name"
    • addedInput schema / properties / start_time / description
      Added value: +"Start time in ISO 8601 format (e.g., 2024-01-01T00:00:00Z)"
  2. Addedv0.5.0

TDQS

A4.3/5.0
Behavior4/5

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

Annotations already declare read-only, idempoten, and non-destructive behavior, and the description does not contradict them. The description adds useful behavioral detail: it aggregates over every span sharing the conversation ID and lists the statistical categories it produces.

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 first sentence is a crisp front-loaded summary, and the second paragraph is a dense but relevant enumeration of the computed metrics. There is no filler or repetition of schema details.

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?

Combined with the full input schema, output schema, and annotations, the description covers scope, filtering, and the metrics computed. An agent can invoke it with just conversation_id and know what is included; no critical behavior is omitted.

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%, and every paramter already has a clear description. The tool description adds no extra parameter-level detail, so the baseline of 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?

The description uses a specific verb-plus-resource pattern ('Get detailed statistics for a single conversation/session') and then lists the exact computed metrics. This clearly differentiates it from sibling search/list/compare tools, which operate over multiple sessions or traces.

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?

It gives clear scope: one conversation/session identified by gen_ai.conversation.id. It doesn't explicitly name alternatives or state when-not-to-use, but the single-session framing and metric detail tell an agent when this is the right tool.

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