Python: Add Python parity for InvokeMcpTool in declarative workflow - #5630
Merged
Peter Ibekwe (peibekwe) merged 9 commits intoMay 5, 2026
Merged
Conversation
Contributor
Python Test Coverage Report •
Python Unit Test Overview
|
|||||||||||||||||||||||||||||||||||||||||||||
Contributor
There was a problem hiding this comment.
Pull request overview
Adds Python declarative-workflow support for InvokeMcpTool, bringing the Python SDK closer to the existing .NET MCP action support and exposing the feature through the declarative workflow factory, executor, handler, tests, and samples.
Changes:
- Adds the Python
InvokeMcpToolexecutor/handler path, including approval-flow support andWorkflowFactory(mcp_tool_handler=...). - Exposes the new MCP workflow types through declarative package exports and core re-exports.
- Adds unit tests plus a new declarative sample demonstrating MCP-backed document search with a downstream agent.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
python/samples/03-workflows/declarative/invoke_mcp_tool/workflow.yaml |
New sample workflow invoking an MCP tool, storing results, and passing context to an agent. |
python/samples/03-workflows/declarative/invoke_mcp_tool/main.py |
Sample runner for the MCP workflow, including optional approval prompts. |
python/packages/declarative/tests/test_invoke_mcp_tool_executor.py |
New executor-focused tests for validation, output handling, approval flow, and errors. |
python/packages/declarative/tests/test_default_mcp_tool_handler.py |
New handler-focused tests for caching, lifecycle, normalization, and error mapping. |
python/packages/declarative/AGENTS.md |
Documents the new MCP transport abstractions in the declarative package overview. |
python/packages/declarative/agent_framework_declarative/_workflows/_mcp_handler.py |
Implements the MCP handler protocol and default streamable-HTTP-backed handler. |
python/packages/declarative/agent_framework_declarative/_workflows/_factory.py |
Threads mcp_tool_handler through WorkflowFactory. |
python/packages/declarative/agent_framework_declarative/_workflows/_executors_mcp.py |
Adds the InvokeMcpTool executor, result parsing, approval flow, and conversation integration. |
python/packages/declarative/agent_framework_declarative/_workflows/_declarative_builder.py |
Registers InvokeMcpTool, validates required fields, and enforces handler presence. |
python/packages/declarative/agent_framework_declarative/_workflows/__init__.py |
Re-exports MCP executor and handler symbols from the workflows package. |
python/packages/declarative/agent_framework_declarative/__init__.py |
Re-exports MCP workflow symbols from the declarative package root. |
python/packages/core/agent_framework/declarative/__init__.pyi |
Updates type stubs for the new declarative MCP exports. |
python/packages/core/agent_framework/declarative/__init__.py |
Updates lazy core re-exports to surface the new declarative MCP types. |
Peter Ibekwe (peibekwe)
marked this pull request as ready for review
May 4, 2026 22:18
Peter Ibekwe (peibekwe)
requested review from
Tao Chen (TaoChenOSU),
Ben Thomas (alliscode) and
Evan Mattson (moonbox3)
May 4, 2026 22:18
Co-authored-by: Eduard van Valkenburg <eavanvalkenburg@users.noreply.github.com>
Ben Thomas (alliscode)
approved these changes
May 5, 2026
Tao Chen (TaoChenOSU)
approved these changes
May 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation and Context
Adds Python implementation of the InvokeMcpTool declarative workflow action, achieving parity with the .NET implementation. Workflow authors can now dispatch MCP calls directly from YAML.
The PR also includes sample to showcase the use of the new action.
Fixes #5625
Contribution Checklist