Skip to main content
Glama

get_session_analytics

Read-onlyIdempotent

Analyze AI agent session logs to reveal token usage, cost by tool/server, top files, and models. Parses Claude Code JSONL logs automatically for read-only insights.

Instructions

Analyze AI agent session logs: token usage, cost breakdown by tool/server, top files, models used. Parses Claude Code JSONL logs automatically. Read-only. For waste detection use get_optimization_report; for cost trends use get_usage_trends. Returns JSON: { sessions, tokens, cost_usd, tools, models, topFiles }.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
periodNoTime period (default: week)
session_idNoSpecific session ID to analyze

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv3.22.0
    • removedInput schema / required
      Removed value: -[
      -  "session_id"
      -]
  2. Changed1 schema field changedv3.3.0
    • removedInput schema / $schema
      Removed value: -"http://json-schema.org/draft-07/schema#"
  3. Addedv1.41.0
  4. Removedv1.38.0
  5. Changed2 schema fields changedv1.35.1
    • removedInput schema / additionalProperties
      Removed value: -false
    • addedInput schema / required
      Added value: +[
      +  "session_id"
      +]
  6. First observedv0.1.0

TDQS

A4.4/5.0
Behavior4/5

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

Annotations already mark it read-only and idempotent; the description adds beyond that by noting it 'Parses Claude Code JSONL logs automatically' and specifies the exact return shape. It does not over-disclose or contradict annotations.

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?

Four short, information-dense sentences. The main action is first, then a behavioral note, then alternative routing, then the return format. No filler or repetition.

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?

For a read-only analytics tool with no output schema, the description compensates by stating the return JSON structure and parsing behavior. It lacks explicit prerequisites like 'log files must exist,' but the parameters and routing are sufficiently covered.

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%, with both 'period' and 'session_id' described in the schema. The description does not add parameter-specific semantics, but the schema fully covers it, so a 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?

The description uses a specific verb ('Analyze') with a clear resource ('AI agent session logs') and enumerates the concrete outputs (token usage, cost breakdown, top files, models). It also distinguishes itself from sibling tools by naming what it is not for.

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?

Explicitly states when to use alternatives: 'For waste detection use get_optimization_report; for cost trends use get_usage_trends.' This gives clear routing guidance and prevents mis-selection.

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