Skip to content
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

feat: update types to 2024-11-05 schema #165

Merged
merged 1 commit into from
Jan 24, 2025
Merged

Conversation

dsp-ant
Copy link
Member

@dsp-ant dsp-ant commented Jan 23, 2025

Summary

  • Update types to match 2024-11-05 schema
  • Add new types for request cancellation and annotations
  • Add size field to Resource type for context window estimation

Test plan

  • Run type checker
  • Verify all existing code compiles with new types
  • Test resource size reporting

src/mcp/types.py Outdated
@@ -344,6 +343,12 @@ class ListResourcesRequest(PaginatedRequest):
params: RequestParams | None = None


class Annotations(BaseModel):
audience: list[Role] | None = None
priority: float | None = None
Copy link
Contributor

Choose a reason for hiding this comment

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

[nit/non-blocking] the spec list min/max values for this (https://github.com/modelcontextprotocol/specification/blob/363e36b3fabad8ec6253e468a74c8f7fc972e539/schema/2024-11-05/schema.json#L18)

We could add pydantic level validation for this

Copy link
Member Author

Choose a reason for hiding this comment

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

Great point. Totally didnt remember that this was a thing. Thank you.

Copy link
Contributor

@jerome3o-anthropic jerome3o-anthropic left a comment

Choose a reason for hiding this comment

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

LGTM! (one non-blocking nit, happy to leave it, or to have it in a follow up)

@dsp-ant dsp-ant force-pushed the davidsp/types-2024-11-05 branch from 50e60d7 to bd74227 Compare January 24, 2025 09:53
@dsp-ant dsp-ant merged commit ba25ad6 into main Jan 24, 2025
4 checks passed
@dsp-ant dsp-ant deleted the davidsp/types-2024-11-05 branch January 24, 2025 09:53
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