Skip to main content
Glama
itential

Itential MCP Server

Official
by itential

Get Agent Session Token Usage

get_agent_session_token_usage
Read-onlyIdempotent

List per-session token usage for a single agent, sorted chronologically, to inspect usage over time. Include failed sessions to see consumed tokens.

Instructions

List per-session token usage for a single agent, sorted chronologically.

Fetches agent sessions filtered to the given agent name and returns one row per matching session (no aggregation), useful for time-series inspection of an agent's usage. Only COMPLETE sessions are included by default — see include_failed to also include FAILED sessions. Sessions that failed before an execution-engine session ID was assigned are not included.

Input Schema

NameRequiredDescriptionDefault
agent_nameYesFilter to agent names containing this substring (case-insensitive)
started_afterNoISO 8601 timestamp — only include sessions started at or after this time
include_failedNoBy default only COMPLETE sessions count toward usage (finished, billable work). Set true to also include FAILED sessions, which can still have consumed real tokens. Non-terminal statuses (PENDING, RUNNING, PAUSED, ...) are always excluded either way, since their totals aren't final.
started_beforeNoISO 8601 timestamp — only include sessions started at or before this time

Output Schema

NameRequiredDescriptionDefault
resultYesResponse model for the per-session agent token usage endpoint. Wraps a list of AgentSessionTokenUsageElement objects for a single agent, sorted by started_at ascending. Attributes: root: List of AgentSessionTokenUsageElement objects with per-session token usage and timing metadata.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.13.3

TDQS

A4.1/5.0
Behavior4/5

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

Annotations already declare readOnlyHint, idempotentHint and openWorldHint=false, so the safety profile is covered. The description adds genuinely useful behavioral detail beyond that: only COMPLETE sessions count by default, FAILED sessions are opt-in via include_failed, and sessions that failed before an execution-engine session ID was assigned are silently excluded. The silent-exclusion caveat is exactly the kind of context annotations can't carry.

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?

Four short sentences, front-loaded with the operation and its granularity, then defaults and the edge-case exclusion. Every sentence carries information; minor redundancy between 'Only COMPLETE sessions are included by default' and the schema's include_failed description.

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?

With an output schema present, return values need no explanation, and the description covers filtering, default status inclusion, the opt-in flag, and an important exclusion caveat. The only small gap is that 'sorted chronologically' doesn't specify ascending vs descending, which matters for a time-series listing.

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 coverage is 100%, so the baseline is 3. The prose still adds meaning: it clarifies that the agent_name filter is a substring match scoped to a single agent, that results are chronological, and it expands on the include_failed semantics (FAILED sessions can still have consumed real tokens) beyond the schema's wording.

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 ('List per-session token usage for a single agent') plus granularity ('one row per matching session (no aggregation)'), which implicitly separates it from the aggregate sibling get_agent_token_usage. An agent can tell what this returns without opening the schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It offers a use case ('useful for time-series inspection of an agent's usage') and explains the include_failed toggle, which implies when to use it. However, it never names an alternative tool (e.g. get_agent_token_usage for totals, describe_session_token_usage for a single session), so routing is left to inference.

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

Deploy Server

Other Tools