Skip to main content
Glama
108yen
by 108yen

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
NameRequiredDescriptionDefault
idYesThe ID of the memo

Implementation Reference

  • 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 },
      }
    },
  • 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",
    },
  • 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 },
        }
      },
    )
  • 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
    }

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/108yen/memo-mcp'

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