From 58c47a751ac4c294ac1369a3183f9c2ca9e8a561 Mon Sep 17 00:00:00 2001 From: Saravana Achu Mac Date: Sun, 29 Mar 2026 22:10:03 -0700 Subject: [PATCH] fix(mcp-server): pass workspaceId to notelett note get/update/delete/summarize tools Backend requires workspaceId query param on single-note endpoints. Updated client functions and tool schemas accordingly. Made-with: Cursor --- services/mcp-server/src/lib/notelett-client.ts | 12 ++++++++---- .../src/modules/notelett/notelett-tools.ts | 14 +++++++++----- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/services/mcp-server/src/lib/notelett-client.ts b/services/mcp-server/src/lib/notelett-client.ts index 94b27f96..86b4dfd9 100644 --- a/services/mcp-server/src/lib/notelett-client.ts +++ b/services/mcp-server/src/lib/notelett-client.ts @@ -61,9 +61,10 @@ export function noteLettNotesList( export function noteLettNoteGet( noteId: string, + workspaceId: string, opts: NoteLettClientOptions, ): Promise { - return noteFetch(`/notes/${noteId}`, { method: 'GET' }, opts); + return noteFetch(`/notes/${noteId}?workspaceId=${encodeURIComponent(workspaceId)}`, { method: 'GET' }, opts); } export function noteLettNoteCreate( @@ -75,24 +76,27 @@ export function noteLettNoteCreate( export function noteLettNoteUpdate( noteId: string, + workspaceId: string, input: { title?: string; content?: string }, opts: NoteLettClientOptions, ): Promise { - return noteFetch(`/notes/${noteId}`, { method: 'PATCH', body: JSON.stringify(input) }, opts); + return noteFetch(`/notes/${noteId}?workspaceId=${encodeURIComponent(workspaceId)}`, { method: 'PATCH', body: JSON.stringify(input) }, opts); } export function noteLettNoteDelete( noteId: string, + workspaceId: string, opts: NoteLettClientOptions, ): Promise { - return noteFetch(`/notes/${noteId}`, { method: 'DELETE' }, opts); + return noteFetch(`/notes/${noteId}?workspaceId=${encodeURIComponent(workspaceId)}`, { method: 'DELETE' }, opts); } export function noteLettNoteSummarize( noteId: string, + workspaceId: string, opts: NoteLettClientOptions, ): Promise<{ summary: string }> { - return noteFetch(`/notes/${noteId}/summarize`, { method: 'POST' }, opts); + return noteFetch(`/notes/${noteId}/summarize`, { method: 'POST', body: JSON.stringify({ workspaceId }) }, opts); } // ── Workspaces ─────────────────────────────────────────────────────────── diff --git a/services/mcp-server/src/modules/notelett/notelett-tools.ts b/services/mcp-server/src/modules/notelett/notelett-tools.ts index 8ce9b685..3a784a7a 100644 --- a/services/mcp-server/src/modules/notelett/notelett-tools.ts +++ b/services/mcp-server/src/modules/notelett/notelett-tools.ts @@ -51,9 +51,10 @@ registerTool({ requiredRole: 'admin', inputSchema: z.object({ noteId: z.string().min(1).describe('Note ID'), + workspaceId: z.string().min(1).describe('Workspace ID the note belongs to'), }), async execute(args, req) { - return noteLettNoteGet(args.noteId, { token: tokenOf(req), requestId: req.id }); + return noteLettNoteGet(args.noteId, args.workspaceId, { token: tokenOf(req), requestId: req.id }); }, }); @@ -83,12 +84,13 @@ registerTool({ requiredRole: 'admin', inputSchema: z.object({ noteId: z.string().min(1).describe('Note ID'), + workspaceId: z.string().min(1).describe('Workspace ID the note belongs to'), title: z.string().optional().describe('New title'), content: z.string().optional().describe('New content'), }), async execute(args, req) { - const { noteId, ...updates } = args; - return noteLettNoteUpdate(noteId, updates, { token: tokenOf(req), requestId: req.id }); + const { noteId, workspaceId, ...updates } = args; + return noteLettNoteUpdate(noteId, workspaceId, updates, { token: tokenOf(req), requestId: req.id }); }, }); @@ -101,9 +103,10 @@ registerTool({ requiredRole: 'admin', inputSchema: z.object({ noteId: z.string().min(1).describe('Note ID'), + workspaceId: z.string().min(1).describe('Workspace ID the note belongs to'), }), async execute(args, req) { - await noteLettNoteDelete(args.noteId, { token: tokenOf(req), requestId: req.id }); + await noteLettNoteDelete(args.noteId, args.workspaceId, { token: tokenOf(req), requestId: req.id }); return { success: true }; }, }); @@ -117,9 +120,10 @@ registerTool({ requiredRole: 'admin', inputSchema: z.object({ noteId: z.string().min(1).describe('Note ID'), + workspaceId: z.string().min(1).describe('Workspace ID the note belongs to'), }), async execute(args, req) { - return noteLettNoteSummarize(args.noteId, { token: tokenOf(req), requestId: req.id }); + return noteLettNoteSummarize(args.noteId, args.workspaceId, { token: tokenOf(req), requestId: req.id }); }, });