Skip to main content
Glama

get_user_stats

Read-onlyIdempotent

Retrieve per-user request and cost analytics for a specified time range. Filter by cost, tokens, status codes, or virtual keys.

Instructions

Return per-user request and cost analytics for a required time range. This is usage-by-user, not population metrics; use get_users_analytics for active-user or cohort trends. Enterprise-gated. Returns 403 on non-Enterprise Portkey plans.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cost_maxNoMaximum cost in cents to filter by
cost_minNoMinimum cost in cents to filter by
page_sizeNoNumber of results per page (max 100)
status_codeNoFilter by specific HTTP status codes (comma-separated)
virtual_keysNoFilter by specific virtual key slugs (comma-separated)
total_units_maxNoMaximum number of total tokens to filter by
total_units_minNoMinimum number of total tokens to filter by
time_of_generation_maxYesEnd time for the analytics period (ISO8601 format, e.g., '2024-02-01T00:00:00Z')
time_of_generation_minYesStart time for the analytics period (ISO8601 format, e.g., '2024-01-01T00:00:00Z')

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
okYesWhether the tool call succeeded and returned structured data
dataNoStructured success payload when ok is true
errorNoStructured error payload when ok is false
Behavior4/5

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

Annotations already declare readOnlyHint, openWorldHint, idempotentHint, and destructiveHint. The description adds valuable behavioral context not covered by annotations, such as the Enterprise-gated access (returns 403 on non-Enterprise plans) and the distinction from population metrics, which clarifies the tool's scope and limitations.

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 description is highly concise with three sentences, each serving a distinct purpose: stating the function, differentiating from a sibling, and noting access restrictions. The key information is front-loaded, with no wasted words.

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?

Given the presence of a rich input schema, annotations, and an output schema, the description provides sufficient context. It covers purpose, usage differentiation, access constraints, and required parameters. However, it could briefly mention that the output is per-user, but the high schema coverage compensates, so it is nearly complete.

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?

The input schema has 100% parameter description coverage, so the baseline is 3. The tool description mentions the required time range but does not add new semantic information beyond what is already in the schema. Hence, it provides no additional parameter insights.

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 clearly states the tool returns per-user request and cost analytics for a required time range, using specific verbs ('Return') and resource ('per-user request and cost analytics'). It also distinguishes from the sibling tool get_users_analytics by specifying 'This is usage-by-user, not population metrics'.

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?

The description explicitly tells when to use this tool (for per-user analytics) and when not to (for population metrics, use get_users_analytics). It also provides access constraint information ('Enterprise-gated. Returns 403 on non-Enterprise Portkey plans'), guiding the agent on proper usage and error handling.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/CodesWhat/portkey-admin-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server