Skip to main content
Glama

updateCategory

Modify a category by updating its name or other properties in the memo-mcp MCP server, ensuring accurate organization of recorded memos.

Instructions

Update a category

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesThe ID of the category
nameNo

Implementation Reference

  • Core handler function that updates a category by ID, optionally updating the name, and persists changes to the database.
    export const updateCategory = async ( id: string, { name }: UpdateCategory, ): Promise<Category | undefined> => { await db.read() const index = db.data.categories.findIndex((c) => c.id === id) if (index === -1) { return undefined } const existingCategory = db.data.categories[index] if (!existingCategory) { return undefined } const newCategory: Category = { ...existingCategory, ...(name ? { name } : {}), updatedAt: new Date().toISOString(), } db.data.categories[index] = newCategory await db.write() return newCategory }
  • Zod schema and inferred TypeScript type for the UpdateCategory input parameters.
    export const UpdateCategorySchema = z.object({ name: z.string().min(1).optional(), }) export type UpdateCategory = z.infer<typeof UpdateCategorySchema>
  • Registers the 'updateCategory' tool with the MCP server, defining input/output schemas and providing a handler that wraps the repository function, handles not-found cases, and formats the MCP response.
    server.registerTool( "updateCategory", { description: "Update a category", inputSchema: { id: z.string().describe("The ID of the category"), ...UpdateCategorySchema.shape, }, outputSchema: { category: CategorySchema }, title: "Update Category", }, async ({ id, ...category }) => { const updatedCategory = await updateCategory(id, category) if (!updatedCategory) { return { content: [{ text: "Category not found", type: "text" }], isError: true, } } return { content: [{ text: JSON.stringify(updatedCategory), type: "text" }], structuredContent: { category: updatedCategory }, } }, )

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