Skip to main content
Glama
108yen
by 108yen

Delete Memo

deleteMemo

Delete a memo by ID. Removes the memo from the local database.

Instructions

Delete a memo

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesThe ID of the memo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
memoYes

Implementation Reference

  • The repository function that performs the actual deletion of a memo from the database by its ID. It reads the database, finds the memo by index, splices it out, writes back, and returns the deleted memo (or undefined if not found).
    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
    }
  • The MemoSchema Zod schema used for output validation of the deleteMemo tool's response (outputSchema: { memo: MemoSchema }).
    export const MemoSchema = z.object({
      categoryId: z.string().optional(),
      content: z.string(),
      createdAt: z
        .string()
        .datetime()
        .transform((date) => new Date(date))
        .describe(
          "The date when the memo was created. Display in ISO 8601 format, UTC+0 timezone.",
        ),
      id: z.string(),
      title: z.string(),
      updatedAt: z
        .string()
        .datetime()
        .transform((date) => new Date(date))
        .describe(
          "The date when the memo was last updated. Display in ISO 8601 format, UTC+0 timezone.",
        ),
    })
  • The MCP tool registration for 'deleteMemo', defining its description, inputSchema (id: string), outputSchema, and the handler that calls the repository deleteMemo function and handles the not-found case.
    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 },
        }
      },
    )
  • The TypeScript types imported from schemas (CreateMemo, UpdateMemo) used by the repository layer — these are shared across memo operations including deleteMemo.
    import type { CreateMemo, SearchMemosParams, UpdateMemo } from "../schemas"
    import { db } from "../db"
    
    export const createMemo = async (memo: CreateMemo) => {
      const now = new Date().toISOString()
    
      const newMemo = {
        ...memo,
        createdAt: now,
        id: nanoid(),
        updatedAt: now,
      }
      db.data.memos.push(newMemo)
      await db.write()
    
      return newMemo
    }
    
    export const getMemos = async () => {
      await db.read()
      return db.data.memos
    }
    
    export const getMemo = async (id: string) => {
      await db.read()
      return db.data.memos.find((memo) => memo.id === id)
    }
    
    export const updateMemo = async (id: string, memo: UpdateMemo) => {
      await db.read()
    
      const index = db.data.memos.findIndex((memo) => memo.id === id)
      if (index == -1) {
        return undefined
      }
    
      const existingMemo = db.data.memos[index]!
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided. The description only states the action 'delete' without disclosing side effects (e.g., irreversibility, cascade effects) or error conditions (e.g., memo not found). With zero annotation support, this is insufficient.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Extremely concise: a single clear sentence with no unnecessary words. Ideal for a simple operation.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the simplicity of the tool (one required param, output schema exists), the description is minimally adequate. However, it could benefit from mentioning that deletion is permanent or mentioning the return value.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The single parameter 'id' is fully described in the schema (100% coverage). The description adds no additional semantic meaning beyond what the schema already provides.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The verb 'delete' and resource 'memo' are clear. It distinguishes from sibling tools like createMemo and updateMemo. However, it does not specify scope (e.g., single memo) or any preconditions.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool versus alternatives (e.g., updateMemo to deactivate). No mention of conditions like memo must exist or permissions required.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

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

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