Skip to main content
Glama
108yen
by 108yen

Get Category

getCategory

Retrieve a specific category by its ID. Use this to access category details stored in the memo system.

Instructions

Get a single category by ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesThe ID of the category

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
categoryYes

Implementation Reference

  • Core handler function for getCategory. Looks up a category in the database by its ID using db.data.categories.find(). Returns the Category or undefined if not found.
    export const getCategory = async (
      id: string,
    ): Promise<Category | undefined> => {
      await db.read()
      return db.data.categories.find((c) => c.id === id)
    }
  • Registration of the 'getCategory' tool in the MCP server via server.registerTool(). Defines description, inputSchema (id: string), outputSchema (CategorySchema), and the callback handler that calls the repository function.
    server.registerTool(
      "getCategory",
      {
        description: "Get a single category by ID",
        inputSchema: {
          id: z.string().describe("The ID of the category"),
        },
        outputSchema: { category: CategorySchema },
        title: "Get Category",
      },
      async ({ id }) => {
        const category = await getCategory(id)
        if (!category) {
          return {
            content: [{ text: "Category not found", type: "text" }],
            isError: true,
          }
        }
    
        return {
          content: [{ text: JSON.stringify(category), type: "text" }],
          structuredContent: { category },
        }
      },
    )
  • CategorySchema definition used for output validation of the getCategory tool. Defines the shape of a Category object with fields: id, name, createdAt, updatedAt.
    export const CategorySchema = z.object({
      createdAt: z.string().datetime(),
      id: z.string(),
      name: z.string().min(1),
      updatedAt: z.string().datetime(),
    })
  • Import of the getCategory handler from the repository layer into the tools registration file.
      getCategory,
      updateCategory,
    } from "../repository/categories"
Behavior2/5

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

No annotations are provided, so the description must carry the full burden. It only states the basic action without disclosing any behavioral traits such as readonly nature, error handling, or permissions. This is insufficient for a tool with no annotations.

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

Conciseness5/5

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

The description is a single sentence that is clear and to the point. It is appropriately sized with no wasted words.

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

Completeness4/5

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

Given the tool's simplicity and the presence of an output schema, the description is largely complete. It could mention error conditions or access prerequisites, but for a straightforward get operation, it suffices.

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?

Schema coverage is 100% with a clear description for the 'id' parameter. The tool description merely repeats the schema's intent, adding no new meaning. Per rules, baseline 3 is appropriate.

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

Purpose5/5

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

The description clearly states the verb 'Get', the resource 'category', and the method 'by ID'. It effectively distinguishes from sibling tools like 'getCategories' (plural) and 'createCategory'.

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

Usage Guidelines3/5

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

The description implies usage when you have a specific category ID, but it does not explicitly state when to use or not use this tool, nor does it mention alternatives. It lacks explicit usage context.

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