Repository navigation
Commit 400777f
feat(time): build on MCPServer; an unknown tool is JSON-RPC -32602
The time server moves from the SDK's low-level Server, wrapped to keep
SDK v1's behavior, to the high-level MCPServer (modelcontextprotocol#5174):
- Each tool is a typed function. MCPServer derives the input schema,
validates arguments, and returns the result model as structuredContent
with an outputSchema, plus the same object as indented JSON text.
- Anticipated failures (invalid or empty timezone, bad HH:MM, a time
skipped by a clock change) raise ToolError: an isError result prefixed
"Error executing tool <name>: ", in place of v1's "Error processing
mcp-server-time query: " prefix and its jsonschema messages.
- An unknown tool is a JSON-RPC -32602 error ("Unknown tool: <name>") in
both eras, as both spec revisions require. MCPServer still answers it
with isError (python-sdk#3659), so a middleware rejects the name first.
- subscriptions=False: the tools never change, so neither era claims
listChanged. MCPServer advertises empty prompts and resources.
- The jsonschema dependency and the v1 wrappers are gone.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Signed-off-by: cliffhall <[email protected]>1 parent 4c7fcdf commit 400777f
7 files changed
Lines changed: 365 additions & 316 deletions
File tree
- src/time
- src/mcp_server_time
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
29 | 37 | | |
30 | 38 | | |
31 | 39 | | |
| |||
221 | 229 | | |
222 | 230 | | |
223 | 231 | | |
224 | | - | |
| 232 | + | |
225 | 233 | | |
226 | 234 | | |
227 | 235 | | |
228 | 236 | | |
| 237 | + | |
229 | 238 | | |
230 | 239 | | |
231 | 240 | | |
| |||
241 | 250 | | |
242 | 251 | | |
243 | 252 | | |
244 | | - | |
| 253 | + | |
245 | 254 | | |
246 | 255 | | |
247 | 256 | | |
248 | 257 | | |
249 | | - | |
| 258 | + | |
| 259 | + | |
250 | 260 | | |
251 | 261 | | |
252 | 262 | | |
253 | 263 | | |
254 | | - | |
| 264 | + | |
| 265 | + | |
255 | 266 | | |
256 | 267 | | |
257 | | - | |
| 268 | + | |
258 | 269 | | |
259 | 270 | | |
260 | 271 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
21 | 20 | | |
22 | 21 | | |
23 | 22 | | |
| |||
0 commit comments