Skip to content

Python: Fix MCP tool calls sending empty arguments when inputSchema lacks properties#3861

Closed
giles17 wants to merge 2 commits intomicrosoft:mainfrom
giles17:mcp_schema_fix
Closed

Python: Fix MCP tool calls sending empty arguments when inputSchema lacks properties#3861
giles17 wants to merge 2 commits intomicrosoft:mainfrom
giles17:mcp_schema_fix

Conversation

@giles17
Copy link
Contributor

@giles17 giles17 commented Feb 11, 2026

Fixes a bug where MCPStreamableHTTPTool (and other MCP tool types) sends empty {} arguments to the MCP server when the server's inputSchema has no properties key (e.g., {"type": "object"}).

Motivation and Context

Description

Contribution Checklist

  • The code builds clean without any errors or warnings
  • The PR follows the Contribution Guidelines
  • All unit tests pass, and I have added new tests where possible
  • Is this a breaking change? If yes, add "[BREAKING]" prefix to the title of the PR.

Copilot AI review requested due to automatic review settings February 11, 2026 18:29
@github-actions github-actions bot changed the title Fix MCP tool calls sending empty arguments when inputSchema lacks properties Python: Fix MCP tool calls sending empty arguments when inputSchema lacks properties Feb 11, 2026
@markwallace-microsoft
Copy link
Member

markwallace-microsoft commented Feb 11, 2026

Python Test Coverage

Python Test Coverage Report •
FileStmtsMissCoverMissing
packages/core/agent_framework
   _tools.py7248288%176–177, 300, 302, 319–321, 328, 346, 360, 372, 377, 379, 386, 419, 490–492, 533, 555–583, 618, 626, 869, 1121, 1178, 1182, 1261–1265, 1283, 1285–1286, 1398, 1402, 1452, 1454, 1470, 1472, 1536, 1563, 1620, 1688, 1867–1868, 1895, 1903, 1916, 1926–1927, 1962, 2018, 2050
TOTAL16809211087% 

Python Unit Test Overview

Tests Skipped Failures Errors Time
4013 225 💤 0 ❌ 0 🔥 1m 11s ⏱️

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes MCP tool invocation dropping tool-call arguments when an MCP server returns an inputSchema without properties (e.g., {"type":"object"}), by ensuring the dynamically generated Pydantic input model preserves extra fields.

Changes:

  • Update JSON-schema → Pydantic model generation to allow extra fields when properties is missing/empty.
  • Add a regression test intended to ensure MCPStreamableHTTPTool forwards arguments for schemas without properties.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
python/packages/core/agent_framework/_tools.py Generates Pydantic models with extra="allow" for schemas missing/empty properties, preventing argument loss during model_validate/model_dump.
python/packages/core/tests/core/test_mcp.py Adds a regression test covering MCP tool schemas without properties / with empty properties.

@giles17 giles17 enabled auto-merge February 11, 2026 18:52
@giles17 giles17 closed this Feb 13, 2026
auto-merge was automatically disabled February 13, 2026 15:24

Pull request was closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants