Skip to content

Python: Respect optional MCP prompt arguments - #14676

Merged
Eduard van Valkenburg (eavanvalkenburg) merged 1 commit into
microsoft:mainfrom
jaeminbird:fix-mcp-prompt-optional-args
Nov 2, 2026
Merged

Eduard van Valkenburg (eavanvalkenburg) merged 1 commit into
microsoft:mainfrom
jaeminbird:fix-mcp-prompt-optional-args

Conversation

@jaeminbird

Copy link
Copy Markdown
Contributor

Motivation and Context

MCP prompts are loaded with every argument marked required, ignoring PromptArgument.required (optional; absent means not required). The function-calling schema then lists all of them as required, and invoking the prompt without an optional argument fails with "Parameter style is required but not provided in the arguments."

Description

Use bool(prompt_argument.required).

  • New test: required/optional/absent arguments map to True/False/False, and invoking with only the required one sends arguments={"code": ...}; fails before, passes after.
  • tests/unit/connectors/mcp, tests/unit/functions and tests/unit/kernel pass; ruff and mypy clean.

Contribution Checklist

Copilot AI balanced review requested due to automatic review settings October 29, 2026 06:19
@jaeminbird
Jae Birdsall (jaeminbird) requested a review from a team as a code owner October 29, 2026 06:20

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

@semantic-kernel-automation semantic-kernel-automation Bot added the python Pull requests for the Python Semantic Kernel label Oct 29, 2026
Merged via the queue into microsoft:main with commit 6bfdcb8 Nov 2, 2026
34 checks passed
@jaeminbird
Jae Birdsall (jaeminbird) deleted the fix-mcp-prompt-optional-args branch November 2, 2026 15:44

This branch was successfully deployed

1 active deployment
github-app-auth — f11804f5 Deployed Oct 29, 2026 by jaeminbird via add_label #29481
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

python Pull requests for the Python Semantic Kernel

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants