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
This commit is contained in:
Saravana Achu Mac 2026-03-29 22:10:03 -07:00
parent 6997dff8d9
commit 58c47a751a
2 changed files with 17 additions and 9 deletions

View File

@ -61,9 +61,10 @@ export function noteLettNotesList(
export function noteLettNoteGet(
noteId: string,
workspaceId: string,
opts: NoteLettClientOptions,
): Promise<NoteDoc> {
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<NoteDoc> {
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<void> {
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 ───────────────────────────────────────────────────────────

View File

@ -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 });
},
});