Skip to main content
Glama

Get Api Key Usage

get_api_key_usage
Read-only

Retrieve cost, request, and error metrics for one API key over a chosen time window, optionally grouped by day, hour, job type, or model.

Instructions

Get one API key's cost, requests and errors over a time window. Without key_id: the key this connection uses, which works with any key; another key needs an ADMIN key.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "get_api_key_usage"
  }
}

Input Schema

NameRequiredDescriptionDefault
key_idNoThe key's id; leave out for the key this connection uses
to_dateNoStart or end of the window, YYYY-MM-DD (or YYYY-MM-DDTHH:MM). Optional
group_byNoSplit the figures by day, hour, job type or model. Optional
from_dateNoStart or end of the window, YYYY-MM-DD (or YYYY-MM-DDTHH:MM). Optional

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.8.0

TDQS

A3.8/5.0
Behavior3/5

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

Annotations already declare readOnlyHint=true and openWorldHint=true, so safety is largely covered. The description does add genuinely non-obvious behavioral context: the privilege requirement (ADMIN key) for inspecting other keys and the default scoping of key_id to the current connection. It says nothing about rate limits, pagination, or how cost/error figures are aggregated, so this is a solid but not rich addition.

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?

Two tight sentences with no filler; the core action and metrics come first, and the scoping/auth caveat follows. Every clause carries information an agent needs before invoking.

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, zero-required-parameter metrics tool with a full schema and an output schema, the definition covers purpose, default scope, and the authorization wrinkle. The only omission worth noting is how to interpret group_by splits versus the top-level totals, which the description leaves entirely to the schema.

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%, so all four parameters are already documented and the baseline is 3. The description reinforces the key_id default and adds the privilege constraint that the schema omits, but it adds nothing about from_date/to_date interplay or what group_by values produce.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb (Get) and resource (one API key's usage) plus the exact metrics returned: cost, requests and errors over a time window. The phrase "one API key's" implicitly contrasts with account-wide usage, though no sibling tool is named to make the boundary explicit.

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?

Gives clear conditional guidance: with no key_id it reports the connection's own key, and querying a different key requires an ADMIN key. That covers the main selection decision, but it never points to the account-level or listing alternatives an agent might actually want.

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