1- from abc import ABC , abstractmethod
1+ from abc import ABC
2+ from abc import abstractmethod
23from datetime import timedelta
4+
35from typing import Any
46
57from pydantic import AnyUrl
@@ -14,10 +16,11 @@ class TransportSession(ABC):
1416 @abstractmethod
1517 async def initialize (self ) -> types .InitializeResult :
1618 """Send an initialize request."""
17- ...
19+ raise NotImplementedError
1820
1921 @abstractmethod
20- async def send_ping (self ): ...
22+ async def send_ping (self ):
23+ raise NotImplementedError
2124
2225 @abstractmethod
2326 async def send_progress_notification (
@@ -26,46 +29,47 @@ async def send_progress_notification(
2629 progress : float ,
2730 total : float | None = None ,
2831 message : str | None = None ,
29- ) -> None : ...
32+ ) -> None :
33+ raise NotImplementedError
3034
3135 @abstractmethod
3236 async def set_logging_level (
3337 self ,
3438 level : types .LoggingLevel ,
3539 ) -> types .EmptyResult :
3640 """Send a logging/setLevel request."""
37- ...
41+ raise NotImplementedError
3842
3943 @abstractmethod
4044 async def list_resources (
4145 self ,
4246 cursor : str | None = None ,
4347 ) -> types .ListResourcesResult :
4448 """Send a resources/list request."""
45- ...
49+ raise NotImplementedError
4650
4751 @abstractmethod
4852 async def list_resource_templates (
4953 self ,
5054 cursor : str | None = None ,
5155 ) -> types .ListResourceTemplatesResult :
5256 """Send a resources/templates/list request."""
53- ...
57+ raise NotImplementedError
5458
5559 @abstractmethod
5660 async def read_resource (self , uri : AnyUrl ) -> types .ReadResourceResult :
5761 """Send a resources/read request."""
58- ...
62+ raise NotImplementedError
5963
6064 @abstractmethod
6165 async def subscribe_resource (self , uri : AnyUrl ) -> types .EmptyResult :
6266 """Send a resources/subscribe request."""
63- ...
67+ raise NotImplementedError
6468
6569 @abstractmethod
6670 async def unsubscribe_resource (self , uri : AnyUrl ) -> types .EmptyResult :
6771 """Send a resources/unsubscribe request."""
68- ...
72+ raise NotImplementedError
6973
7074 @abstractmethod
7175 async def call_tool (
@@ -76,7 +80,7 @@ async def call_tool(
7680 progress_callback : ProgressFnT | None = None ,
7781 ) -> types .CallToolResult :
7882 """Send a tools/call request with optional progress callback support."""
79- ...
83+ raise NotImplementedError
8084
8185 @abstractmethod
8286 async def _validate_tool_result (
@@ -86,15 +90,15 @@ async def _validate_tool_result(
8690 ) -> None :
8791 """Validate the structured content of a tool result against its output
8892 schema."""
89- ...
93+ raise NotImplementedError
9094
9195 @abstractmethod
9296 async def list_prompts (
9397 self ,
9498 cursor : str | None = None ,
9599 ) -> types .ListPromptsResult :
96100 """Send a prompts/list request."""
97- ...
101+ raise NotImplementedError
98102
99103 @abstractmethod
100104 async def get_prompt (
@@ -103,7 +107,7 @@ async def get_prompt(
103107 arguments : dict [str , str ] | None = None ,
104108 ) -> types .GetPromptResult :
105109 """Send a prompts/get request."""
106- ...
110+ raise NotImplementedError
107111
108112 @abstractmethod
109113 async def complete (
@@ -113,17 +117,17 @@ async def complete(
113117 context_arguments : dict [str , str ] | None = None ,
114118 ) -> types .CompleteResult :
115119 """Send a completion/complete request."""
116- ...
120+ raise NotImplementedError
117121
118122 @abstractmethod
119123 async def list_tools (
120124 self ,
121125 cursor : str | None = None ,
122126 ) -> types .ListToolsResult :
123127 """Send a tools/list request."""
124- ...
128+ raise NotImplementedError
125129
126130 @abstractmethod
127131 async def send_roots_list_changed (self ) -> None :
128132 """Send a roots/list_changed notification."""
129- ...
133+ raise NotImplementedError
0 commit comments