Skip to content

Make sure RequestId is not coerced as int #1178

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

Merged
merged 1 commit into from
Jul 21, 2025
Merged

Make sure RequestId is not coerced as int #1178

merged 1 commit into from
Jul 21, 2025

Conversation

Kludex
Copy link
Member

@Kludex Kludex commented Jul 21, 2025

@Kludex Kludex requested review from a team, ochafik and ihrpr July 21, 2025 09:01
@@ -849,7 +849,7 @@ class Tool(BaseMetadata):
"""A JSON Schema object defining the expected parameters for the tool."""
outputSchema: dict[str, Any] | None = None
"""
An optional JSON Schema object defining the structure of the tool's output
An optional JSON Schema object defining the structure of the tool's output
Copy link
Member Author

Choose a reason for hiding this comment

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

Somehow there are empty spaces? This shouldn't happen.

@@ -36,7 +36,7 @@
ProgressToken = str | int
Cursor = str
Role = Literal["user", "assistant"]
RequestId = Annotated[int | str, Field(union_mode="left_to_right")]
RequestId = Annotated[int, Field(strict=True)] | str
Copy link
Member Author

Choose a reason for hiding this comment

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

This just makes sure that only int that is an int is actually an int. 👀

i.e. a string that looks like an int doesn't become an int.

Copy link
Contributor

@ihrpr ihrpr left a comment

Choose a reason for hiding this comment

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

LGTM

@ihrpr ihrpr merged commit 7570ba3 into main Jul 21, 2025
13 checks passed
@ihrpr ihrpr deleted the fix-request-id branch July 21, 2025 09:57
@ns-amurugesan
Copy link

@ihrpr how do I use this fix? I am on mcp==1.12.0

@Kludex
Copy link
Member Author

Kludex commented Jul 21, 2025

@ihrpr how do I use this fix? I am on mcp==1.12.0

You need to wait for a release.

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.

Response ID-value not matching request value, due to default int
3 participants