optimize_flow
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
| Name | Required | Description | Default |
|---|---|---|---|
| flow_id | Yes | The unique identifier of the flow to analyze. | |
| language | No | Response language: 'en' (default) or 'ko'. | |
| include_llm_analysis | No | If true, supplement rule-engine findings with Haiku LLM analysis. Defaults to false (rule-engine only, ~50ms). Adds ~0.5–1s latency when enabled. |