Skip to main content
Glama

optimize_flow

Read-onlyIdempotent

Analyze a flow for performance and cost optimization opportunities. Returns rule-based suggestions such as moving upscale nodes to the end of the flow, avoiding resolution overflow, removing redundant processing, and choosing better-performing models. Each suggestion carries a structured patch (move_node, insert_node, replace_model) describing the change. These are advisory: no MCP tool edits a flow's graph, so apply them by rebuilding the flow with create_flow in the corrected order, or relay them to the user for the cnaps.ai editor. update_flow changes node parameters only. Use this before running a flow or while iterating on its design. Set include_llm_analysis=true to also ask Haiku for complex-pattern refinements.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
flow_idYesThe unique identifier of the flow to analyze.
languageNoResponse language: 'en' (default) or 'ko'.
include_llm_analysisNoIf true, supplement rule-engine findings with Haiku LLM analysis. Defaults to false (rule-engine only, ~50ms). Adds ~0.5–1s latency when enabled.

TDQS

A4.9/5.0
Behavior5/5

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

Beyond the readOnly/destructive annotations, the description discloses that the tool does not edit the flow graph ('no MCP tool edits a flow's graph'), that suggestions include structured patches, and that enabling include_llm_analysis adds latency (~0.5-1s) compared to the default ~50ms rule-engine-only. This aligns with annotations and adds meaningful behavioral context.

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 appropriately sized for the tool's complexity. Each sentence adds value: purpose, examples of suggestions, advisory nature, application guidance, and optional parameter explained. It is well-structured and front-loaded.

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

Completeness5/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 sufficiently explains what to expect (rule-based suggestions and patches) and how to act on them. It references sibling tools (create_flow, update_flow) and provides enough context for an agent to decide when to use this tool and what to do with its output.

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?

The schema already covers all three parameters with descriptions (100% coverage). The description adds extra context for include_llm_analysis by explaining when to use it and its latency tradeoff, which goes beyond the schema. It also reinforces the default behavior.

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's purpose: 'Analyze a flow for performance and cost optimization opportunities' with specific examples of suggestions. It distinguishes from siblings by explicitly contrasting with update_flow ('changes node parameters only') and directing users to create_flow for applying suggestions.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicit usage guidance is provided: 'Use this before running a flow or while iterating on its design.' The description explains that suggestions are advisory and how to apply them (via create_flow or manually), and clearly distinguishes from update_flow by noting it only changes node parameters.

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.

TDQS

A4/5.0
Disambiguation5/5

Each tool targets a distinct resource and action, with clear separation between flow lifecycle, execution, model exploration, community, and account tools. Even similar-sounding tools like create_flow, preview_flow, and suggest_flow have clearly different purposes (actually creating, dry-running, and recommending models). Descriptions prevent misselection.

Naming Consistency5/5

All tools follow a consistent verb_noun pattern in snake_case (e.g., create_flow, list_flows, run_batch, cancel_flow). No mixed conventions or vague verbs like 'process' or 'handle'. The naming is uniform and predictable.

Tool Count3/5

At 33 tools, this is a large surface, but each tool addresses a distinct feature of the cnaps.ai platform, from flow CRUD and execution to community features and notifications. Still, it exceeds the typical well-scoped range and feels heavy, making it a borderline case between appropriate and too many.

Completeness3/5

The core flow lifecycle (create, read, update, delete, restore, duplicate) and execution (run, batch, cancel) are covered, but structural editing of flow graphs is missing—update_flow only changes parameters, not topology. Additionally, there is no run history, batch list/cancel, or community post update/delete, leaving notable gaps for a platform API.

Resources