Commit d07003c
committed
fix: use getLiteralValue for method literal extraction in setRequestHandler
Replace inline Zod v3/v4 literal extraction in Server.setRequestHandler
and Client.setRequestHandler with the existing getLiteralValue() helper
from zod-compat.ts, which already handles the _def.values[0] fallback
for late Zod v3 releases (e.g., zod@3.25.1) where the literal value is
stored under _def.values instead of _def.value.
This fixes "Schema method literal must be a string" errors when
constructing McpServer with zod@3.25.x.
Fixes #13801 parent 9edbab7 commit d07003c
2 files changed
Lines changed: 4 additions & 30 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
| 59 | + | |
59 | 60 | | |
60 | | - | |
61 | 61 | | |
62 | | - | |
63 | | - | |
64 | 62 | | |
65 | 63 | | |
66 | 64 | | |
| |||
339 | 337 | | |
340 | 338 | | |
341 | 339 | | |
342 | | - | |
343 | | - | |
344 | | - | |
345 | | - | |
346 | | - | |
347 | | - | |
348 | | - | |
349 | | - | |
350 | | - | |
351 | | - | |
352 | | - | |
353 | | - | |
| 340 | + | |
354 | 341 | | |
355 | 342 | | |
356 | 343 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| 49 | + | |
49 | 50 | | |
50 | | - | |
51 | 51 | | |
52 | 52 | | |
53 | | - | |
54 | | - | |
55 | 53 | | |
56 | 54 | | |
57 | 55 | | |
| |||
228 | 226 | | |
229 | 227 | | |
230 | 228 | | |
231 | | - | |
232 | | - | |
233 | | - | |
234 | | - | |
235 | | - | |
236 | | - | |
237 | | - | |
238 | | - | |
239 | | - | |
240 | | - | |
241 | | - | |
242 | | - | |
| 229 | + | |
243 | 230 | | |
244 | 231 | | |
245 | 232 | | |
| |||
0 commit comments