Skip to main content
Glama

agentlens_log_llm_call

Log an LLM call's request and response to an AgentLens session. Provides token usage, cost, latency, and model parameters for observability.

Instructions

Log a complete LLM call (request + response) to an active AgentLens session. Emits paired llm_call and llm_response events.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sessionIdYesSession ID from agentlens_session_start
providerYesLLM provider name (e.g., "anthropic", "openai", "google")
modelYesModel identifier (e.g., "claude-opus-4-6", "gpt-4o")
messagesYesThe prompt messages sent to the model
systemPromptNoSystem prompt (if separate from messages)
completionYesThe completion content returned by the model
toolCallsNoTool calls requested by the model
finishReasonYesStop reason (e.g., "stop", "length", "tool_use", "content_filter", "error")
usageYesToken usage counts
costUsdYesCost of this call in USD
latencyMsYesLatency in milliseconds
parametersNoModel parameters (temperature, maxTokens, etc.)
toolsNoTool/function definitions provided to the model
Behavior2/5

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

With no annotations provided, the description carries the full burden of disclosing behavior. It mentions 'emits paired events' but does not describe side effects (e.g., mutating the session), required permissions, error states, or whether it overwrites or appends data. The mutation is implied but not explicit.

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 a single, front-loaded sentence of 18 words. Every word is necessary and no space is wasted. It is well-structured for quick understanding.

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

Completeness2/5

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

Given the tool's complexity (13 parameters, 9 required, nested objects, no output schema), the description is too brief. It fails to mention required parameters, usage patterns, or any caveats about the session state. A more detailed description is needed to guide correct invocation.

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 the baseline is 3. The description does not add additional meaning beyond what the schema already provides. It does not explain relationships between parameters (e.g., messages vs systemPrompt) or provide examples. The description adds no extra semantic value.

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 specifies the verb ('Log') and the resource ('complete LLM call'), and mentions the emitted events ('llm_call and llm_response'). It distinguishes itself from sibling tools like agentlens_log_event, which logs generic events, making it obvious when to use this tool.

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 does not provide any guidance on when to use this tool versus alternatives, such as agentlens_log_event. It also fails to specify prerequisites (e.g., requiring an active session from agentlens_session_start) or when not to use it.

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/agentkitai/agentlens'

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