Skip to main content
Glama

agentlens_reflect

Analyze agent session data to identify recurring errors, common tool sequences, cost drivers, and performance trends. Returns structured insights with confidence scores.

Instructions

Analyze behavioral patterns from agent sessions — error patterns, tool sequences, cost analysis, and performance trends.

When to use: To identify recurring errors and their root causes (error_patterns), to understand cost drivers and optimize model usage (cost_analysis), to discover common tool usage chains and their success rates (tool_sequences), or to track performance over time (performance_trends).

What it returns: A list of structured insights with type, summary, data, and confidence score, plus metadata about how many sessions/events were analyzed. Each analysis type returns different data shapes.

Example: agentlens_reflect({ analysis: "error_patterns", agentId: "my-agent", from: "2026-01-01" }) → returns recurring error patterns with counts, first/last seen, and affected sessions.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
analysisYesType of analysis to run: error_patterns (recurring errors), tool_sequences (common tool usage patterns), cost_analysis (cost breakdown and trends), performance_trends (success rate and duration trends)
agentIdNoFilter analysis to a specific agent
fromNoStart of time range (ISO 8601)
toNoEnd of time range (ISO 8601)
paramsNoAdditional parameters (e.g., { model: "gpt-4o" } for cost_analysis)
limitNoMaximum number of results to return (default: 20)
Behavior4/5

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

No annotations are provided, so the description carries the full burden. It describes the return value as a list of structured insights with type, summary, data, confidence score, and metadata, and gives an example. It does not discuss authorization, rate limits, or destructive actions, but the behavioral transparency is good for a non-destructive analysis tool.

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 well-structured with clear sections: overall purpose, when to use, what it returns, and an example. Every sentence adds value, and there is no redundancy or fluff.

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?

Given the complexity (6 parameters, nested objects, no output schema), the description covers the main aspects: purpose, usage guidelines, return value shape, and an example. It could mention error handling or pagination, but it is complete enough for the agent to understand and invoke the tool 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 100%, so the baseline is 3. The description adds meaning by explaining the analysis enum values with context in the 'When to use' section and providing a concrete example that shows how parameters are used together. This additional context aids understanding beyond the schema descriptions.

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 states the tool analyzes behavioral patterns from agent sessions, listing four specific analysis types (error_patterns, tool_sequences, cost_analysis, performance_trends). It distinguishes from sibling tools like agentlens_agents or agentlens_stats by focusing on reflection and patterns rather than listing agents or raw statistics.

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?

There is an explicit 'When to use' section that details use cases for each analysis type, including identifying recurring errors, understanding cost drivers, and tracking performance. It does not explicitly state when not to use the tool or mention alternatives among siblings, but the guidance is clear and context-rich.

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