Skip to main content
Glama

log_model_call

Record each AI model invocation to track usage metrics, token counts, latency, and debug interactions.

Instructions

Log a model call for tracking AI usage metrics. Call this after each model invocation to record the interaction.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
safetyNoSafety check results
userIdNoOptional user identifier
metricsNoCustom metrics (key-value pairs)
projectYesProject identifier
traceIdNoDistributed tracing ID
tokensInNoNumber of input tokens
latencyMsNoLatency of the call in milliseconds
modelNameYesName of the model used (e.g., gpt-4, claude-3-opus)
requestIdNoRequest ID from the model provider
sessionIdNoOptional session identifier for grouping related calls
tokensOutNoNumber of output tokens
promptTypeNoType of prompt (chat, rag, tool, agent)
environmentNoEnvironment (dev, staging, prod)dev
modelVersionNoVersion of the model
inputMessagesYesInput messages sent to the model
outputMessagesYesOutput messages from the model
retrievedContextNoRetrieved context for RAG prompts

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A3.7/5.0
Behavior3/5

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

With no annotations provided, the description carries the full behavioral burden. It adds genuine value by specifying invocation timing (after every model invocation), but says nothing about idempotency, whether duplicate calls are deduplicated, permission requirements, or what happens if logging fails.

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 short sentences with the purpose front-loaded and the usage trigger immediately after. Zero filler; every sentence earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The tool is complex (17 params, nested objects) with no output schema and no annotations, so the description should carry behavioral context. It states purpose and timing but omits idempotency, failure semantics, and how logged data is consumed, leaving meaningful gaps despite the thorough 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% across all 17 parameters, so the schema fully documents each field including nested message structures. The description adds no parameter-level meaning beyond that, making the baseline 3 correct.

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 and resource ('Log a model call for tracking AI usage metrics'), which is unambiguous and clearly a write operation in contrast to the read-oriented siblings (search_model_calls, get_aggregate_metrics). It does not explicitly name or differentiate from those siblings, so it stops short of a 5.

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?

'Call this after each model invocation to record the interaction' gives a clear, actionable trigger condition for the agent. There is no mention of when NOT to call it, no alternative tooling, and no note on failure handling, so it lacks the exclusions a 5 would require.

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