createMemo
Create and store structured memos with assigned titles, content, and categories for easy organization and retrieval in the MCP server memo-mcp.
Instructions
Create a new memo
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| categoryId | No | ||
| content | Yes | ||
| title | Yes |
Implementation Reference
- src/server/tools.ts:29-44 (registration)Registration of the MCP tool named 'createMemo', including input/output schemas and the handler function that delegates to the repository implementation.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 }, } }, )
- src/schemas/memos.ts:26-32 (schema)Zod schema definition for the input parameters of the createMemo tool (CreateMemoSchema).export const CreateMemoSchema = z.object({ categoryId: z.string().optional(), content: z.string(), title: z.string(), }) export type CreateMemo = z.infer<typeof CreateMemoSchema>
- src/repository/memos.ts:5-18 (handler)Core handler function that implements the logic to create and persist a new memo to the database.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 }
- src/schemas/memos.ts:2-22 (schema)Output schema for the memo object returned by createMemo tool.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.", ), })