Skip to content

SEP-1577 follow-ups#646

Open
DaleSeo wants to merge 1 commit intomodelcontextprotocol:mainfrom
DaleSeo:SEP-1577-follow-up
Open

SEP-1577 follow-ups#646
DaleSeo wants to merge 1 commit intomodelcontextprotocol:mainfrom
DaleSeo:SEP-1577-follow-up

Conversation

@DaleSeo
Copy link
Contributor

@DaleSeo DaleSeo commented Feb 6, 2026

Motivation and Context

The SEP-1577 implementation in PR #628 doesn't fully enforce the spec's MUST requirements.

This PR adds a validate() method to CreateMessageRequestParams that checks role constraints (ToolUse only in assistant messages, ToolResult only in user messages), ensures tool result messages don't mix in other content types, and verifies that every ToolUse is balanced with a corresponding ToolResult. A matching validate() on CreateMessageResult enforces that the role is always "assistant".

How Has This Been Tested?

8 new unit tests covering all validation paths (role constraints, exclusivity, balance, result role)

Breaking Changes

None. The removed enums and unvalidated create_message behavior were introduced in PR #628, which has not been released.

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

@github-actions github-actions bot added T-test Testing related changes T-core Core library changes T-model Model/data structure changes T-service Service layer changes labels Feb 6, 2026
@DaleSeo DaleSeo marked this pull request as ready for review February 6, 2026 22:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

T-core Core library changes T-model Model/data structure changes T-service Service layer changes T-test Testing related changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant