getCategories
Retrieve all available categories from the memo-mcp server to organize and access stored memos efficiently.
Instructions
Get all categories
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/repository/categories.ts:22-25 (handler)Core handler function that reads the database and returns all categories. This is the primary implementation logic for the getCategories tool.export const getCategories = async (): Promise<Category[]> => { await db.read() return db.data.categories }
- src/schemas/categories.ts:3-8 (schema)Zod schema defining the structure of a Category, used for input/output validation in the getCategories tool (output: array of categories).export const CategorySchema = z.object({ createdAt: z.string().datetime(), id: z.string(), name: z.string().min(1), updatedAt: z.string().datetime(), })
- src/server/tools.ts:176-191 (registration)Registers the 'getCategories' tool with the MCP server, providing schema and a thin wrapper handler that calls the core repository function.server.registerTool( "getCategories", { description: "Get all categories", inputSchema: {}, outputSchema: { categories: z.array(CategorySchema) }, title: "Get Categories", }, async () => { const categories = await getCategories() return { content: [{ text: JSON.stringify(categories), type: "text" }], structuredContent: { categories }, } }, )