Skip to content

Commit 9c5d1d6

Browse files
refactor: use native z.toJSONSchema() instead of external library
Replace zodToJsonSchema() calls with Zod v4's native z.toJSONSchema() method. Use default options (JSON Schema Draft 2020-12) for simplicity and standard compliance. Removed unnecessary options: - target: 'openapi-3.0' - default draft-2020-12 is appropriate for MCP - strictUnions: true - option doesn't exist in Zod v4's native implementation
1 parent b37056b commit 9c5d1d6

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

src/server/mcp.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -102,18 +102,14 @@ export class McpServer {
102102
title: tool.title,
103103
description: tool.description,
104104
inputSchema: tool.inputSchema
105-
? (zodToJsonSchema(tool.inputSchema, {
106-
strictUnions: true
107-
}) as Tool['inputSchema'])
105+
? (z.toJSONSchema(tool.inputSchema) as Tool['inputSchema'])
108106
: EMPTY_OBJECT_JSON_SCHEMA,
109107
annotations: tool.annotations,
110108
_meta: tool._meta
111109
};
112110

113111
if (tool.outputSchema) {
114-
toolDefinition.outputSchema = zodToJsonSchema(tool.outputSchema, {
115-
strictUnions: true
116-
}) as Tool['outputSchema'];
112+
toolDefinition.outputSchema = z.toJSONSchema(tool.outputSchema) as Tool['outputSchema'];
117113
}
118114

119115
return toolDefinition;

0 commit comments

Comments
 (0)