Repository navigation
Python: Call MCP tools with optional taskSupport through plain tools/call - #9690
Closed
NingLin Liu (ninglinLiu) wants to merge 1 commit into
Closed
NingLin Liu (ninglinLiu) wants to merge 1 commit into
NingLin Liu (ninglinLiu) wants to merge 1 commit into
Conversation
NingLin Liu (ninglinLiu)
requested review from
SergeyMenshykh,
Tao Chen (TaoChenOSU),
Eduard van Valkenburg (eavanvalkenburg),
Giles Odigwe (giles17),
Jose Alvarez (jpalvarezl),
Evan Mattson (moonbox3),
Roger Barreto (rogerbarreto),
sophia-ramsey and
westey (westey-m)
as code owners
October 25, 2026 17:38
NingLin Liu (ninglinLiu)
temporarily deployed
to
github-app-auth
October 25, 2026 17:38 — with
GitHub Actions
Inactive
NingLin Liu (ninglinLiu)
temporarily deployed
to
github-app-auth
October 25, 2026 17:38 — with
GitHub Actions
Inactive
NingLin Liu (ninglinLiu)
had a problem deploying
to
github-app-auth
October 25, 2026 17:38 — with
GitHub Actions
Error
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The narrow fix matches the documented behavior, includes focused regression coverage, and has no unresolved findings.
No open issues 🎉
What changed in this PR
Restores Python MCP tools with optional task support, addressing #9675 while preserving the existing plain tools/call invocation path.
Changes:
- Skips only tools that require the Tasks extension and clarifies the warning.
- Updates regression coverage to verify optional tools load with metadata and are invoked, while required tools remain excluded.
| File | Description |
|---|---|
python/packages/core/tests/core/test_mcp.py |
Updates assertions for tool loading, metadata, invocation, and skip warnings. |
python/packages/core/agent_framework/_mcp.py |
Allows optional-task tools through the existing loading and invocation path. |
Review effort: Balanced
6 of 7 tasks
Member
|
Thank you for the contribution. However, the fix requires a couple of documentation updates as well. For the sake of speed, we will move forward with our own fix this time: #9746 |
This branch was successfully deployed
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 & Context
Since the MCP 2.x migration,
MCPTool._load_tools_lockedskips every tool whoseexecution.taskSupportis"required"or"optional". Per the MCP spec,"optional"means a client may add task augmentation, but a plaintools/callis still valid; only"required"tools need the Tasks extension. As reported in #9675, Foundry Toolbox marks its Power BI and Foundry IQ tools as"optional", so they all disappear from the agent after upgrading to 1.23, even though they worked as plain calls on 1.21.python/packages/core/AGENTS.mdalready documents the intended behavior: "Tools that advertiseexecution.taskSupport == "required"are skipped with a warning; optional and task-free tools continue through ordinarytools/call." The code didn't match it.Description & Review Guide
_load_tools_lockednow only applies totaskSupport == "required", and the warning says "requires" instead of "(might) require"."optional"tools are loaded and invoked through the existing plaintools/callpath (no task augmentation is sent)."optional"task support are available again."required"tools are still skipped with the same warning, and"forbidden"/unset tools are unchanged.test_load_tools_skips_task_capable_toolstest is renamed totest_load_tools_skips_only_task_required_toolsand now checks that the"optional"tool is loaded (with its_meta), is called throughcall_tool, and that only the"required"tool is logged as skipped. It fails onmainand passes with the change.Tests:
pytest packages/core/tests/core/test_mcp.py(463 passed, 2 skipped);ruff checkandruff format --checkon the changed files are clean.Related Issue
Fixes #9675
No open PR exists for this issue. The issue hasn't been labeled
ready-for-implementationyet; this small change brings the code in line with the behavior already documented inpython/packages/core/AGENTS.md, and I'm happy to adjust if maintainers prefer a different direction (e.g. making it configurable).AI Assistance
AI assistance details: issue analysis, implementation, test update, and this PR description were prepared with AI assistance and reviewed/tested by the author.
Contribution Checklist
breaking changelabel (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.