Skip to content

Allow boolean and enum in registerPrompt argsSchema #691

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

ataylorme
Copy link

Motivation and Context

Being able to take user input that is boolean or enumerated values is useful when creating prompt callback functions and allows deeper prompt argument validation than strings only.

How Has This Been Tested?

Unit test coverage added

Breaking Changes

No breaking changes, backwards compatibility is maintained

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

Other Zod types, such as number, could be supported as well

Copy link

@mcp-shadow mcp-shadow bot left a comment

Choose a reason for hiding this comment

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

This PR introduces types for prompt arguments that are not supported by the MCP protocol specification. The protocol clearly defines prompt arguments as string-only ({ [key: string]: string }). Adding boolean and enum support would require a protocol specification change first, not just an SDK modification. This change would break compatibility with other MCP implementations and violates the protocol contract.

@ihrpr
Copy link
Contributor

ihrpr commented Jun 25, 2025

Thank you for working on improving SDK! This change needs to be done on the spec level, I'd suggest adding Issue/PR to the spec and if approved we can add this change, closing this PR for now.

@ataylorme
Copy link
Author

@ihrpr thank you for the feedback. I opened #710 with enum support only as those are strings. I also opened modelcontextprotocol/modelcontextprotocol#875 in the spec to request boolean support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants