Skip to main content
Glama
jasonkneen

Simple TypeScript MCP Server

by jasonkneen

deleteNote

Remove a specific note by its ID from the Simple TypeScript MCP Server, enabling efficient management of note data within the system.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
noteIdYesThe ID of the note to delete

Implementation Reference

  • MCP tool handler that executes the deleteNote logic by calling notesStore.deleteNote and returning formatted JSON response.
    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) } ] }; } },
  • Input schema validation using Zod for the noteId parameter.
    { noteId: z.string().describe("The ID of the note to delete") },
  • src/server.ts:194-245 (registration)
    Registration of the deleteNote tool with the MCP server, including name, schema, and handler.
    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) } ] }; } }, );
  • Core helper method in NotesStore class that deletes a note by ID from the in-memory store.
    deleteNote(id: string): boolean { const note = this.notes[id]; if (!note) { return false; } delete this.notes[id]; return true; }

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/jasonkneen/mcp-server-ts'

If you have feedback or need assistance with the MCP directory API, please join our Discord server