deleteNote
Remove a specific note from the Simple TypeScript MCP Server by providing its unique ID to manage your note collection.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| noteId | Yes | The ID of the note to delete |
Implementation Reference
- src/server.ts:194-245 (handler)MCP tool registration and handler for 'deleteNote'. Defines input schema using Zod, executes the deletion by calling notesStore.deleteNote(noteId), handles errors and returns structured JSON response via MCP content format.server.tool( "deleteNote", { noteId: z.string().describe("The ID of the note to delete") }, async ({ noteId }) => { try { const deleted = notesStore.deleteNote(noteId); if (!deleted) { 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, message: "Note deleted successfully", noteId }, null, 2) } ] }; } catch (err) { return { content: [ { type: "text", text: JSON.stringify({ success: false, error: "Failed to delete note", noteId }, null, 2) } ] }; } }, );
- src/server.ts:196-198 (schema)Input schema for deleteNote tool using Zod for noteId validation.{ noteId: z.string().describe("The ID of the note to delete") },
- src/notes-store.ts:69-78 (helper)Core implementation of deleteNote in NotesStore class: checks if note exists, deletes it from in-memory store, returns boolean success indicator.deleteNote(id: string): boolean { const note = this.notes[id]; if (!note) { return false; } delete this.notes[id]; return true; }