Skip to content

Python: fix(core): leave out description for MCP prompt arguments that have none - #8733

Merged
Eduard van Valkenburg (eavanvalkenburg) merged 1 commit into
microsoft:mainfrom
anishmehta24:fix/mcp-prompt-argument-no-description
Sep 29, 2026
Merged

Eduard van Valkenburg (eavanvalkenburg) merged 1 commit into
microsoft:mainfrom
anishmehta24:fix/mcp-prompt-argument-no-description

Conversation

@anishmehta24

Copy link
Copy Markdown
Contributor

Motivation & Context

_get_input_model_from_mcp_prompt builds the argument schema with prompt_argument.description if hasattr(prompt_argument, "description") else "". PromptArgument always has the attribute (it's an optional pydantic field), so an argument without a description comes through as None:

p = types.Prompt(name="p", arguments=[types.PromptArgument(name="topic", required=True)])
_get_input_model_from_mcp_prompt(p)
# {'type': 'object', 'properties': {'topic': {'type': 'string', 'description': None}}, 'required': ['topic']}

description has to be a string in JSON Schema, so a provider that validates tool schemas strictly can reject the tool.

Description & Review Guide

  • What are the major changes? Add description only when the argument has one.
  • What is the impact of these changes? MCP prompts whose arguments have no description produce a valid schema.
  • What do you want reviewers to focus on? Leaving the key out rather than using "", since an empty description adds nothing.

Related Issue

No existing issue.

Contribution Checklist

  • The code builds clean without any errors or warnings
  • All unit tests pass, and I have added new tests where possible

Test: test_get_input_model_from_mcp_prompt_argument_without_description in tests/core/test_mcp.py; it fails on main. pytest packages/core/tests/core/test_mcp.py passes, and ruff and the repo's pre-commit checks are clean.

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 reached their quota limit.

@agent-framework-automation agent-framework-automation Bot added the python Usage: [Issues, PRs], Target: Python label Sep 24, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Anish Mehta (@anishmehta24) Reviewed the current head and found no blocking issues.

Merged via the queue into microsoft:main with commit 5a2b135 Sep 29, 2026
49 of 50 checks passed

This branch was previously deployed

1 inactive deployment
github-app-auth — d25d53f6 Deployed Sep 24, 2026 by anishmehta24 via team_check #5244
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

python Usage: [Issues, PRs], Target: Python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants