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. Apply them with edit_flow on the same flow — replace_model maps to its replace_model op, insert_node to add_node plus the connect/disconnect that splice it in. move_node is layout only and needs no edit. Applying a suggestion never requires creating a new flow. 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.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.9/5.0
Behavior5/5

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

Annotations already indicate a read-only, non-destructive operation. The description adds meaningful integration behavior: suggestions map to specific edit_flow operations, move_node requires no edit, and include_llm_analysis triggers Haiku-based refinement. This goes beyond what annotations alone provide without contradicting them.

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 dense but efficient. The first sentence gives the purpose, followed by example suggestion types, the relationship to edit_flow, the move_node caveat, and the LLM option. No sentence is filler; all detail earns its place.

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?

There is no output schema, so the description must cover what the response contains. It does: rule-based suggestions, patch kinds (move_node, insert_node, replace_model), and how those map to edit_flow operations. It also discloses the optional Haiku pathwayable, making the tool's behavior intelligible without an output schema.

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?

Since the schema already covers parameter basics (>80% coverage), the dimension baseline is 3. The description adds value by explaining include_llm_analysis as 'also ask Haiku for complex-pattern refinements' and contextualizing flow_id as the flow to which edit_flow patches would apply. This is a meaningful but not large increment.

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 opens with a precise verb+object: 'Analyze a flow for performance and cost optimization opportunities.' It specifies the concrete output—rule-based suggestions with structured patches such as move_node, insert_node, and replace_model—which clearly distinguishes the tool's role from actually modifying a flow.

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?

The description gives explicit context: use it before running a flow or while iterating on design. It also routes how to apply suggestions by naming edit_flow and contrast with update_flow, and clarifies that no new flow creation is required. This gives the agent strong routing guidance.

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.

Resources