From 57c2c685ffb1f95f355f166a17c2efd346890106 Mon Sep 17 00:00:00 2001 From: Ricky Schema Cascade Date: Wed, 13 May 2026 10:43:34 +0200 Subject: [PATCH] fix(mcp-workforce): align memory scope enum with PersonaMemoryScope MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit mcp-workforce was landed in #91 against an older `PersonaMemoryScope` shape (`session | user | workspace | org | object`). #94 then tightened the type to `workspace | user | global`. Both PRs passed CI independently, but main is now broken at build time because the zod enum in `server.ts` and the runtime `VALID_SCOPES` Set in `tools/memory.ts` still reference the removed literals. Aligning both call sites to the canonical persona-kit shape: - `MEMORY_SCOPE_ENUM` → z.enum(['workspace', 'user', 'global']) - `VALID_SCOPES` → new Set(['workspace', 'user', 'global']) - memory.save tool description updated to match The default scope stays `workspace`. Callers that previously passed `'session'`/`'org'`/`'object'` will now get a validation error from the zod schema before the runtime check — preferable to silently mapping them to a different scope. Verified: `pnpm -F @agentworkforce/mcp-workforce typecheck` + `build` + `test` (23/23) all pass. Co-Authored-By: Claude Opus 4.7 --- packages/mcp-workforce/src/server.ts | 4 ++-- packages/mcp-workforce/src/tools/memory.ts | 6 ++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/packages/mcp-workforce/src/server.ts b/packages/mcp-workforce/src/server.ts index e4f36d5..c9d0f80 100644 --- a/packages/mcp-workforce/src/server.ts +++ b/packages/mcp-workforce/src/server.ts @@ -10,7 +10,7 @@ import { type IntegrationToolName } from './tools/integrations.js'; -const MEMORY_SCOPE_ENUM = z.enum(['session', 'user', 'workspace', 'org', 'object']); +const MEMORY_SCOPE_ENUM = z.enum(['workspace', 'user', 'global']); /** * Build an `McpServer` with workforce-flavored tools registered. Exposed @@ -62,7 +62,7 @@ export function createWorkforceMcpServer(config: WorkforceMcpConfig): McpServer { title: 'Save a memory entry', description: - 'Persist a memory entry for the active workspace. Scopes follow @agent-assistant/memory semantics: session, user, workspace, org, object. Tags are deduped; workspace/scope tags are added automatically.', + 'Persist a memory entry for the active workspace. Scope is one of workspace (default) / user / global, matching @agentworkforce/persona-kit\'s PersonaMemoryScope. Tags are deduped; workspace/scope tags are added automatically.', inputSchema: { content: z.string().min(1), tags: z.array(z.string()).optional(), diff --git a/packages/mcp-workforce/src/tools/memory.ts b/packages/mcp-workforce/src/tools/memory.ts index 54a4ddb..0400f63 100644 --- a/packages/mcp-workforce/src/tools/memory.ts +++ b/packages/mcp-workforce/src/tools/memory.ts @@ -36,11 +36,9 @@ export interface MemoryToolDeps { } const VALID_SCOPES: ReadonlySet = new Set([ - 'session', - 'user', 'workspace', - 'org', - 'object' + 'user', + 'global' ]); /**