deleteMemo
Remove a specific memo from the memo-mcp server by providing its unique ID to clear stored information.
Instructions
Delete a memo
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | The ID of the memo |
Implementation Reference
- src/server/tools.ts:126-139 (handler)MCP tool handler for 'deleteMemo' that invokes the repository function, handles cases where memo is not found, and returns formatted text and structured content.async ({ id }) => { const deletedMemo = await deleteMemo(id) if (!deletedMemo) { return { content: [{ text: "Memo not found", type: "text" }], isError: true, } } return { content: [{ text: JSON.stringify(deletedMemo), type: "text" }], structuredContent: { memo: deletedMemo }, } },
- src/server/tools.ts:118-125 (schema)Input and output schema definition for the deleteMemo tool, specifying id parameter and memo output.{ description: "Delete a memo", inputSchema: { id: z.string().describe("The ID of the memo"), }, outputSchema: { memo: MemoSchema }, title: "Delete Memo", },
- src/server/tools.ts:116-140 (registration)Registration of the 'deleteMemo' tool on the MCP server using server.registerTool.server.registerTool( "deleteMemo", { description: "Delete a memo", inputSchema: { id: z.string().describe("The ID of the memo"), }, outputSchema: { memo: MemoSchema }, title: "Delete Memo", }, async ({ id }) => { const deletedMemo = await deleteMemo(id) if (!deletedMemo) { return { content: [{ text: "Memo not found", type: "text" }], isError: true, } } return { content: [{ text: JSON.stringify(deletedMemo), type: "text" }], structuredContent: { memo: deletedMemo }, } }, )
- src/repository/memos.ts:51-62 (helper)Repository helper function that performs the actual deletion of a memo by ID from the in-memory database and returns the deleted memo.export const deleteMemo = async (id: string) => { await db.read() const index = db.data.memos.findIndex((memo) => memo.id === id) if (index == -1) { return undefined } const [deletedMemo] = db.data.memos.splice(index, 1) await db.write() return deletedMemo }