Skip to main content
Glama

updateMemo

Modify existing memos by updating their ID, category, content, or title to ensure accurate and organized information retrieval within the memo-mcp server.

Instructions

Update a memo

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
categoryIdNo
contentNo
idYesThe ID of the memo
titleNo

Implementation Reference

  • Registration and handler implementation for the 'updateMemo' MCP tool. Defines input/output schemas inline (referencing UpdateMemoSchema), handles input destructuring, calls the repository updateMemo function, manages errors, and returns content in MCP format.
    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 and TypeScript type definition for the UpdateMemo input object used in the updateMemo tool.
    export const UpdateMemoSchema = z.object({ categoryId: z.string().optional(), content: z.string().optional(), title: z.string().optional(), }) export type UpdateMemo = z.infer<typeof UpdateMemoSchema>
  • Repository helper function that performs the actual database update for a memo by ID, merging updates, updating timestamp, and persisting to storage.
    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 }

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

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