Commit a4446d8
committed
fix(time): use McpError for proper JSON-RPC error propagation
Two fixes in the time server:
1. call_tool handler (line 216): Was raising plain ValueError instead of
McpError. The MCP protocol requires JSON-RPC errors via McpError with
proper error codes. A ValueError propagates as a generic internal error
to the client, losing the error context.
2. get_zoneinfo (line 56): Catch KeyError specifically for unknown
timezones vs. generic exceptions for invalid timezone strings. Gives
the client more precise error messages ('Unknown timezone' vs
'Invalid timezone').1 parent d31124c commit a4446d8
1 file changed
Lines changed: 4 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
| 56 | + | |
| 57 | + | |
56 | 58 | | |
57 | | - | |
| 59 | + | |
58 | 60 | | |
59 | 61 | | |
60 | 62 | | |
| |||
213 | 215 | | |
214 | 216 | | |
215 | 217 | | |
216 | | - | |
| 218 | + | |
217 | 219 | | |
218 | 220 | | |
219 | 221 | | |
| |||
0 commit comments