Skip to main content
Glama
108yen
by 108yen

createMemo

Create and store memos with titles and content using a local database for agents to record and manage information.

Instructions

Create a new memo

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
categoryIdNo
contentYes
titleYes

Implementation Reference

  • Core handler function that creates a new memo: generates ID with nanoid, adds timestamps, appends to in-memory DB, and persists it.
    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
    }
  • Zod schema defining the input structure for createMemo: title (string), content (string), optional categoryId (string).
    export const CreateMemoSchema = z.object({
      categoryId: z.string().optional(),
      content: z.string(),
      title: z.string(),
    })
    
    export type CreateMemo = z.infer<typeof CreateMemoSchema>
  • Registers the createMemo tool with the MCP server, providing schema, description, and a thin handler that delegates to the core createMemo function and formats the MCP response.
    server.registerTool(
      "createMemo",
      {
        description: "Create a new memo",
        inputSchema: CreateMemoSchema.shape,
        outputSchema: { memo: MemoSchema },
        title: "Create Memo",
      },
      async (memo) => {
        const newMemo = await createMemo(memo)
        return {
          content: [{ text: JSON.stringify(newMemo), type: "text" }],
          structuredContent: { memo: newMemo },
        }
      },
    )

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