Commit d7d87a3
committed
fix(server): handle ZodObject in RegisteredTool.update (#1960)
The create path uses `getZodSchemaObject()` which accepts both raw
shapes and ZodObject instances. The update path was calling
`objectFromShape()` directly, which iterates `Object.values(shape)` and
blows up on internal Zod fields when given a ZodObject (e.g.
`z.object({...}).passthrough()`):
TypeError: Cannot read properties of null (reading '_zod')
Mirror the create path so updating with either form works. Also
widen the `paramsSchema` / `outputSchema` generics on
`RegisteredTool.update` to match `registerTool` (`ZodRawShapeCompat | AnySchema`),
fixing the type-level inconsistency called out in #1960.
Fixes #19601 parent bf1e022 commit d7d87a3
2 files changed
Lines changed: 72 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
905 | 905 | | |
906 | 906 | | |
907 | 907 | | |
908 | | - | |
909 | | - | |
| 908 | + | |
| 909 | + | |
910 | 910 | | |
911 | 911 | | |
912 | 912 | | |
| |||
1312 | 1312 | | |
1313 | 1313 | | |
1314 | 1314 | | |
1315 | | - | |
| 1315 | + | |
1316 | 1316 | | |
1317 | 1317 | | |
1318 | 1318 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
407 | 407 | | |
408 | 408 | | |
409 | 409 | | |
410 | | - | |
| 410 | + | |
411 | 411 | | |
412 | 412 | | |
413 | 413 | | |
| |||
534 | 534 | | |
535 | 535 | | |
536 | 536 | | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
537 | 603 | | |
538 | 604 | | |
539 | 605 | | |
| |||
574 | 640 | | |
575 | 641 | | |
576 | 642 | | |
577 | | - | |
| 643 | + | |
578 | 644 | | |
579 | 645 | | |
580 | 646 | | |
| |||
661 | 727 | | |
662 | 728 | | |
663 | 729 | | |
664 | | - | |
| 730 | + | |
665 | 731 | | |
666 | 732 | | |
667 | 733 | | |
| |||
0 commit comments