updateNote
Modify note details in the MCP server by providing the note ID along with updated title and content. Ideal for maintaining accurate and current note-taking records.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| content | No | The updated content of the note | |
| noteId | Yes | The ID of the note to update | |
| title | No | The updated title of the note |
Implementation Reference
- src/server.ts:146-190 (handler)MCP tool handler for 'updateNote': validates input, calls notesStore.updateNote, handles errors, and returns JSON response.async ({ noteId, title, content }) => { try { const updatedNote = notesStore.updateNote(noteId, { title, content }); if (!updatedNote) { return { content: [ { type: "text", text: JSON.stringify({ success: false, error: "Note not found", noteId }, null, 2) } ] }; } return { content: [ { type: "text", text: JSON.stringify({ success: true, note: updatedNote }, null, 2) } ] }; } catch (err) { return { content: [ { type: "text", text: JSON.stringify({ success: false, error: "Failed to update note", noteId }, null, 2) } ] }; } },
- src/server.ts:141-145 (schema)Zod input schema for the updateNote tool defining parameters: noteId (required), title and content (optional).{ noteId: z.string().describe("The ID of the note to update"), title: z.string().optional().describe("The updated title of the note"), content: z.string().optional().describe("The updated content of the note") },
- src/server.ts:139-191 (registration)Registration of the 'updateNote' tool with the MCP server using server.tool().server.tool( "updateNote", { noteId: z.string().describe("The ID of the note to update"), title: z.string().optional().describe("The updated title of the note"), content: z.string().optional().describe("The updated content of the note") }, async ({ noteId, title, content }) => { try { const updatedNote = notesStore.updateNote(noteId, { title, content }); if (!updatedNote) { return { content: [ { type: "text", text: JSON.stringify({ success: false, error: "Note not found", noteId }, null, 2) } ] }; } return { content: [ { type: "text", text: JSON.stringify({ success: true, note: updatedNote }, null, 2) } ] }; } catch (err) { return { content: [ { type: "text", text: JSON.stringify({ success: false, error: "Failed to update note", noteId }, null, 2) } ] }; } }, );
- src/notes-store.ts:51-67 (helper)Core helper method in NotesStore class that performs the actual note update logic in memory.updateNote(id: string, updates: { title?: string; content?: string }): Note | undefined { const note = this.notes[id]; if (!note) { return undefined; } if (updates.title !== undefined) { note.title = updates.title; } if (updates.content !== undefined) { note.content = updates.content; } return note; }
- src/notes-store.ts:2-7 (schema)TypeScript interface defining the Note data structure used by the updateNote functionality.export interface Note { id: string; title: string; content: string; createdAt: string; }