Commit 5fcd54d
fix: handle ZodNullable and ZodDefault in legacy schema optionality check
The legacy schema format's `generateSchemaFromLegacyFormat()` only checked
for `z.ZodOptional` when determining required fields. This caused fields
using `z.nullable()` or `z.default()` to be incorrectly marked as required,
showing an asterisk (*) in the MCP inspector.
Also fixes `getJsonSchemaType()` to properly unwrap all three wrapper types
when resolving the base JSON schema type.
Fixes #118
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent a385629 commit 5fcd54d
1 file changed
Lines changed: 24 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
832 | 832 | | |
833 | 833 | | |
834 | 834 | | |
835 | | - | |
836 | | - | |
| 835 | + | |
| 836 | + | |
837 | 837 | | |
838 | 838 | | |
839 | 839 | | |
| |||
947 | 947 | | |
948 | 948 | | |
949 | 949 | | |
950 | | - | |
| 950 | + | |
951 | 951 | | |
952 | | - | |
953 | | - | |
| 952 | + | |
| 953 | + | |
| 954 | + | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
| 958 | + | |
| 959 | + | |
| 960 | + | |
| 961 | + | |
954 | 962 | | |
955 | 963 | | |
956 | 964 | | |
| |||
961 | 969 | | |
962 | 970 | | |
963 | 971 | | |
| 972 | + | |
| 973 | + | |
| 974 | + | |
| 975 | + | |
| 976 | + | |
| 977 | + | |
| 978 | + | |
| 979 | + | |
| 980 | + | |
| 981 | + | |
| 982 | + | |
964 | 983 | | |
965 | 984 | | |
966 | 985 | | |
| |||
0 commit comments