Skip to content

[power-automate][Bug] copy_flow fails with "ctx.getClient(...).copyFlow is not a function #289

Description

@SergioVS-Midoriya

Plugin

power-automate

Plugin Version

2.1.0

Skill / Command

copy_flow

Bug Description

Plugin: power-automate
Plugin Version: 2.1.0
Skill / Command: copy_flow (MCP tool, flowagent)

Bug Description:
Calling the copy_flow MCP tool to duplicate a flow within the same environment
fails with a TypeError before any copy is attempted. The error suggests
copyFlow is not implemented as a method on the client object the tool resolves
via ctx.getClient(...).

Steps to Reproduce:

  1. Call the copy_flow MCP tool with:
    • env:
    • flow: (a standalone, non-solution flow with 4 connection
      references: office365users, teams, powerbi, office365)
    • name: ""
    • (targetEnv omitted, so it defaults to a same-environment copy)
  2. Observe the tool call fails immediately.
  3. Retried the identical call a second time — same error, so it is not transient.

Expected Behavior:
The tool should read the source flow's definition and connection references
and create a new, standalone flow (Stopped by default) with the given name in
the same environment, per the tool's documented behavior.

Actual Behavior:
The tool call fails with:
{
"code": "tool-error",
"message": "ctx.getClient(...).copyFlow is not a function",
"errorName": "TypeError"
}
No flow copy is created.

Relevant Logs / Screenshots:
{
"code": "tool-error",
"message": "ctx.getClient(...).copyFlow is not a function",
"errorName": "TypeError"
}

Environment:
OS: Microsoft Windows 11 Enterprise 10.0.26200
Claude Code version: 2.1.209 (Claude Code)
PAC CLI version: Not installed / not found

Labels: bug, power-automate


🤖 This issue was created using the /report-issue skill.

===== END PREVIEW =====

¿Apruebas este contenido para crear el issue, o quieres ajustar algo más?

✻ Sautéed for 42s

❯ Apruebo, procede a crear el issue

Ran 2 shell commands

El CLI gh de GitHub no está instalado en este equipo (ni en Bash ni en PowerShell), así que no puedo crear el issue directamente por ese medio.

● User answered Claude's questions:
· No encuentro el CLI 'gh' instalado, así que no puedo crear el issue automáticamente. ¿Cómo prefieres proceder? → Dame el texto para pegarlo yo mismo

Aquí tienes todo listo para pegar en https://github.com/microsoft/power-platform-skills/issues/new:

Título:
[Bug] copy_flow fails with "ctx.getClient(...).copyFlow is not a function"

Etiquetas (labels): bug, power-automate

Cuerpo:

Plugin

power-automate

Plugin Version

2.1.0

Skill / Command

copy_flow (MCP tool, flowagent)

Bug Description

Calling the copy_flow MCP tool to duplicate a flow within the same environment fails with a TypeError before any copy is attempted. The error suggests copyFlow is not implemented as a method on the client object the tool resolves via ctx.getClient(...).

Steps to Reproduce

  1. Call the copy_flow MCP tool with:
    • env:
    • flow: (a standalone, non-solution flow with 4 connection references: office365users, teams, powerbi, office365)
    • name: ""
    • (targetEnv omitted, so it defaults to a same-environment copy)
  2. Observe the tool call fails immediately.
  3. Retried the identical call a second time — same error, so it is not transient.

Expected Behavior

The tool should read the source flow's definition and connection references and create a new, standalone flow (Stopped by default) with the given name in the same environment, per the tool's documented behavior.

Actual Behavior

The tool call fails with:
{
"code": "tool-error",
"message": "ctx.getClient(...).copyFlow is not a function",
"errorName": "TypeError"
}
No flow copy is created.

Relevant Logs / Screenshots

{
"code": "tool-error",
"message": "ctx.getClient(...).copyFlow is not a function",
"errorName": "TypeError"
}

Environment

OS: Microsoft Windows 11 Enterprise 10.0.26200
Claude Code version: 2.1.209 (Claude Code)
PAC CLI version: Not installed / not found

Steps to Reproduce

  1. Call the copy_flow MCP tool with:
    • env:
    • flow: (a standalone, non-solution flow with 4 connection references: office365users, teams, powerbi, office365)
    • name: ""
    • (targetEnv omitted, so it defaults to a same-environment copy)
  2. Observe the tool call fails immediately.
  3. Retried the identical call a second time — same error, so it is not transient.

Expected Behavior

The tool should read the source flow's definition and connection references and create a new, standalone flow (Stopped by default) with the given name in the same environment, per the tool's documented behavior.

Actual Behavior

The tool call fails with:

{
"code": "tool-error",
"message": "ctx.getClient(...).copyFlow is not a function",
"errorName": "TypeError"
}

No flow copy is created.

Relevant Logs / Screenshots

{
  "code": "tool-error",
  "message": "ctx.getClient(...).copyFlow is not a function",
  "errorName": "TypeError"
}

Environment

  • OS: Microsoft Windows 11 Enterprise 10.0.26200
  • Claude Code version: 2.1.209 (Claude Code)
  • PAC CLI version: Not installed / not found

Update: second write-path method missing

Same root cause appears to affect another write tool. Calling edit_flow
(surgical edit operations) on a standalone flow fails immediately with:

{
  "code": "tool-error",
  "message": "ctx.getClient(...).editFlow is not a function",
  "errorName": "TypeError"
}

Combined with the copyFlow failure reported above, this suggests the client
object returned by ctx.getClient(...) is missing multiple write methods
(copyFlow, editFlow, and possibly others like updateFlow) — likely an
incomplete client implementation or a wiring/initialization bug rather than
something specific to either individual tool.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions