Skip to main content
Glama
108yen
by 108yen

Delete Category

deleteCategory

Delete a category by providing its unique ID to remove it from the memo database.

Instructions

Delete a category

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesThe ID of the category

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
categoryYes

Implementation Reference

  • The deleteCategory repository function that performs the actual deletion logic. It reads the database, finds the category by ID, splices it from the array, clears categoryId references on memos, writes back, and returns the deleted category (or undefined if not found).
    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
    }
  • Tool registration for 'deleteCategory' using server.registerTool. Defines input schema (id string), output schema (CategorySchema), and the handler that calls the deleteCategory repository function with error handling.
    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 },
        }
      },
    )
  • CategorySchema Zod definition used as the output schema for deleteCategory. Defines the shape of a Category object with id, name, createdAt, and updatedAt fields.
    export const CategorySchema = z.object({
      createdAt: z.string().datetime(),
      id: z.string(),
      name: z.string().min(1),
      updatedAt: z.string().datetime(),
    })
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The description does not disclose any behavioral traits such as whether deletion is irreversible, if it cascades to related memos, or any error conditions. Without annotations, this is insufficient.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise but overly minimal. It could benefit from a few additional words to improve clarity without significant bloat.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple delete tool, more context is needed: permanence, cascading behavior, and error handling. The presence of an output schema is not referenced.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema covers the single parameter 'id' with a description, so the description adds no extra meaning. Baseline 3 is appropriate as schema coverage is 100%.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Delete a category'), which matches the tool name and is distinguishable from sibling tools like deleteMemo. However, it does not specify the scope or any constraints.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool versus alternatives like updateCategory or getCategory. No prerequisites or conditions for deletion are mentioned.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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