FlowStudio Power Automate MCP

FlowStudio Power Automate MCP

Foundation for connecting an AI agent to Power Automate through a FlowStudio MCP server: auth setup, a reusable helper, tool discovery and handling of oversized responses.

Skill files5 files

references/

SKILL.md382 lines
1
---
2
name: flowstudio-power-automate-mcp
3
description: >-
4
Foundation skill for Power Automate via FlowStudio MCP — auth setup, the
5
reusable MCP helper (Python + Node.js), tool discovery via `list_skills` /
6
`tool_search`, and oversized-response handling. Load this skill first when
7
connecting an agent to Power Automate. For specialized workflows, load
8
`flowstudio-power-automate-build`, `flowstudio-power-automate-debug`, `flowstudio-power-automate-monitoring`
9
(Pro+), or `flowstudio-power-automate-governance` (Pro+) — each contains the workflow
10
narrative, this skill provides the plumbing they all rely on. Requires a
11
FlowStudio MCP subscription or compatible server — see https://mcp.flowstudio.app
12
---
13
14
# Power Automate via FlowStudio MCP — Foundation
15
16
This skill is the **plumbing layer**. It gives an AI agent a reliable way to
17
talk to a FlowStudio MCP server, discover what tools are available, and handle
18
the responses cleanly. The actual workflow narratives live in four specialized
19
skills that all build on this one.
20
21
> **Real debugging examples**: [Expression error in child flow](https://github.com/ninihen1/power-automate-mcp-skills/blob/main/examples/fix-expression-error.md) |
22
> [Data entry, not a flow bug](https://github.com/ninihen1/power-automate-mcp-skills/blob/main/examples/data-not-flow.md) |
23
> [Null value crashes child flow](https://github.com/ninihen1/power-automate-mcp-skills/blob/main/examples/null-child-flow.md)
24
25
> **Requires:** A [FlowStudio](https://mcp.flowstudio.app) MCP subscription (or
26
> compatible Power Automate MCP server). You will need:
27
> - MCP endpoint: `https://mcp.flowstudio.app/mcp` (same for all subscribers)
28
> - API key (`x-api-key` header; `Authorization: Bearer <key>` also works)
29
> - No key is needed in apps that support MCP sign-in (ChatGPT, claude.ai, Claude
30
> desktop, Claude Code, Cursor, VS Code for the web, Gemini): add
31
> `https://mcp.flowstudio.app/mcp/oauth` as a connector and sign in with
32
> Microsoft — see the [ChatGPT walkthrough](https://learn.flowstudio.app/chatgpt-power-automate)
33
> - Power Platform environment name (e.g. `Default-<tenant-guid>`)
34
35
---
36
37
## Which Skill to Use When
38
39
Skills are organized by **use-case intent**, not by which tools they call.
40
Multiple skills reuse the same underlying tools — pick by what the user is
41
trying to accomplish.
42
43
| The user wants to… | Load this skill |
44
|---|---|
45
| Make or change a flow (build new, modify existing, fix a bug, deploy) | **`flowstudio-power-automate-build`** |
46
| Diagnose why a flow failed (root cause analysis on a failing run) | **`flowstudio-power-automate-debug`** |
47
| See what changed in a flow, or put an earlier version back | **`flowstudio-power-automate-debug`** (what changed) or **`flowstudio-power-automate-build`** (put it back) |
48
| See tenant-wide flow health, failure rates, asset inventory | **`flowstudio-power-automate-monitoring`** *(Pro+)* |
49
| Tag, audit, classify, score, or offboard flows | **`flowstudio-power-automate-governance`** *(Pro+)* |
50
| Just connect, set up auth, write the helper, parse responses | this skill (foundation) |
51
52
**Same tools, different lenses.** `flowstudio-power-automate-build` and `flowstudio-power-automate-debug`
53
both call `update_live_flow`, `get_live_flow`, and the run-error tools — they
54
differ in *direction* (forward vs backward) and *intent* (compose vs diagnose).
55
`flowstudio-power-automate-monitoring` and `flowstudio-power-automate-governance` both call the Store
56
tools — they differ in *audience* (ops vs compliance) and *outcome* (read
57
health vs write metadata). Don't try to memorize "which tools belong to which
58
skill"; pick the skill by what the user is doing.
59
60
---
61
62
## Source of Truth
63
64
| Priority | Source | Covers |
65
|----------|--------|--------|
66
| 1 | **Real API response** | Always trust what the server actually returns |
67
| 2 | **`tool_search`** (`list_skills` gives bundle names only) | Authoritative tool schemas, parameter names, types, required flags |
68
| 3 | **SKILL docs & reference files** | Workflow narrative, response shapes, non-obvious behaviors |
69
70
If documentation disagrees with a real API response, the API wins. Tool schemas
71
in this skill (or any other) may lag the server — call `tool_search` to confirm
72
the current shape before invoking a tool you haven't used recently.
73
74
---
75
76
## How Agents Discover Tools
77
78
The FlowStudio MCP server (v1.1.5+) exposes two **non-billable** meta-tools that
79
let an agent load only the tools relevant to the current task. Use these in
80
preference to `tools/list` (which loads all 30+ schemas at once) or guessing
81
tool names.
82
83
**What costs a call:** `tool_search`, `list_skills`, `get_task`, `report_bug`,
84
`score_canvas_app` and `grant_flow_studio_access` never cost a call. Neither
85
does a dry run (`dryRun: true` on `update_live_flow` or `update_canvas_app`).
86
A failed call is free, except when Microsoft refused the definition or
87
parameters you sent, or the flow, run, environment or connection doesn't exist
88
or you don't have access to it. Those can cost a call. Timeouts, Microsoft
89
outages and errors on FlowStudio's side are free.
90
91
When a plan runs out of calls, or the free trial ends, those six tools still
92
work. Every other call is refused, dry runs included, and the reply says what
93
to do next. Canvas tools are free and keep working while they are in preview.
94
95
| Meta-tool | When to call |
96
|---|---|
97
| `list_skills` | Cold start — each bundle's `name` and one-line `description` (no tool names); pick one |
98
| `tool_search` with `query: "skill:<name>"` | Load one bundle's tool schemas plus its step-by-step guidance in `skills_hint` (e.g. `skill:debug-flow`) |
99
| `tool_search` with `query: "select:tool1,tool2"` | Load specific tools by name (e.g. when chaining across bundles) |
100
| `tool_search` with `query: "<keywords>"` | Free-text search when the user request is ambiguous (e.g. `"cancel run"`) |
101
102
The server's `tool_search` bundles are intentionally **narrower than this
103
skill family** — they're starter packs of the most-likely-needed tools per
104
intent. A workflow skill (e.g. `flowstudio-power-automate-debug`) may pull a bundle and
105
then call `tool_search` again for additional tools as the workflow progresses.
106
107
```python
108
# Cold start — pick a bundle by intent
109
skills = mcp("list_skills", {})
110
# [{"name": "debug-flow", "description": "Investigate why a flow is failing: ..."}, ...]
111
112
# Load the bundle's schemas, plus its step-by-step guidance in skills_hint
113
debug = mcp("tool_search", {"query": "skill:debug-flow"})
114
tool_names = [m["name"] for m in debug["matches"]]
115
guidance = debug.get("skills_hint")
116
```
117
118
Flow bundles on production (`list_skills`, 2026-11-20):
119
120
| Bundle | Use when |
121
|---|---|
122
| `discover` | Enumerating environments, flows, and connections |
123
| `create-flow` | Creating a brand-new flow: connections, connector examples, live input values, and `update_live_flow` |
124
| `build-flow` | Reading or modifying an existing flow, including an action's live dropdown and column values |
125
| `flow-versions` | Seeing earlier versions of a flow, comparing them, and putting one back |
126
| `debug-flow` | Investigating failed runs and action-level inputs/outputs |
127
| `monitor-flow` | Starting/stopping, triggering, cancelling, or resubmitting runs |
128
| `diagnose-connection-references` | Connection-reference problems on flows in solutions |
129
| `dataverse` / `sharepoint` / `excel` / `sql` | Finding tables, lists, columns and choice values, and reading rows |
130
| `governance` | Pro+ cached-store tagging, maker audit, and metadata updates — listed only for Pro+ callers, not in Microsoft 365 Copilot |
131
132
`canvas-app` and `canvas-layout` cover Power Apps canvas apps, not flows.
133
134
---
135
136
## Recommended Language: Python or Node.js
137
138
All examples in this skill family use **Python with `urllib.request`**
139
(stdlib — no `pip install` needed). **Node.js** is an equally valid choice:
140
`fetch` is built-in from Node 18+, JSON handling is native, and async/await
141
maps cleanly onto the request-response pattern of MCP tool calls — making it
142
a natural fit for teams already working in a JavaScript/TypeScript stack.
143
144
| Language | Verdict | Notes |
145
|---|---|---|
146
| **Python** | Recommended | Clean JSON handling, no escaping issues, all skill examples use it |
147
| **Node.js (≥ 18)** | Recommended | Native `fetch` + `JSON.stringify`/`JSON.parse`; no extra packages |
148
| PowerShell | Avoid for flow operations | `ConvertTo-Json -Depth` silently truncates nested definitions; quoting and escaping break complex payloads. Acceptable for a quick connectivity smoke-test but not for building or updating flows. |
149
| cURL / Bash | Possible but fragile | Shell-escaping nested JSON is error-prone; no native JSON parser |
150
151
> **TL;DR — use the Core MCP Helper (Python or Node.js) below.** Both handle
152
> JSON-RPC framing, auth, and response parsing in a single reusable function.
153
154
---
155
156
## Core MCP Helper (Python)
157
158
Use this helper throughout all subsequent operations:
159
160
```python
161
import json, urllib.request
162
163
TOKEN = "<YOUR_API_KEY>"
164
MCP = "https://mcp.flowstudio.app/mcp"
165
166
def mcp(tool, args, cid=1):
167
payload = {"jsonrpc": "2.0", "method": "tools/call", "id": cid,
168
"params": {"name": tool, "arguments": args}}
169
req = urllib.request.Request(MCP, data=json.dumps(payload).encode(),
170
headers={"x-api-key": TOKEN, "Content-Type": "application/json",
171
"User-Agent": "FlowStudio-MCP/1.0"})
172
try:
173
resp = urllib.request.urlopen(req, timeout=120)
174
except urllib.error.HTTPError as e:
175
body = e.read().decode("utf-8", errors="replace")
176
raise RuntimeError(f"MCP HTTP {e.code}: {body[:200]}") from e
177
raw = json.loads(resp.read())
178
if "error" in raw:
179
raise RuntimeError(f"MCP error: {json.dumps(raw['error'])}")
180
result = raw["result"]
181
text = result["content"][0]["text"]
182
if result.get("isError"):
183
# A failed call's text may be prose or JSON; raise either way
184
raise RuntimeError(f"Tool error: {text[:2000]}")
185
return json.loads(text)
186
```
187
188
> **Common auth errors:**
189
> - HTTP 401/403 → key is missing, expired, or malformed. Get a fresh key from [mcp.flowstudio.app](https://mcp.flowstudio.app).
190
> - HTTP 403 with a library's default `User-Agent` (for example `Python-urllib`) → Cloudflare blocked the request. Send `User-Agent: FlowStudio-MCP/1.0`.
191
> - HTTP 400 → malformed JSON-RPC payload. Check `Content-Type: application/json` and body structure.
192
> - `MCP error: {"code": -32602, ...}` → unknown tool name. Call `tool_search` to find the right one.
193
> - `MCP error: {"code": -32042, ...}` → the person must open a sign-in page; the address is in `error.data.elicitations[0].url`. Show it to them.
194
> - `Tool error: ...` → the tool ran and refused or failed; wrong or missing arguments land here too, with the reason. Read it before retrying.
195
> - `Tool error:` naming `grant_flow_studio_access`, or saying to sign in or reconnect at the dashboard → the person's Microsoft sign-in expired, was revoked (for example by a password change), or was never granted. Call `grant_flow_studio_access` to show a sign-in card, or send them to https://mcp.flowstudio.app/dashboard. Don't retry until they have.
196
197
---
198
199
## Core MCP Helper (Node.js)
200
201
Equivalent helper for Node.js 18+ (built-in `fetch` — no packages required):
202
203
```js
204
const TOKEN = "<YOUR_API_KEY>";
205
const MCP = "https://mcp.flowstudio.app/mcp";
206
207
async function mcp(tool, args, cid = 1) {
208
const payload = {
209
jsonrpc: "2.0",
210
method: "tools/call",
211
id: cid,
212
params: { name: tool, arguments: args },
213
};
214
const res = await fetch(MCP, {
215
method: "POST",
216
headers: {
217
"x-api-key": TOKEN,
218
"Content-Type": "application/json",
219
"User-Agent": "FlowStudio-MCP/1.0",
220
},
221
body: JSON.stringify(payload),
222
});
223
if (!res.ok) {
224
const body = await res.text();
225
throw new Error(`MCP HTTP ${res.status}: ${body.slice(0, 200)}`);
226
}
227
const raw = await res.json();
228
if (raw.error) throw new Error(`MCP error: ${JSON.stringify(raw.error)}`);
229
const text = raw.result.content[0].text;
230
// A failed call's text may be prose or JSON; raise either way
231
if (raw.result.isError) throw new Error(`Tool error: ${text.slice(0, 2000)}`);
232
return JSON.parse(text);
233
}
234
```
235
236
> Requires Node.js 18+. For older Node, replace `fetch` with `https.request`
237
> from the stdlib or install `node-fetch`.
238
239
---
240
241
## Verify the Connection
242
243
A 3-line smoke test that confirms the token, endpoint, and helper all work:
244
245
```python
246
skills = mcp("list_skills", {})
247
print(f"Connected — {len(skills)} skill bundles available:",
248
[s["name"] for s in skills])
249
```
250
251
Expected output (production, 2026-11-20; the list grows as the server adds bundles):
252
253
```text
254
Connected — 13 skill bundles available: ['diagnose-connection-references', 'canvas-app', 'canvas-layout', 'dataverse', 'sharepoint', 'excel', 'sql', 'build-flow', 'flow-versions', 'create-flow', 'debug-flow', 'monitor-flow', 'discover']
255
```
256
257
Pro+ callers also see `governance`, except in Microsoft 365 Copilot (Copilot Chat or Cowork). Any non-empty list means the connection works.
258
259
If this fails, see the **Common auth errors** note above. If it succeeds, hand
260
off to the workflow skill matching the user's intent.
261
262
---
263
264
## Long-Running Saves
265
266
A real `update_live_flow` save (anything without `dryRun: true`) runs as a task.
267
If it is still running after about 25 seconds, the reply is the task, not the
268
result:
269
270
```json
271
{"taskId": "...", "status": "working", "statusMessage": "The operation is now in progress.", "pollIntervalMs": 30000}
272
```
273
274
**Do not call `update_live_flow` again** — that is how duplicate flows happen.
275
Poll `get_task` until `status` is `completed` or `failed`. The finished save's
276
reply is in `result`; `isError: true` means the save itself failed.
277
278
```python
279
import time
280
281
def save_flow(args):
282
res = mcp("update_live_flow", args)
283
while res.get("status") == "working" and "taskId" in res:
284
time.sleep(res.get("pollIntervalMs", 30000) / 1000)
285
res = mcp("get_task", {"taskId": res["taskId"]})
286
if "taskId" not in res:
287
return res # finished inside 25 s
288
if res["status"] == "failed" or res.get("isError"):
289
raise RuntimeError(res.get("statusMessage") or res.get("result"))
290
return res["result"]
291
```
292
293
A task reply has no `error` key, so `result.get("error") is None` alone reads it
294
as a success with no `flowName`.
295
296
---
297
298
## Handling Oversized Responses
299
300
Some MCP tool responses are large enough to overflow the agent's context window:
301
302
| Tool | Typical size | Cause |
303
|---|---|---|
304
| `describe_live_connector` with `depth: "full"` | 100-600 KB | Raw OpenAPI metadata — the default `depth: "summary"` is a compact catalog |
305
| `resolve_live_parameters` with `detail: "full"` | Grows with the columns | Every column of a wide list or table — narrow with `parameterName` or `search` |
306
| `get_live_flow_run_action_outputs` (no `actionName`) | Up to 4,000 characters each for an action's inputs and outputs | Survey view: each payload capped, most headers dropped — call again with `actionName` for one action in full |
307
| `get_live_flow` (large flows) | 50-500 KB | Deeply nested branches — use `depth: "summary"`, then `actions: [...]` |
308
| `list_live_flows` (large tenants) | 50-200 KB | Hundreds of flow records — use `search` or `top` |
309
310
The server helps you narrow. A JSON-object reply over 40,000 characters opens with a
311
`responseSize` key; for the flow, run, connection and connector read tools it says how to ask for less. A single run payload
312
over 1 MB is not downloaded: you get `{tooLarge, bytes, link, linkExpiresAt, note}`
313
instead, and `link` downloads it with a plain GET, no sign-in, until it expires —
314
treat it like a password.
315
316
### When the harness spills to a file
317
318
Agent harnesses (Claude Code, VS Code Copilot, etc.) save oversized responses
319
to a temp file (e.g. `tool-results/mcp-flowstudio-describe_live_connector-NNNN.txt`)
320
and return the path instead of the inline JSON. The file is **double-wrapped** —
321
the outer MCP envelope plus the inner JSON-escaped payload:
322
323
```text
324
[{"type":"text","text":"<JSON-escaped payload>"}]
325
```
326
327
Two parses to reach a usable object:
328
329
```python
330
import json
331
with open(path) as f:
332
raw = json.loads(f.read())
333
payload = json.loads(raw[0]["text"])
334
```
335
336
```powershell
337
$payload = ((Get-Content $path -Raw | ConvertFrom-Json)[0].text) | ConvertFrom-Json
338
```
339
340
### Rules of thumb
341
342
1. **Extract, don't echo.** Pull the specific field(s) you need (one `operationId`, one action's outputs) and discard the rest before reasoning about it.
343
2. **Pass `actionName` to `get_live_flow_run_action_outputs` once you know the action.** Without it you get a survey view: every action in the run, nested ones included, each payload capped at 4,000 characters and most headers dropped (`note` says so). For actions inside a foreach, passing `actionName` without `iterationIndex` can return every repetition of that action.
344
3. **Reuse the spill file within a session.** Refetching the same `depth: "full"` connector metadata costs 30+ seconds and produces another spill — cache the path.
345
4. **Don't grep the spill file for JSON keys directly.** Strings are JSON-escaped inside the file (`\"OperationId\":`), so a plain grep for `"OperationId":` will not match. Parse first, then filter.
346
5. **Summarize tool output to the user.** Echo `name + state + trigger` for flow lists and `actionName + status + code` for run errors — not raw JSON, unless asked.
347
348
```python
349
# Good — ask for one operation, not the whole connector
350
op = mcp("describe_live_connector", {"environmentName": ENV,
351
"connectorName": "shared_sharepointonline", "operationId": "GetItems"})["operation"]
352
print(op["name"], "—", op["summary"], [i["name"] for i in op["inputs"] if i["required"]])
353
354
# Good — a large flow: the action tree first, then only the actions you need
355
tree = mcp("get_live_flow", {"environmentName": ENV, "flowName": FLOW_ID, "depth": "summary"})
356
acts = mcp("get_live_flow", {"environmentName": ENV, "flowName": FLOW_ID, "actions": ["Get_items"]})
357
358
# Bad — depth "full" pulls the whole 500 KB swagger into context
359
conn = mcp("describe_live_connector", {"environmentName": ENV,
360
"connectorName": "shared_sharepointonline", "depth": "full"}) # don't do this
361
```
362
363
---
364
365
## Auth & Connection Notes
366
367
| Field | Value |
368
|---|---|
369
| Auth header | `x-api-key: <key>` (recommended). `Authorization: Bearer <key>` also works with the same key |
370
| Token format | Paste the key exactly as issued (an `fsk_…` key from the dashboard, or an older legacy JWT key) — do not strip, alter, or prefix it |
371
| Timeout | Use ≥ 120 s. `update_live_flow` saves answer within about 25 s, with a `taskId` if still running (see **Long-Running Saves**) |
372
| Environment name | The `id` from `list_live_environments` — `Default-<tenant-guid>` or a plain GUID. A whole display name or `"Default"` is swapped for the id with a hint; anything else is refused |
373
374
---
375
376
## Reference Files
377
378
- [MCP-BOOTSTRAP.md](references/MCP-BOOTSTRAP.md) — endpoint, auth, request/response format (read this first)
379
- [tool-reference.md](references/tool-reference.md) — response shapes and behavioral notes (parameters are in `tool_search`)
380
- [action-types.md](references/action-types.md) — Power Automate action type patterns
381
- [connection-references.md](references/connection-references.md) — connector reference guide
382

© GitHub, Inc. · MIT · source · posted by @OpenSourceBuffGuy on promptparty.com

@OpenSourceBuffGuy

I find openly licensed prompts and post them here.

0 followers · 13,706 prompts

More by @OpenSourceBuffGuy

See all
Selfie vlog of a ramen bowl in kitchen prompt image

Selfie vlog of a ramen bowl in kitchen

Generates a 15-second handheld selfie-vlog of a young woman enjoying a ramen bowl, with eight timed shots, short spoken lines and an authentic phone-footage look.

video-prompt, hailuo, ugc-video, vlog, multi-shot, timed-beats, lip-sync, handheld, product-video, food-photography, smartphone-photo, negative-prompt, reference-image, image-to-video, short-form-video, tiktok, japan, woman, selfie, pov, close-up, high-angle, natural-light, character-consistency, cozy, for-content-creators

Robed figure gazes at moonlit cloud palace prompt image

Robed figure gazes at moonlit cloud palace

Animates a still of a robed figure facing a moonlit cloud palace with slow push-ins, drifting mist and swaying pines, with negative prompts that keep the figure still.

video-prompt, image-to-video, negative-prompt, camera-movement, cinematic, fantasy-world, dreamy, moody, natural-light, landscape, mountains, night-scene, blue-hour, silhouette, slow-motion, multi-shot, mythology, china, woman, hailuo, for-filmmakers, structured-output, guardrails

Seated woman over giant graphite watercolor face prompt image

Seated woman over giant graphite watercolor face

Paints an elegant watercolor fashion portrait of a seated woman in lavender and ivory in front of a giant graphite-and-watercolor close-up of her own face.

image-prompt, gpt-image, watercolor, portrait, woman, fashion, fashion-shoot, editorial, double-exposure, black-and-white, muted-colors, soft-lighting, full-body, vertical-format, negative-prompt, illustration, sketch, negative-space, fine-art, character-design, structured-output, for-artists, jewelry, long-form

Reviews

Loading reviews…

Discussion

Loading comments…