Get Memo
getMemoRetrieve a single memo by providing its unique ID.
Instructions
Get a single memo by ID
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | The ID of the memo |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| memo | Yes |
Implementation Reference
- src/repository/memos.ts:25-28 (handler)Core handler for getMemo — retrieves a single memo by ID from the database. Returns the memo object or undefined if not found.
export const getMemo = async (id: string) => { await db.read() return db.data.memos.find((memo) => memo.id === id) } - src/server/tools.ts:63-87 (registration)Registration of the 'getMemo' tool on the MCP server. Defines input schema (id string), output schema (MemoSchema), and the async handler that calls getMemo(id) and returns the result or an error if not found.
server.registerTool( "getMemo", { description: "Get a single memo by ID", inputSchema: { id: z.string().describe("The ID of the memo"), }, outputSchema: { memo: MemoSchema }, title: "Get Memo", }, async ({ id }) => { const memo = await getMemo(id) if (!memo) { return { content: [{ text: "Memo not found", type: "text" }], isError: true, } } return { content: [{ text: JSON.stringify(memo), type: "text" }], structuredContent: { memo }, } }, ) - src/schemas/memos.ts:3-22 (helper)MemoSchema — the output/type definition for a memo object. Used as the output schema for the getMemo tool registration.
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.", ), })