/flowstudio-power-automate:power-automate-debugfrom flowstudio-power-automate
Debug failing Power Automate cloud flows using the FlowStudio MCP server. Provides action-level inputs and outputs to find root causes of errors, timeouts, and expression failures.
Ships in flowstudio-power-automate. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
A step-by-step diagnostic process for investigating failing Power Automate cloud flows through the FlowStudio MCP server.
Real debugging examples: Expression error in child flow | Data entry, not a flow bug | Null value crashes child flow
Prerequisite: A FlowStudio MCP server must be reachable with a valid API key or sign-in.
See the power-automate-mcp skill for connection setup.
Subscribe at https://mcp.flowstudio.app
Always call
tool_searchfirst (skill:debug-flow, thenselect:each other tool used below; most sit in other bundles) to confirm tool names and parameter schemas. This skill covers response shapes, behavioral notes, and diagnostic patterns — things tool schemas cannot tell you. If this document disagrees withtool_searchor a real API response, the API wins.
import json, time, urllib.request
MCP_URL = "https://mcp.flowstudio.app/mcp"
MCP_TOKEN = "<YOUR_API_KEY>"
def mcp(tool, **kwargs):
payload = json.dumps({"jsonrpc": "2.0", "id": 1, "method": "tools/call",
"params": {"name": tool, "arguments": kwargs}}).encode()
req = urllib.request.Request(MCP_URL, data=payload,
headers={"x-api-key": MCP_TOKEN, "Content-Type": "application/json",
"User-Agent": "FlowStudio-MCP/1.0"})
try:
resp = urllib.request.urlopen(req, timeout=120)
except urllib.error.HTTPError as e:
body = e.read().decode("utf-8", errors="replace")
raise RuntimeError(f"MCP HTTP {e.code}: {body[:200]}") from e
raw = json.loads(resp.read())
if "error" in raw:
raise RuntimeError(f"MCP error: {json.dumps(raw['error'])}")
res = raw["result"]
if res.get("isError"): # refusals and failed calls: may not be JSON
raise RuntimeError(res["content"][0]["text"][:500])
return json.loads(res["content"][0]["text"])
ENV = "<environment-id>" # e.g. Default-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
result = mcp("list_live_flows", environmentName=ENV, search="My Flow Name")
# Returns a wrapper object: {mode, flows, totalCount, error}
target = result["flows"][0]
FLOW_ID = target["id"] # plain UUID — use directly as flowName
print(FLOW_ID)
res = mcp("get_live_flow_runs", environmentName=ENV, flowName=FLOW_ID,
status="Failed", top=5) # also startedAfter / startedBefore (date-times)
runs = res["runs"] # newest first, filtered by Power Automate across pages
# res: {"runs": [{"name": "08584296...CU15", "status": "Failed",
# "startTime": "...", "endTime": "...", "triggerName": "manual",
# "error": {"code": "ActionFailed", ...}}, ...],
# "runCount": 5, "runFilter": "status eq 'Failed'", "triggerChecks": null}
# NO RUNS != healthy. With no status or date filter, zero runs fills
# res["triggerChecks"]. byStatus: Skipped = polled, nothing new (not
# an error); Failed = trigger error: pass its checkId to outputs tool.
RUN_ID = runs[0]["name"] # runName="latest" also picks the newest run
CRITICAL:
get_live_flow_run_errortells you which action failed.get_live_flow_run_action_outputstells you why. You must call BOTH. Never stop at the error alone — error codes likeActionFailed,NotSpecified, andInternalServerErrorare generic wrappers. The actual root cause (wrong field, null value, HTTP 500 body, stack trace) is only visible in the action's inputs and outputs.
err = mcp("get_live_flow_run_error",
environmentName=ENV, flowName=FLOW_ID, runName=RUN_ID)
# Returns:
# {
# "runName": "08584296068667933411438594643CU15",
# "failedActions": [
# {"actionName": "Apply_to_each_prepare_workers", "status": "Failed",
# "code": "ActionFailed", "error": {"code": "ActionFailed", ...},
# "startTime": "...", "endTime": "..."},
# {"actionName": "HTTP_find_AD_User_by_Name", "status": "Failed",
# "code": "NotSpecified", "startTime": "...", "endTime": "..."}
# ],
# "allActions": [
# {"actionName": "Apply_to_each", "status": "Skipped"},
# {"actionName": "Compose_WeekEnd", "status": "Succeeded"},
# ...
# ]
# }
# failedActions is in name order, not run order. Containers (Foreach, Scope,
# Condition) fail with ActionFailed; the ROOT is the entry that does not:
fa = err["failedActions"]
root = next((a for a in fa if a.get("code") != "ActionFailed"), fa[-1])
print(f"Root action: {root['actionName']} → code: {root.get('code')}")
# allActions shows every action's status — useful for spotting what was Skipped
# See common-errors.md to decode the error code.
This is the most important step. The real error detail — HTTP status, response body, stack trace, null value — lives in the action's inputs and outputs.
# Get the root failing action's full inputs and outputs
root_action = root["actionName"]
detail = mcp("get_live_flow_run_action_outputs",
environmentName=ENV,
flowName=FLOW_ID,
runName=RUN_ID,
actionName=root_action)
reps = detail.get("actions") or detail.get("repetitions", [])
if len(reps) > 1:
print(f"{root_action} returned {len(reps)} repetitions; inspect iteration indexes")
out = reps[0] if reps else {}
print(f"Action: {out.get('actionName')}")
print(f"Status: {out.get('status')}")
# For HTTP actions, the real error is in outputs.body
if isinstance(out.get("outputs"), dict):
status_code = out["outputs"].get("statusCode")
body = out["outputs"].get("body", {})
print(f"HTTP {status_code}")
print(json.dumps(body, indent=2)[:500])
# Error bodies are often nested JSON strings — parse them
if isinstance(body, dict) and "error" in body:
err_detail = body["error"]
if isinstance(err_detail, str):
err_detail = json.loads(err_detail)
print(f"Error: {err_detail.get('message', err_detail)}")
# For expression errors, the error is in the error field
if out.get("error"):
print(f"Error: {out['error']}")
# Also check inputs — they show what expression/URL/body was used
if out.get("inputs"):
print(f"Inputs: {json.dumps(out['inputs'], indent=2)[:500]}")
Error code from get_live_flow_run_error | What get_live_flow_run_action_outputs reveals |
|---|---|
ActionFailed | Which nested action actually failed and its HTTP response |
NotSpecified | The HTTP status code + response body with the real error |
InternalServerError | The server's error message, stack trace, or API error JSON |
InvalidTemplate | The exact expression that failed and the null/wrong-type value |
BadRequest | The request body that was sent and why the server rejected it |
When actionName refers to an action inside a foreach, the output tool can
return every repetition of that action. Each item may include
repetitionIndexes with the loop name and zero-based itemIndex. Use
iterationIndex to inspect one iteration after you find the suspicious item:
all_reps = mcp("get_live_flow_run_action_outputs",
environmentName=ENV, flowName=FLOW_ID,
runName=RUN_ID,
actionName=root_action)
for rep in all_reps["repetitions"][:10]:
print(rep.get("repetitionIndexes"), rep.get("status"), rep.get("error"))
one_rep = mcp("get_live_flow_run_action_outputs",
environmentName=ENV,
flowName=FLOW_ID,
runName=RUN_ID,
actionName=root_action,
iterationIndex=3)
For uncertain connector work, add a Compose_*_Request before the risky action
and a Compose_*_Result after it, with the result action allowed on both
Succeeded and Failed. This gives future debugging a clean payload snapshot
without requiring another deploy. Do not include secrets or long binary payloads
in these bookends.
Error code: "InternalServerError" ← this tells you nothing
Action outputs reveal:
HTTP 500
body: {"error": "Cannot read properties of undefined (reading 'toLowerCase')
at getClientParamsFromConnectionString (storage.js:20)"}
← THIS tells you the Azure Function crashed because a connection string is undefined
Error code: "BadRequest" ← generic
Action outputs reveal:
inputs: "body('HTTP_GetTokenFromStore')?['token']?['access_token']"
outputs: "" ← empty string, the path resolved to null
← THIS tells you the response shape changed — token is at body.access_token, not body.token.access_token
# summary: the action tree (name, type, runAfter, nesting), no inputs
tree = mcp("get_live_flow", environmentName=ENV, flowName=FLOW_ID, depth="summary")
print(tree["properties"]["definition"]["actionTree"])
# actions: just these, at any depth. Never save this back as a whole definition
defn = mcp("get_live_flow", environmentName=ENV, flowName=FLOW_ID, actions=[root_action])
# What changed since it last worked? A run name works as a version
# ("from" is a Python keyword, so pass it through **{})
ok = mcp("get_live_flow_runs", environmentName=ENV, flowName=FLOW_ID,
status="Succeeded", top=1)["runs"]
if ok:
print(mcp("diff_live_flow", environmentName=ENV, flowName=FLOW_ID,
**{"from": ok[0]["name"]})) # {added, removed, changed, triggers}
Inspect the failing action's inputs expression to see what data it expects.
When the failing action's inputs reference upstream actions, inspect those too. Walk backward through the chain until you find the source of the bad data:
# No actionName: every action, any depth, one call; payloads capped at
# 4,000 chars ({truncated, preview}); the list is not in run order
survey = mcp("get_live_flow_run_action_outputs",
environmentName=ENV, flowName=FLOW_ID, runName=RUN_ID)
for out in sorted(survey["actions"], key=lambda a: a.get("startTime") or ""):
print(out["actionName"], out.get("status")) # names only: payloads can hold secrets
# Then read only the actions you suspect, with actionName (Step 4)
⚠️ A payload over 1 MB comes back as
{tooLarge, bytes, link, linkExpiresAt, note}instead of the data:linkdownloads it with a plain GET, no sign-in, until it expires. Inside a foreach, passiterationIndexto avoid every repetition.
split on null)If the error mentions InvalidTemplate or a function name:
# Example: action uses split(item()?['Name'], ' ')
# → null Name in the source data. A Compose's outputs IS the value;
# Select and Filter array put it in outputs.body
reps = mcp("get_live_flow_run_action_outputs", ..., actionName="Compose_Names")["actions"]
names = (reps[0].get("outputs") or []) if reps else []
nulls = [x for x in names if x.get("Name") is None]
print(f"{len(nulls)} records with null Name")
Expression triggerBody()?['fieldName'] returns null → fieldName is wrong.
Inspect the trigger output to see the actual field names:
trig = mcp("get_live_flow_run_action_outputs", ..., trigger=True) # not actionName
print(json.dumps(trig.get("outputs"), indent=2)[:500])
The error code says InternalServerError or NotSpecified — always inspect
the action outputs to get the actual HTTP status and response body:
out = mcp("get_live_flow_run_action_outputs", ..., actionName="HTTP_Get_Data")["actions"][0]
print(f"HTTP {out['outputs']['statusCode']}")
print(json.dumps(out['outputs']['body'], indent=2)[:500])
ConnectionAuthorizationFailed / InvalidConnectionCredentials: check it with
test_live_connection. create_live_connection with connectionName signs it in
again: give the person signInLink (you never sign in for them). Or bind a working
connection (list_live_connections search → template, then update_live_flow).
DynamicListValuesUndefinedOrInvalid)Outlook To/Cc/From/mailboxAddress pickers use AadGraph.GetUsers, which
Power Automate's own lookup refuses. resolve_live_parameters searches people the
way the designer does: pass search or match (a name or email). An email address
typed directly also works.
For expression/data issues:
# Surgical edit; inside a loop the path is ["actions", "<Loop>", "actions", ...]
ops = [{"op": "set", "path": ["actions", "Compose_Names", "inputs"],
"value": "@coalesce(item()?['Name'], 'Unknown')"}]
print(mcp("update_live_flow", environmentName=ENV, flowName=FLOW_ID,
operations=ops, dryRun=True)["changes"]) # preview, writes nothing
result = mcp("update_live_flow", environmentName=ENV, flowName=FLOW_ID, operations=ops)
# Still saving after 25 s → {taskId, status: "working", pollIntervalMs}.
# NEVER call update_live_flow again (duplicates) — poll get_task:
while result.get("status") == "working":
time.sleep(result["pollIntervalMs"] / 1000)
result = mcp("get_task", taskId=result["taskId"])
if "taskId" in result: # the save's own reply is in result
if result["status"] == "failed" or result.get("isError"):
raise RuntimeError(result.get("statusMessage") or result.get("result"))
result = result["result"]
print(result.get("error")) # None = success
⚠️ A refused save raises (
isError). If an unpublished portal draft blocks it (XrmApiServerError), it may hold someone else's work: ask the person to publish it, or to approvediscardDraft=True.
Use
resubmit_live_flow_runto test ANY flow. It replays a past run with its original trigger payload — Recurrence, SharePoint, connector webhooks, Button and HTTP alike — so there is no wait for the next real event. It cannot help a brand-new flow that has never run.
# Resubmit the failed run — works for ANY trigger type
resubmit = mcp("resubmit_live_flow_run",
environmentName=ENV, flowName=FLOW_ID, runName=RUN_ID)
print(resubmit) # {"resubmitted": true, "triggerName": "..."}
# Wait ~30 s then check
time.sleep(30)
new_runs = mcp("get_live_flow_runs", environmentName=ENV, flowName=FLOW_ID, top=3)["runs"]
print(new_runs[0]["status"]) # Succeeded = done
| Scenario | Use | Why |
|---|---|---|
| Testing a fix on any flow | resubmit_live_flow_run | Replays the exact trigger payload that caused the failure — best way to verify |
| Recurrence / scheduled flow | trigger_live_flow (no body) | Runs it now, like the portal's "Run flow" button; resubmit replays a past run's data |
| SharePoint / connector trigger | resubmit_live_flow_run | Cannot be triggered without creating a real SP item |
| HTTP, Button, PowerApps or Skills trigger, custom payload | trigger_live_flow | When you need to send different data than the original run |
| Brand-new Request or Recurrence flow | trigger_live_flow | No prior run to resubmit |
For flows with a Request trigger (HTTP request, manual Button, PowerApps or Skills),
use trigger_live_flow when you need to send a different payload than the
original run. Pass trigger inputs as body for every kind:
# First inspect what the trigger expects (summary keeps triggers whole)
defn = mcp("get_live_flow", environmentName=ENV, flowName=FLOW_ID, depth="summary")
manual = next(iter(defn["properties"]["definition"]["triggers"].values()))
print("Expected body schema:", manual.get("inputs", {}).get("schema"))
# Trigger with a test payload
result = mcp("trigger_live_flow",
environmentName=ENV,
flowName=FLOW_ID,
body={"name": "Test User", "value": 42})
print(f"Status: {result['responseStatus']}, Body: {result.get('responseBody')}")
print(f"Kind: {result['triggerKind']}, via: {result['invocation']}, run: {result.get('runName')}")
if result.get("warning"):
print(result["warning"]) # required trigger inputs you left out
trigger_live_flowhandles AAD-authenticated triggers. A scheduled flow runs now with nobody(a body is refused); automated connector triggers only fire from their source event.Power Automate does not enforce a trigger's
requiredinputs. If you leave one out the run still starts, with that input null, and the result carries awarningnaming the missing keys. Cancel the run and call again with the full body if that matters.
runNamecomes back only when abodywent through the connector runtime (Button, PowerApps, Skills). Otherwise find the run withget_live_flow_runs.A browser-extension key sends inputs too, through the extension (1.0.19 or later).
| Symptom | First Tool | Then ALWAYS Call | What to Look For |
|---|---|---|---|
| Flow shows as Failed | get_live_flow_run_error | get_live_flow_run_action_outputs on the failing action | HTTP status + response body in outputs |
Error code is generic (ActionFailed, NotSpecified) | — | get_live_flow_run_action_outputs | The outputs.body contains the real error message, stack trace, or API error |
| HTTP action returns 500 | — | get_live_flow_run_action_outputs | outputs.statusCode + outputs.body with server error detail |
| Expression crash | — | get_live_flow_run_action_outputs on prior action | null / wrong-type fields in output body |
| Flow never starts | get_live_flow (state) | get_live_flow_runs, no filter | Failed in byStatus; Skipped is normal |
| Worked before, fails now | get_live_flow_versions | diff_live_flow | actions added, removed or changed |
| Action returns wrong data | get_live_flow_run_action_outputs | — | actual output body vs expected |
| Fix applied but still fails | get_live_flow_runs after resubmit | — | new run status field |
power-automate-mcp — Foundation skill: connection setup, MCP helper, tool discoverypower-automate-build — Build and deploy new flowsWhat SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
Generated from the plugin's indexed repository (ninihen1/power-automate-mcp-skills) — no native marketplace selected
npx claudepluginhub p/ninihen1-flowstudio-power-automate9 skills in this plugin
/power-apps-canvas-editBuild and change Power Apps canvas apps through FlowStudio MCP: create apps, add and restyle screens and controls, write Power Fx, build galleries, and connect Dataverse, SharePoint, connectors and flows, all as named edits the server checks. Load this skill when asked to: create an app, add or change a screen or control, write or fix a Power Fx formula, add a gallery or table, connect a data source or flow, fix a layout, or improve an app's quality score. Requires a FlowStudio MCP subscription; see https://mcp.flowstudio.app/power-apps-canvas-mcpGround rules for Power Apps canvas apps through FlowStudio MCP: the canvas tools, edit sessions, draft versus live, and long calls and timeouts. Load this skill first for any canvas app work, before `power-apps-canvas-read`, `power-apps-canvas-edit` or `power-apps-canvas-ship`, and when a canvas call behaves strangely: a timeout that may still have created something, a push stuck importing, a session that moved, or draft-versus-live confusion. Requires a FlowStudio MCP subscription; see https://mcp.flowstudio.app/power-apps-canvas-readInspect, audit and diagnose Power Apps canvas apps through FlowStudio MCP: control trees, formulas, data sources and their columns, formula checks, a quality score, version diffs, and what the published app actually contains. Load this skill when asked to: find the formula or control behind a behavior, check formulas for errors, list data sources and columns, score an app's quality, compare versions, find when something broke, or confirm what users are running. Requires a FlowStudio MCP subscription; see https://mcp.flowstudio.app/power-apps-canvas-shipPush and publish Power Apps canvas app changes through FlowStudio MCP, and get out of trouble: refused pushes, apps that call flows, damaged drafts and Power Apps Studio saving over your work. Load this skill when asked to: push or publish canvas app changes, recover from a push refused because the app moved, fix a push that fails on a deleted flow, spot a damaged draft or restore a good version, or work alongside an open Power Apps Studio session. Requires a FlowStudio MCP subscription; see https://mcp.flowstudio.app/power-automate-buildBuild, scaffold, and deploy Power Automate cloud flows using the FlowStudio MCP server. Your agent constructs flow definitions, wires connections, deploys, and tests — all via MCP without opening the portal. Load this skill when asked to: create a flow, build a new flow, deploy a flow definition, scaffold a Power Automate workflow, construct a flow JSON, update an existing flow's actions, patch a flow definition, add actions to a flow, wire up connections, or generate a workflow definition from scratch. Requires a FlowStudio MCP subscription — see https://mcp.flowstudio.app/power-automate-governanceGovern Power Automate flows and Power Apps at scale using the FlowStudio MCP cached store. Classify flows by business impact, detect orphaned resources, audit connector usage, enforce compliance standards, manage notification rules, and compute governance scores — all without Dataverse or the CoE Starter Kit. Load this skill when asked to: tag or classify flows, set business impact, assign ownership, detect orphans, audit connectors, check compliance, compute archive scores, manage notification rules, run a governance review, generate a compliance report, offboard a maker, or any task that involves writing governance metadata to flows. Requires an MCP Pro+ subscription — see https://mcp.flowstudio.appOther plugins' skills for the same job