Severity
P1 - Critical (Blocking production)
Describe the Bug with repro steps
Describe the Bug
Description
When adding a McpClientTool to an Agent Loop tools block, the workflow fails at runtime regardless of the key name used — including the designer-generated default MCP_server.
Error:
BadRequest – The request sent to the agent failed with the following error:
'HTTP request failed: 'An item with the same key has already been added. Key: {tool_name}'.'
Plan Type
Standard
Steps to Reproduce the Bug or Issue
Steps to Reproduce
- Create a Stateful workflow with an
Agent action
- Add a
McpClientTool under tools with any key name (e.g. MCP_server, ArithmeticMCP)
- Trigger the workflow
Expected Behavior
Agent executes and routes calls to MCP tools correctly.
Actual Behavior
Immediate BadRequest — duplicate key error referencing the MCP tool key name.
Key Observations
- Happens with any key name — not just
MCP_server
- The key appears exactly once in the workflow JSON — no actual duplicate in the definition
- Suggests the runtime registers the tool name internally before processing the user definition, causing the collision
Workflow JSON (sanitized)
"tools": {
"ArithmeticMCP": {
"type": "McpClientTool",
"kind": "Builtin",
"inputs": {
"parameters": {
"allowedTools": [
"wf_arithmetic_add",
"wf_arithmetic_sub",
"wf_arithmetic_mul",
"wf_arithmetic_div",
"wf_arithmetic_mod",
"wf_arithmetic_pow",
"wf_arithmetic_sqrt"
]
},
"connectionReference": {
"connectionName": "mcpclient"
}
}
},
"SendTheFinalResult": { ... }
}
Workflow JSON
{
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"contentVersion": "1.0.0.0",
"actions": {
"Agent": {
"type": "Agent",
"inputs": {
"parameters": {
"deploymentId": "gpt-5-chat",
"messages": [
{
"role": "system",
"content": "You are a maths agent that solves arithmetic expressions following BODMAS order (Brackets, Orders/powers, Division, Multiplication, Addition, Subtraction).\n\nYou have access to arithmetic tools via an MCP server — use them for every calculation, do NOT compute in your head.\n\nApproach:\n1. Parse the expression and identify the correct BODMAS evaluation order.\n2. Call the appropriate MCP tool for each sub-expression, in order.\n3. Substitute the result back and continue until fully resolved.\n4. Return a clear step-by-step breakdown showing each tool call and its result, followed by the final answer.\n\nIf the expression is invalid or undefined (e.g. divide by zero), explain why."
},
{
"role": "user",
"content": "Solve this expression: @{triggerBody()?['expression']}"
}
],
"agentModelType": "AzureOpenAI",
"agentModelSettings": {
"agentHistoryReductionSettings": {
"agentHistoryReductionType": "maximumTokenCountReduction",
"maximumTokenCount": 128000
},
"deploymentModelProperties": {
"name": "gpt-5-chat",
"format": "OpenAI",
"version": "2025-10-03"
}
}
},
"modelConfigurations": {
"model1": {
"referenceName": "agent"
}
}
},
"tools": {
"ArithmeticMCP": {
"type": "McpClientTool",
"kind": "Builtin",
"inputs": {
"parameters": {
"allowedTools": [
"wf_arithmetic_add",
"wf_arithmetic_div",
"wf_arithmetic_mod",
"wf_arithmetic_mul",
"wf_arithmetic_pow",
"wf_arithmetic_sqrt",
"wf_arithmetic_sub"
]
},
"connectionReference": {
"connectionName": "mcpclient"
}
}
},
"SendTheFinalResult": {
"actions": {
"Terminate": {
"type": "Terminate",
"inputs": {
"runStatus": "Succeeded"
},
"runAfter": {
"NotifyResultToUser": [
"SUCCEEDED"
]
}
},
"NotifyResultToUser": {
"type": "Compose",
"inputs": "@agentParameters('MathResult')"
}
},
"description": "Send the final result to the user",
"agentParameterSchema": {
"type": "object",
"properties": {
"MathResult": {
"type": "string",
"description": "Result of the Math Equation"
}
},
"required": [
"MathResult"
]
}
}
},
"runAfter": {},
"limit": {
"count": 100
}
}
},
"outputs": {},
"triggers": {
"ReqMsg": {
"type": "Request",
"kind": "Http",
"inputs": {
"method": "POST",
"schema": {
"type": "object",
"properties": {
"expression": {
"type": "string"
}
}
}
}
}
}
},
"kind": "Stateful"
}
Screenshots or Videos
Additional context
Additional Context
- MCP Server is a Logic Apps Standard workflow exposed as an MCP server
- MCP Server is configured with anonymous authentication
- Auth is not a factor — the error occurs before any MCP call is made, at agent initialization
- The duplicate key exception is thrown by the Agent Loop runtime itself during tool registration, not by the MCP server or connection layer
- Both the Agent Loop and the MCP Server are Logic Apps Standard deployed on App Service Plan(ASP)
- MCP endpoint is reachable and functional when called directly outside the Agent Loop
Intermittent Behavior
- The error is not consistent — some runs fail with the duplicate key error, others succeed with identical configuration
- No code or configuration changes between failing and succeeding runs
- Suggests a race condition in the Agent Loop tool registration phase, where the runtime occasionally registers the MCP tool key twice before the workflow executes
- Failure rate appears random with no clear pattern tied to time, load, or input
MCP Connector also doesn't support OAuth authorization. Error happens at tool registration, before any MCP call is made
Via Postman

Not able to trigger the workflow:

