Commit f456351
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 f456351
2 files changed
Lines changed: 4 additions & 42 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
| 56 | + | |
65 | 57 | | |
66 | 58 | | |
67 | 59 | | |
| |||
339 | 331 | | |
340 | 332 | | |
341 | 333 | | |
342 | | - | |
343 | | - | |
344 | | - | |
345 | | - | |
346 | | - | |
347 | | - | |
348 | | - | |
349 | | - | |
350 | | - | |
351 | | - | |
352 | | - | |
353 | | - | |
| 334 | + | |
354 | 335 | | |
355 | 336 | | |
356 | 337 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
| 47 | + | |
56 | 48 | | |
57 | 49 | | |
58 | 50 | | |
| |||
228 | 220 | | |
229 | 221 | | |
230 | 222 | | |
231 | | - | |
232 | | - | |
233 | | - | |
234 | | - | |
235 | | - | |
236 | | - | |
237 | | - | |
238 | | - | |
239 | | - | |
240 | | - | |
241 | | - | |
242 | | - | |
| 223 | + | |
243 | 224 | | |
244 | 225 | | |
245 | 226 | | |
| |||
0 commit comments