Skip to content

fix(memory): use plain JSON Schema for outputSchema instead of Zod objects - #3627

Closed
ghost wants to merge 1 commit into
mainfrom
unknown repository
Closed

fix(memory): use plain JSON Schema for outputSchema instead of Zod objects#3627
ghost wants to merge 1 commit into
mainfrom
unknown repository

Conversation

@ghost

@ghost ghost commented Mar 18, 2026

Copy link
Copy Markdown

Problem

The memory server passes plain objects with Zod values as outputSchema:

outputSchema: {
  entities: z.array(EntitySchema)  // plain object, not z.object()
}

The SDK's McpServer.tool() expects outputSchema to be a full Zod schema (z.object()), not a plain object containing Zod schemas. This causes TypeScript type errors (AnySchema mismatch) and serialization failures when the SDK tries to convert via schemaToJson().

Fix

Wrapped all 9 outputSchema definitions in z.object():

- outputSchema: {
-   entities: z.array(EntitySchema)
- }
+ outputSchema: z.object({
+   entities: z.array(EntitySchema)
+ })

The SDK's schemaToJson() then correctly converts the Zod schema to JSON Schema for the tools/list response.

Fixes #3622

The memory server passed plain objects with Zod values as outputSchema
properties (e.g. { entities: z.array(...) }), but the SDK expects
outputSchema to be a full Zod schema (z.object({ ... })). This causes
type errors and serialization failures.

Wrapped all 9 outputSchema definitions in z.object() so the SDK can
properly convert them to JSON Schema via schemaToJson().

Fixes #3622
@ghost ghost closed this by deleting the head repository Mar 26, 2026
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

outputSchema uses Zod objects instead of JSON Schema, violating spec and causing serialization failures

1 participant