Skip to content

Commit eb0ccf9

Browse files
committed
changed AnyUrl to str for URIs
1 parent 9eae96a commit eb0ccf9

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/mcp/types.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
from typing import Annotated, Any, Generic, Literal, TypeAlias, TypeVar
33

44
from pydantic import BaseModel, ConfigDict, Field, FileUrl, RootModel
5-
from pydantic.networks import AnyUrl, UrlConstraints
65
from typing_extensions import deprecated
76

87
"""
@@ -431,7 +430,7 @@ class Annotations(BaseModel):
431430
class Resource(BaseMetadata):
432431
"""A known resource that the server is capable of reading."""
433432

434-
uri: Annotated[AnyUrl, UrlConstraints(host_required=False)]
433+
uri: str
435434
"""The URI of this resource."""
436435
description: str | None = None
437436
"""A description of what this resource represents."""
@@ -502,7 +501,7 @@ class ListResourceTemplatesResult(PaginatedResult):
502501
class ReadResourceRequestParams(RequestParams):
503502
"""Parameters for reading a resource."""
504503

505-
uri: Annotated[AnyUrl, UrlConstraints(host_required=False)]
504+
uri: str
506505
"""
507506
The URI of the resource to read. The URI can use any protocol; it is up to the
508507
server how to interpret it.
@@ -520,7 +519,7 @@ class ReadResourceRequest(Request[ReadResourceRequestParams, Literal["resources/
520519
class ResourceContents(BaseModel):
521520
"""The contents of a specific resource or sub-resource."""
522521

523-
uri: Annotated[AnyUrl, UrlConstraints(host_required=False)]
522+
uri: str
524523
"""The URI of this resource."""
525524
mimeType: str | None = None
526525
"""The MIME type of this resource, if known."""
@@ -570,7 +569,7 @@ class ResourceListChangedNotification(
570569
class SubscribeRequestParams(RequestParams):
571570
"""Parameters for subscribing to a resource."""
572571

573-
uri: Annotated[AnyUrl, UrlConstraints(host_required=False)]
572+
uri: str
574573
"""
575574
The URI of the resource to subscribe to. The URI can use any protocol; it is up to
576575
the server how to interpret it.
@@ -591,7 +590,7 @@ class SubscribeRequest(Request[SubscribeRequestParams, Literal["resources/subscr
591590
class UnsubscribeRequestParams(RequestParams):
592591
"""Parameters for unsubscribing from a resource."""
593592

594-
uri: Annotated[AnyUrl, UrlConstraints(host_required=False)]
593+
uri: str
595594
"""The URI of the resource to unsubscribe from."""
596595
model_config = ConfigDict(extra="allow")
597596

@@ -609,7 +608,7 @@ class UnsubscribeRequest(Request[UnsubscribeRequestParams, Literal["resources/un
609608
class ResourceUpdatedNotificationParams(NotificationParams):
610609
"""Parameters for resource update notifications."""
611610

612-
uri: Annotated[AnyUrl, UrlConstraints(host_required=False)]
611+
uri: str
613612
"""
614613
The URI of the resource that has been updated. This might be a sub-resource of the
615614
one that the client actually subscribed to.

0 commit comments

Comments
 (0)