Skip to main content
Glama

deleteCategory

Remove a specific category from the memo-mcp server by providing its unique ID, ensuring efficient organization and management of memo categories.

Instructions

Delete a category

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesThe ID of the category

Implementation Reference

  • Core function implementing the logic to delete a category by ID from the database and update associated memos by clearing their categoryId.
    export const deleteCategory = async ( id: string, ): Promise<Category | undefined> => { await db.read() const index = db.data.categories.findIndex((c) => c.id === id) if (index === -1) { return undefined } const deletedCategory = db.data.categories.splice(index, 1)[0] db.data.memos.forEach((memo) => { if (memo.categoryId === id) { memo.categoryId = undefined } }) await db.write() return deletedCategory }
  • Registers the 'deleteCategory' MCP tool with input/output schemas and a thin wrapper handler that calls the core deleteCategory function and formats the MCP response.
    server.registerTool( "deleteCategory", { description: "Delete a category", inputSchema: { id: z.string().describe("The ID of the category"), }, outputSchema: { category: CategorySchema }, title: "Delete Category", }, async ({ id }) => { const deletedCategory = await deleteCategory(id) if (!deletedCategory) { return { content: [{ text: "Category not found", type: "text" }], isError: true, } } return { content: [{ text: JSON.stringify(deletedCategory), type: "text" }], structuredContent: { category: deletedCategory }, } }, )
  • Zod schema defining the Category type, referenced in the outputSchema of the deleteCategory tool.
    export const CategorySchema = z.object({ createdAt: z.string().datetime(), id: z.string(), name: z.string().min(1), updatedAt: z.string().datetime(), })

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