set_note_labels
Assign or replace labels on a specific note in NotesKeep to organize and categorize content for better retrieval and management.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| noteId | Yes | ID of the note | |
| labelIds | Yes | Array of label IDs to set (replaces all existing labels) |
Implementation Reference
- src/index.ts:446-468 (handler)The handler function for the "set_note_labels" tool, which updates the labels of a note by making a PUT request to the API.
async ({ noteId, labelIds }) => { try { await apiRequest(`/api/notes/${noteId}/labels`, { method: "PUT", body: JSON.stringify({ labelIds }), }); return { content: [{ type: "text", text: `Labels for note ${noteId} updated successfully! Now has ${labelIds.length} label(s).` }] }; } catch (error) { return { content: [{ type: "text", text: `Error setting note labels: ${error}` }], isError: true }; } } - src/index.ts:442-445 (schema)The input schema for the "set_note_labels" tool, defining the required noteId and labelIds fields.
{ noteId: z.number().describe("ID of the note"), labelIds: z.array(z.number()).describe("Array of label IDs to set (replaces all existing labels)"), }, - src/index.ts:440-469 (registration)The registration of the "set_note_labels" tool using server.tool.
server.tool( "set_note_labels", { noteId: z.number().describe("ID of the note"), labelIds: z.array(z.number()).describe("Array of label IDs to set (replaces all existing labels)"), }, async ({ noteId, labelIds }) => { try { await apiRequest(`/api/notes/${noteId}/labels`, { method: "PUT", body: JSON.stringify({ labelIds }), }); return { content: [{ type: "text", text: `Labels for note ${noteId} updated successfully! Now has ${labelIds.length} label(s).` }] }; } catch (error) { return { content: [{ type: "text", text: `Error setting note labels: ${error}` }], isError: true }; } } );