Skip to main content
Glama

AI model and MCP tool calls

get_ai_usage
Read-only

Model calls by model (gen_ai spans): calls, per minute, error rate, p50 to p99, total time, input and output tokens; and MCP tool calls by tool (mcp.server spans). Prompt and completion text is never stored, so it is never here.

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_ai_usage"
  }
}

Input Schema

NameRequiredDescriptionDefault
toNoAn ISO time, or how long ago (default now)
fromNoAn ISO time, or how long ago: 30m, 24h, 7d
rangeNoWindow: 1h, 24h, 7d, 14d, 30d or 90d (default 24h). Ignored when from is given.
sourceNobackend (servers), frontend (app and web), or all (default)
releaseNoOnly this release: 2.0.77+185, 2.0.77 (every build) or package@2.0.77+185
serviceNoOnly this service, like house-ai-api or the app's bundle id
environmentNoLike production. Default: production when the app has it, else its busiest non-development one. 'all' for every environment.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedInput schema / properties / release / description
      Previous value: -"Only this release (service version)"New value: +"Only this release: 2.0.77+185, 2.0.77 (every build) or package@2.0.77+185"
  2. Added

TDQS

A3.5/5.0
Behavior4/5

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

Annotations already mark this as a safe read-only, non-destructive, non-open-world operation, so the bar is lower. The description adds meaningful behavioral context: it identifies the underlying span types (gen_ai and mcp.server) and explicitly states that prompt and completion text is never stored, clarifying a privacy-related data boundary beyond the annotations.

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?

The description is compact and front-loads the primary resource and metrics. The metric list is dense but earns its place; the closing privacy clause is useful and brief. It could be slightly more structured but contains little waste.

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 and 100% schema coverage, the description adequately explains what is measured, how it is grouped (by model and by tool), and what data is excluded. Return format details are the main omission, but the schema covers the inputs fully.

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%, so the schema fully documents all 7 parameters, including defaults and enum values for range and source. The description adds no syntax or format details beyond the schema, which is acceptable at this coverage level.

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 resource (model calls by model via gen_ai spans and MCP tool calls by tool via mcp.server spans) and enumerates the metrics returned (calls, per minute, error rate, p50-p99, total time, tokens). It is clearly distinguishable from generic analytics siblings, though it does not explicitly name an alternative.

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

Usage Guidelines2/5

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

The description explains what the tool reports but gives no when-to-use guidance, no exclusions, and no routing to alternatives such as get_analytics or get_performance_overview. An agent must infer that this is for AI model/MCP usage metrics specifically.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources