Skip to main content
Glama

Agent Cost Log

log_costs

Log what your agent's model and tool calls cost, then get the running total for the run and for today. Pass events (one per call, up to 500) or an OpenTelemetry OTLP/JSON trace export as otel (gen_ai.usage.input_tokens / output_tokens / gen_ai.request.model are read; trace id becomes run_id). Give cost_usd per call, or tokens plus your own per-million prices; nothing is guessed. Optional caps: run_cap_usd and daily_cap_usd. Free watch-only returns would_alert when a cap is crossed; Pro posts one alert per day to alert_webhook. Never blocks or changes your agent.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
otelNoOTLP/JSON export: { resourceSpans: [...] }.
eventsNo
run_idNoStable id for this run (default "default").
run_cap_usdNo
alert_webhookNohttps URL Pro posts the cap alert to.
daily_cap_usdNo
price_in_per_mNoDefault input USD per 1M tokens for events without cost_usd.
price_out_per_mNoDefault output USD per 1M tokens.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A3.8/5.0
Behavior4/5

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

With no annotations, the description carries the full burden and does well: it discloses the 500-event limit, free (watch-only, would_alert) vs Pro (single daily webhook alert) behavior, and that it "never blocks or changes your agent." It stops short of stating idempotency, retention, or auth requirements, which is a real gap for a write-accepting endpoint.

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?

Dense but front-loaded: purpose first, then input modes, then caps/alerts, then the non-blocking guarantee. Nearly every clause adds information, though the single wall-of-text paragraph makes predicates like the OTel field mapping easy to skim past.

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 an 8-parameter, nested-object tool with no annotations and no output schema, the description covers input modes, caps, alerting tiers, and top-level return values. It leaves return shape (beyond would_alert and totals) and error/permission behavior unstated, but is otherwise sufficient to call correctly.

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 only 63%, and the description compensates meaningfully: it maps OTel attributes to outputs (gen_ai.usage.input_tokens/output_tokens/gen_ai.request.model read; trace id becomes run_id), clarifies cost_usd vs tokens+prices ("nothing is guessed"), and labels run_cap_usd/daily_cap_usd as optional caps. The nested otel object and the missing alert_webhook semantics keep it below a 5.

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?

Specific verb+resource ("Log what your agent's model and tool calls cost") plus the side effect of returning running totals for the run and today. It is clearly distinguishable in function from a pure reporting tool, but it never names cost_report or the other siblings, so sibling differentiation is left to inference.

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?

The description explains two input modes (events vs otel) and details cap/alert behavior, which implies when to reach for this tool. However, it gives no explicit when-to-use-this-vs-cost_report guidance or prerequisites, so the agent must infer the boundary from names alone.

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