|
1 | 1 | from collections.abc import Callable |
2 | | -from typing import Annotated, Any, Generic, Literal, TypeAlias, TypeVar |
| 2 | +from typing import Annotated, Any, Final, Generic, Literal, TypeAlias, TypeVar |
3 | 3 |
|
4 | 4 | from pydantic import BaseModel, ConfigDict, Field, FileUrl, RootModel |
5 | 5 | from pydantic.networks import AnyUrl, UrlConstraints |
|
23 | 23 | not separate types in the schema. |
24 | 24 | """ |
25 | 25 |
|
26 | | -LATEST_PROTOCOL_VERSION = "2025-06-18" |
| 26 | +LATEST_PROTOCOL_VERSION: Final = "2025-06-18" |
27 | 27 |
|
28 | 28 | """ |
29 | 29 | The default negotiated version of the Model Context Protocol when no version is specified. |
30 | 30 | We need this to satisfy the MCP specification, which requires the server to assume a |
31 | 31 | specific version if none is provided by the client. See section "Protocol Version Header" at |
32 | 32 | https://modelcontextprotocol.io/specification |
33 | 33 | """ |
34 | | -DEFAULT_NEGOTIATED_VERSION = "2025-03-26" |
| 34 | +DEFAULT_NEGOTIATED_VERSION: Final = "2025-03-26" |
35 | 35 |
|
36 | 36 | ProgressToken = str | int |
37 | 37 | Cursor = str |
@@ -147,15 +147,14 @@ class JSONRPCResponse(BaseModel): |
147 | 147 |
|
148 | 148 |
|
149 | 149 | # SDK error codes |
150 | | -CONNECTION_CLOSED = -32000 |
| 150 | +CONNECTION_CLOSED: Final = -32000 |
151 | 151 | # REQUEST_TIMEOUT = -32001 # the typescript sdk uses this |
152 | | - |
153 | 152 | # Standard JSON-RPC error codes |
154 | | -PARSE_ERROR = -32700 |
155 | | -INVALID_REQUEST = -32600 |
156 | | -METHOD_NOT_FOUND = -32601 |
157 | | -INVALID_PARAMS = -32602 |
158 | | -INTERNAL_ERROR = -32603 |
| 153 | +PARSE_ERROR: Final = -32700 |
| 154 | +INVALID_REQUEST: Final = -32600 |
| 155 | +METHOD_NOT_FOUND: Final = -32601 |
| 156 | +INVALID_PARAMS: Final = -32602 |
| 157 | +INTERNAL_ERROR: Final = -32603 |
159 | 158 |
|
160 | 159 |
|
161 | 160 | class ErrorData(BaseModel): |
|
0 commit comments