Skip to main content
Glama
108yen
by 108yen

updateMemo

Modify existing memos by updating their title, content, or category to keep information current and organized.

Instructions

Update a memo

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesThe ID of the memo
categoryIdNo
contentNo
titleNo

Implementation Reference

  • Core implementation of updateMemo: reads DB, finds memo by ID, merges updates, writes back, returns updated memo.
    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]!
    
      const newMemo = {
        ...existingMemo,
        ...memo,
        updatedAt: new Date().toISOString(),
      }
      db.data.memos[index] = newMemo
      await db.write()
    
      return newMemo
    }
  • Registers the 'updateMemo' tool with the MCP server, defines input/output schemas, and provides the tool handler function.
    server.registerTool(
      "updateMemo",
      {
        description: "Update a memo",
        inputSchema: {
          id: z.string().describe("The ID of the memo"),
          ...UpdateMemoSchema.shape,
        },
        outputSchema: { memo: MemoSchema },
        title: "Update Memo",
      },
      async ({ id, ...memo }) => {
        const updatedMemo = await updateMemo(id, memo)
        if (!updatedMemo) {
          return {
            content: [{ text: "Memo not found", type: "text" }],
            isError: true,
          }
        }
    
        return {
          content: [{ text: JSON.stringify(updatedMemo), type: "text" }],
          structuredContent: { memo: updatedMemo },
        }
      },
  • Zod schema defining the input shape for updating a memo (optional fields for title, content, categoryId).
    export const UpdateMemoSchema = z.object({
      categoryId: z.string().optional(),
      content: z.string().optional(),
      title: z.string().optional(),
    })
    
    export type UpdateMemo = z.infer<typeof UpdateMemoSchema>

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