Skip to content

Conversation

@giles17
Copy link
Contributor

@giles17 giles17 commented Jan 29, 2026

Motivation and Context

Filters out response_format from kwargs before forwarding to MCP servers, preventing serialization errors when using structured outputs with MCP tools.
Also added three unit tests for logging level configuration in MCP connections (unrelated to the PR's stated purpose).

Resolves #3483

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 January 29, 2026 00:11
@github-actions github-actions bot changed the title Filter response_format from MCP tool call kwargs Python: Filter response_format from MCP tool call kwargs Jan 29, 2026
@markwallace-microsoft
Copy link
Member

markwallace-microsoft commented Jan 29, 2026

Python Test Coverage

Python Test Coverage Report •
FileStmtsMissCoverMissing
packages/core/agent_framework
   _mcp.py3885386%112, 174, 183, 246, 254, 275, 365, 432, 467, 469, 473–474, 476–477, 531, 546, 564, 605, 711, 724–729, 751, 772, 775–777, 792–793, 799–801, 820, 829, 832–834, 849–850, 854–858, 875–879, 1019
TOTAL16249234185% 

Python Unit Test Overview

Tests Skipped Failures Errors Time
3484 221 💤 0 ❌ 0 🔥 1m 7s ⏱️

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

This PR aims to fix a bug where MCP tool calls fail when non-serializable framework arguments like response_format are passed through. The fix adds response_format to the exclusion list in the call_tool method's filtering logic.

Changes:

  • Added response_format to the framework kwargs exclusion set in MCPTool.call_tool() method
  • Added three unit tests for logging level configuration in MCP connections (unrelated to the PR's stated purpose)

Reviewed changes

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

File Description
python/packages/core/agent_framework/_mcp.py Adds response_format to the exclusion set when filtering kwargs before passing to MCP session
python/packages/core/tests/core/test_mcp.py Adds three tests for MCP server logging level configuration (appears unrelated to response_format filtering)

@giles17 giles17 enabled auto-merge January 29, 2026 17:37
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.

3 participants