Works from Postman
What type of Logic App Is this happening in?
Standard (Portal)
Are you experiencing a regression?
No response
Which operating system are you using?
Windows
Did you refer to the TSG before filing this issue? https://aka.ms/lauxtsg
Yes
Workflow JSON
Screenshots or Videos
--
Environment
Environment
- Logic Apps Standard on ASP
- Agent Loop with
McpClientTool (Builtin kind)
- MCP connection via
mcpclient connection reference
- Stateful workflow
Additional context
MCP Server is a Logic Apps Standard workflow exposed as an MCP server
MCP Server is configured with anonymous authentication
Auth is not a factor — the error occurs before any MCP call is made, at agent initialization
The duplicate key exception is thrown by the Agent Loop runtime itself during tool registration, not by the MCP server or connection layer
Both the Agent Loop and the MCP Server are Logic Apps Standard deployed on App Service Plan(ASP)
MCP endpoint is reachable and functional when called directly outside the Agent Loop
Severity
P1 - Critical (Blocking production)
Describe the Bug with repro steps
Describe the Bug
Description
When adding a
McpClientToolto an Agent Looptoolsblock, the workflow fails at runtime regardless of the key name used — including the designer-generated defaultMCP_server.Error:
BadRequest – The request sent to the agent failed with the following error:
'HTTP request failed: 'An item with the same key has already been added. Key: {tool_name}'.'
Plan Type
Standard
Steps to Reproduce the Bug or Issue
Steps to Reproduce
AgentactionMcpClientToolundertoolswith any key name (e.g.MCP_server,ArithmeticMCP)Expected Behavior
Agent executes and routes calls to MCP tools correctly.
Actual Behavior
Immediate
BadRequest— duplicate key error referencing the MCP tool key name.Key Observations
MCP_serverWorkflow JSON (sanitized)
Workflow JSON
{ "definition": { "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#", "contentVersion": "1.0.0.0", "actions": { "Agent": { "type": "Agent", "inputs": { "parameters": { "deploymentId": "gpt-5-chat", "messages": [ { "role": "system", "content": "You are a maths agent that solves arithmetic expressions following BODMAS order (Brackets, Orders/powers, Division, Multiplication, Addition, Subtraction).\n\nYou have access to arithmetic tools via an MCP server — use them for every calculation, do NOT compute in your head.\n\nApproach:\n1. Parse the expression and identify the correct BODMAS evaluation order.\n2. Call the appropriate MCP tool for each sub-expression, in order.\n3. Substitute the result back and continue until fully resolved.\n4. Return a clear step-by-step breakdown showing each tool call and its result, followed by the final answer.\n\nIf the expression is invalid or undefined (e.g. divide by zero), explain why." }, { "role": "user", "content": "Solve this expression: @{triggerBody()?['expression']}" } ], "agentModelType": "AzureOpenAI", "agentModelSettings": { "agentHistoryReductionSettings": { "agentHistoryReductionType": "maximumTokenCountReduction", "maximumTokenCount": 128000 }, "deploymentModelProperties": { "name": "gpt-5-chat", "format": "OpenAI", "version": "2025-10-03" } } }, "modelConfigurations": { "model1": { "referenceName": "agent" } } }, "tools": { "ArithmeticMCP": { "type": "McpClientTool", "kind": "Builtin", "inputs": { "parameters": { "allowedTools": [ "wf_arithmetic_add", "wf_arithmetic_div", "wf_arithmetic_mod", "wf_arithmetic_mul", "wf_arithmetic_pow", "wf_arithmetic_sqrt", "wf_arithmetic_sub" ] }, "connectionReference": { "connectionName": "mcpclient" } } }, "SendTheFinalResult": { "actions": { "Terminate": { "type": "Terminate", "inputs": { "runStatus": "Succeeded" }, "runAfter": { "NotifyResultToUser": [ "SUCCEEDED" ] } }, "NotifyResultToUser": { "type": "Compose", "inputs": "@agentParameters('MathResult')" } }, "description": "Send the final result to the user", "agentParameterSchema": { "type": "object", "properties": { "MathResult": { "type": "string", "description": "Result of the Math Equation" } }, "required": [ "MathResult" ] } } }, "runAfter": {}, "limit": { "count": 100 } } }, "outputs": {}, "triggers": { "ReqMsg": { "type": "Request", "kind": "Http", "inputs": { "method": "POST", "schema": { "type": "object", "properties": { "expression": { "type": "string" } } } } } } }, "kind": "Stateful" }Screenshots or Videos
Additional context
Additional Context
Intermittent Behavior
MCP Connector also doesn't support OAuth authorization. Error happens at tool registration, before any MCP call is made
Via Postman

Not able to trigger the workflow:

Works from Postman
What type of Logic App Is this happening in?
Standard (Portal)
Are you experiencing a regression?
No response
Which operating system are you using?
Windows
Did you refer to the TSG before filing this issue? https://aka.ms/lauxtsg
Yes
Workflow JSON
Screenshots or Videos
--
Environment
Environment
McpClientTool(Builtinkind)mcpclientconnection referenceAdditional context
MCP Server is a Logic Apps Standard workflow exposed as an MCP server
MCP Server is configured with anonymous authentication
Auth is not a factor — the error occurs before any MCP call is made, at agent initialization
The duplicate key exception is thrown by the Agent Loop runtime itself during tool registration, not by the MCP server or connection layer
Both the Agent Loop and the MCP Server are Logic Apps Standard deployed on App Service Plan(ASP)
MCP endpoint is reachable and functional when called directly outside the Agent Loop