Skip to main content
Glama

agentlens_optimize

Analyzes LLM call patterns to recommend cost-saving model switches based on task complexity, with estimated monthly savings.

Instructions

Get cost optimization recommendations. Analyzes LLM call patterns and suggests cheaper model alternatives.

When to use: To identify cost-saving opportunities by switching expensive models to cheaper alternatives for tasks that don't require the most capable model. Analyzes call complexity (simple/moderate/complex) and success rates.

What it returns: A list of model switch recommendations with estimated monthly savings, confidence levels, and success rate comparisons. Sorted by potential savings.

Example: agentlens_optimize({ period: 7 }) → returns recommendations like "Switch gpt-4o → gpt-4o-mini for SIMPLE tasks, saving $89/month".

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
periodNoAnalysis period in days (default: 7, max: 90)
limitNoMax recommendations to return (default: 5, max: 50)
Behavior3/5

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

With no annotations provided, the description carries the full burden. It explains the tool analyzes patterns and returns recommendations, but doesn't explicitly state that no changes are made to the system, which could be inferred. It lacks details on authentication or rate limits, but these are less relevant for an 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 concise with clear sections: summary, when to use, what it returns, and an example. Every sentence adds value, and it is front-loaded with the main purpose.

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 no output schema, the description adequately explains the return format (list of recommendations with savings, confidence, success rate comparisons). It is complete enough for a simple analysis tool, though it could explicitly mention that no actions are taken on the system.

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?

Both parameters have descriptions in the schema (100% coverage), and the description adds an example call showing usage and expected return format, including savings, confidence levels, and success rate comparisons. This adds value beyond the schema.

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 provides cost optimization recommendations by analyzing LLM call patterns and suggesting cheaper model alternatives. This differentiates it from sibling tools like cost_budgets, which focus on budget management.

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?

The description includes a dedicated 'When to use' section that explains the tool is for identifying cost-saving opportunities by switching to cheaper models for tasks that don't require the most capable model. It provides clear context but doesn't explicitly list alternative tools or when not to use.

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