From 7430a3e9d0a05479cb722fe353ada5243f2bec8c Mon Sep 17 00:00:00 2001 From: Dhravya Shah Date: Tue, 18 Aug 2026 20:54:09 -0700 Subject: [PATCH] fix(mcp): strip API extras from listMemories entries MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The client parsed /v4/memories/list with z.looseObject, which keeps unknown keys. The API returns extra per-entry fields (spaceId, orgId, metadata, memoryRelations, temporalContext, forgetReason, …) that flow into structuredContent, which is validated against the strict tool outputSchema (additionalProperties: false) — producing "data/memoryEntries/N must NOT have additional properties". Switch memoryEntrySchema and memoryEntryHistorySchema to z.object, which strips unknown keys on parse while still tolerating new API fields. Co-Authored-By: Claude Opus 4.8 --- apps/mcp/src/server/client/index.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/mcp/src/server/client/index.ts b/apps/mcp/src/server/client/index.ts index ad9695a4..21574bbf 100644 --- a/apps/mcp/src/server/client/index.ts +++ b/apps/mcp/src/server/client/index.ts @@ -34,7 +34,8 @@ export interface DocumentsListResponse { pagination: SdkDocumentListResponse["pagination"] } -const memoryEntryHistorySchema = z.looseObject({ +// z.object strips API extras that the strict MCP output schema would reject. +const memoryEntryHistorySchema = z.object({ id: z.string(), memory: z.string(), version: z.number(), @@ -48,7 +49,7 @@ const memoryEntryHistorySchema = z.looseObject({ export type MemoryEntryHistory = z.infer -const memoryEntrySchema = z.looseObject({ +const memoryEntrySchema = z.object({ id: z.string(), memory: z.string(), version: z.number(),