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:
parent
6997dff8d9
commit
58c47a751a
@ -61,9 +61,10 @@ export function noteLettNotesList(
|
|||||||
|
|
||||||
export function noteLettNoteGet(
|
export function noteLettNoteGet(
|
||||||
noteId: string,
|
noteId: string,
|
||||||
|
workspaceId: string,
|
||||||
opts: NoteLettClientOptions,
|
opts: NoteLettClientOptions,
|
||||||
): Promise<NoteDoc> {
|
): Promise<NoteDoc> {
|
||||||
return noteFetch(`/notes/${noteId}`, { method: 'GET' }, opts);
|
return noteFetch(`/notes/${noteId}?workspaceId=${encodeURIComponent(workspaceId)}`, { method: 'GET' }, opts);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function noteLettNoteCreate(
|
export function noteLettNoteCreate(
|
||||||
@ -75,24 +76,27 @@ export function noteLettNoteCreate(
|
|||||||
|
|
||||||
export function noteLettNoteUpdate(
|
export function noteLettNoteUpdate(
|
||||||
noteId: string,
|
noteId: string,
|
||||||
|
workspaceId: string,
|
||||||
input: { title?: string; content?: string },
|
input: { title?: string; content?: string },
|
||||||
opts: NoteLettClientOptions,
|
opts: NoteLettClientOptions,
|
||||||
): Promise<NoteDoc> {
|
): 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(
|
export function noteLettNoteDelete(
|
||||||
noteId: string,
|
noteId: string,
|
||||||
|
workspaceId: string,
|
||||||
opts: NoteLettClientOptions,
|
opts: NoteLettClientOptions,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
return noteFetch(`/notes/${noteId}`, { method: 'DELETE' }, opts);
|
return noteFetch(`/notes/${noteId}?workspaceId=${encodeURIComponent(workspaceId)}`, { method: 'DELETE' }, opts);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function noteLettNoteSummarize(
|
export function noteLettNoteSummarize(
|
||||||
noteId: string,
|
noteId: string,
|
||||||
|
workspaceId: string,
|
||||||
opts: NoteLettClientOptions,
|
opts: NoteLettClientOptions,
|
||||||
): Promise<{ summary: string }> {
|
): Promise<{ summary: string }> {
|
||||||
return noteFetch(`/notes/${noteId}/summarize`, { method: 'POST' }, opts);
|
return noteFetch(`/notes/${noteId}/summarize`, { method: 'POST', body: JSON.stringify({ workspaceId }) }, opts);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ── Workspaces ───────────────────────────────────────────────────────────
|
// ── Workspaces ───────────────────────────────────────────────────────────
|
||||||
|
|||||||
@ -51,9 +51,10 @@ registerTool({
|
|||||||
requiredRole: 'admin',
|
requiredRole: 'admin',
|
||||||
inputSchema: z.object({
|
inputSchema: z.object({
|
||||||
noteId: z.string().min(1).describe('Note ID'),
|
noteId: z.string().min(1).describe('Note ID'),
|
||||||
|
workspaceId: z.string().min(1).describe('Workspace ID the note belongs to'),
|
||||||
}),
|
}),
|
||||||
async execute(args, req) {
|
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',
|
requiredRole: 'admin',
|
||||||
inputSchema: z.object({
|
inputSchema: z.object({
|
||||||
noteId: z.string().min(1).describe('Note ID'),
|
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'),
|
title: z.string().optional().describe('New title'),
|
||||||
content: z.string().optional().describe('New content'),
|
content: z.string().optional().describe('New content'),
|
||||||
}),
|
}),
|
||||||
async execute(args, req) {
|
async execute(args, req) {
|
||||||
const { noteId, ...updates } = args;
|
const { noteId, workspaceId, ...updates } = args;
|
||||||
return noteLettNoteUpdate(noteId, updates, { token: tokenOf(req), requestId: req.id });
|
return noteLettNoteUpdate(noteId, workspaceId, updates, { token: tokenOf(req), requestId: req.id });
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -101,9 +103,10 @@ registerTool({
|
|||||||
requiredRole: 'admin',
|
requiredRole: 'admin',
|
||||||
inputSchema: z.object({
|
inputSchema: z.object({
|
||||||
noteId: z.string().min(1).describe('Note ID'),
|
noteId: z.string().min(1).describe('Note ID'),
|
||||||
|
workspaceId: z.string().min(1).describe('Workspace ID the note belongs to'),
|
||||||
}),
|
}),
|
||||||
async execute(args, req) {
|
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 };
|
return { success: true };
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@ -117,9 +120,10 @@ registerTool({
|
|||||||
requiredRole: 'admin',
|
requiredRole: 'admin',
|
||||||
inputSchema: z.object({
|
inputSchema: z.object({
|
||||||
noteId: z.string().min(1).describe('Note ID'),
|
noteId: z.string().min(1).describe('Note ID'),
|
||||||
|
workspaceId: z.string().min(1).describe('Workspace ID the note belongs to'),
|
||||||
}),
|
}),
|
||||||
async execute(args, req) {
|
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 });
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user