Debug Power Automate Flows with MCP
What this guide covers
This guide walks through debugging a failing Power Automate flow using your AI agent and Flow Studio MCP. You will learn how to interact with your agent to check run history, read per-action error breakdowns, inspect runtime data, and deploy fixes directly from your agent.
Before you start
This guide assumes you have already connected your agent to Flow Studio MCP. If not, follow Getting Started with Flow Studio MCP first.
The debugging workflow
Debugging a failing flow is a four-step conversation with your agent:
- Check the run history to find the failed run
- Read the error to see which action failed and why
- Inspect the data to see what actually flowed through the action
- Fix and redeploy to push the corrected flow
Step 1: Check the run history
Start by asking your agent what happened recently:
"Show me the recent runs for my invoice processing flow""Has my HR Data Sync flow failed in the last 24 hours?""Check if the daily report flow ran successfully today"
The agent calls get_live_flow_runs and returns a list of recent runs with their status, timestamps, and trigger info. Look for any runs marked Failed.

|
Tip: By default you get the 30 most recent runs, newest first. For flows that run frequently, ask for more: "Show me the last 300 runs" to cover a full 24 hours of a flow that runs every 5 minutes. |
Step 2: Read the error
Once you spot a failed run, ask the agent to dig into it:
"What went wrong in that failed run?""Show me the error details for the run that failed at 2:15 PM""Why did my flow fail?"
The agent calls get_live_flow_run_error and returns a structured breakdown of every action that failed. You get:
- The action name that failed
- The error code (e.g. InvalidTemplate, ActionFailed, NotSpecified)
- The actual error message with the failing expression or HTTP response
- The timestamp of each failure
Here is what a real error breakdown looks like:
failedActions:
[1] Scope: Process_Invoice_Data
code: ActionFailed
message: "An action failed. No dependent actions succeeded."
timestamp: 2026-03-17T14:15:32Z
[2] Compose: Calculate_Tax_Amount
code: InvalidTemplate
message: "Unable to process template language expressions in
action 'Calculate_Tax_Amount' inputs at line '1' and
column '2753': 'The template language function
'multiply' expects its first parameter to be an integer
or a decimal number. The function was invoked with
'null'. Please see https://aka.ms/logicexpressions for
usage details.'."
timestamp: 2026-03-17T14:15:32Z

Reading the error breakdown
The failed actions are listed from outer to inner. The last entry is typically the root cause. In the example above, the Scope (Process_Invoice_Data) failed because the Compose action inside it failed. The Compose action is the one to fix: it tried to multiply a null value.
Step 3: Inspect the actual data
Now you know which action failed and why. Sometimes you need to see what data actually flowed through the action to understand the fix:
"Show me the inputs and outputs of the Calculate_Tax_Amount action in that run""What value did the Get_Invoice_Details action return?""Show me what the HTTP call actually sent and received"
The agent calls get_live_flow_run_action_outputs and returns the real runtime values: the URL that was called, the headers that were sent, the response body that came back. This is the same data you see when you expand an action in the Power Automate run history.
For loops and apply-to-each actions, the agent can inspect individual iterations to find which specific record caused the failure:
"Check iteration 47 of the Apply_to_each action"
Step 4: Fix and redeploy
With the root cause identified, tell the agent to fix it:
"Fix the expression in Calculate_Tax_Amount to handle null values and redeploy""Wrap that expression in a coalesce() to default to 0 and update the flow""Fix this and redeploy the flow"
The agent reads the current flow definition with get_live_flow, modifies the failing action, and deploys the updated version with update_live_flow. You do not need to open the Power Automate portal.
Verify the fix
After deploying, ask the agent to re-run the original failed run:
"Resubmit that failed run""Re-run the flow with the same data that failed before"
The agent calls resubmit_live_flow_run using the original trigger payload. After a few seconds, check the result:
"Did the resubmitted run succeed?"

Note on resubmit: Resubmit works best for flows with manual or HTTP triggers, where the original trigger payload is re-sent as-is. For flows with a Recurrence trigger, resubmit replays the trigger payload from the original run (typically the schedule timestamp). The flow executes normally, but it is replaying with historical trigger data, not creating a fresh recurrence.
If the resubmitted run fails again, repeat the workflow from Step 2. Complex flows sometimes have a second issue masked by the first error.
Common errors and what they mean
Here are the most common error patterns and how to handle them:
InvalidTemplate
An expression in the flow definition is malformed. Common causes: referencing an action that does not exist, using the wrong function name, or incorrect scoping in nested loops. The error message includes the failing expression. Ask the agent to fix it directly.
ActionFailed (on a Scope)
A Scope action reports failure when any action inside it fails. This is never the root cause. Look at the deeper entries in the error breakdown to find what actually broke.
NotSpecified (on an HTTP action)
The HTTP call returned a non-success status code. Ask the agent to show you the action outputs. The response body usually contains the real error from the target API.
ExpressionEvaluationFailed
An expression tried to access a property that does not exist or operate on a null value. Common in loops where some records have missing fields. Fix with coalesce() or a null check condition.
ConnectionNotConfigured
The flow references a connection that does not exist in the target environment. Ask your agent to list_live_connections and update the flow to use the correct connection reference.
Troubleshooting
|
Agent stops responding to MCP commands: If your agent was working and suddenly returns errors, check your plan usage on your dashboard. The error Agent cannot find the flow: Make sure you are connected to the correct environment. Ask "List my environments" to verify, then specify the environment if needed. Resubmit returns a different error: The original error may have been masking a second issue. Run through the debug workflow again from Step 2 on the new error. |
What's next
- Build Power Automate Flows with MCP -- Create flows from scratch using your agent
- MCP Tools Reference -- Complete catalog of all debugging and inspection tools
- Getting Started -- Set up your MCP connection if you haven't already