Skip to main content
Glama
dannwaneri

MCP Knowledge Base Server

by dannwaneri

get_by_category

Retrieve knowledge base entries filtered by specific categories like 'ai', 'technology', or 'product' to access organized information efficiently.

Instructions

Get all knowledge base entries for a specific category

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
categoryYesCategory to filter by (e.g., 'ai', 'technology', 'product')

Implementation Reference

  • Executes the get_by_category tool: extracts category from args, validates it, filters the knowledgeBase array case-insensitively, handles no-results case with available categories list, formats and returns JSON response with entries (id, content, metadata), caches successful results.
    if (name === "get_by_category") {
      const category = args?.category as string;
    
      if (!category) {
        throw new Error("Category parameter is required");
      }
    
      const results = knowledgeBase.filter(
        (item) => item.category.toLowerCase() === category.toLowerCase()
      );
    
      if (results.length === 0) {
        const responseText = JSON.stringify({
          category,
          message: "No entries found for this category",
          availableCategories: [
            ...new Set(knowledgeBase.map((item) => item.category)),
          ],
        });
    
        // Don't cache errors
        return {
          content: [
            {
              type: "text",
              text: responseText,
            },
          ],
        };
      }
    
      const responseText = JSON.stringify(
        {
          category,
          count: results.length,
          entries: results.map((r) => ({
            id: r.id,
            content: r.content,
            metadata: r.metadata,
          })),
        },
        null,
        2
      );
    
      // Cache the response
      setCache(cacheKey, responseText);
    
      return {
        content: [
          {
            type: "text",
            text: responseText,
          },
        ],
      };
    }
  • src/index.ts:166-179 (registration)
    Registers the get_by_category tool in the tools list provided to MCP clients, including name, description, and input schema requiring a 'category' string.
    {
        name: "get_by_category",
        description: "Get all knowledge base entries for a specific category",
        inputSchema: {
          type: "object",
          properties: {
            category: {
              type: "string",
              description: "Category to filter by (e.g., 'ai', 'technology', 'product')",
            },
          },
          required: ["category"],
        },
      },
  • Input schema for get_by_category tool: object with required 'category' string property.
    inputSchema: {
      type: "object",
      properties: {
        category: {
          type: "string",
          description: "Category to filter by (e.g., 'ai', 'technology', 'product')",
        },
      },
      required: ["category"],
    },
Behavior2/5

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

No annotations are provided, so the description carries full burden. It states it 'gets all knowledge base entries' but doesn't disclose behavioral traits such as whether this is a read-only operation, if there are rate limits, pagination behavior, error conditions, or what format the entries are returned in. The description is minimal and lacks essential operational context.

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, efficient sentence that directly states the tool's purpose without unnecessary words. It's appropriately sized for a simple tool with one parameter and is front-loaded with the core functionality.

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?

Given no annotations and no output schema, the description is incomplete. It doesn't explain what 'knowledge base entries' entail, the return format, or any behavioral aspects like error handling. For a tool with 100% schema coverage but missing output and annotation context, more detail is needed to guide effective use.

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 description coverage is 100%, with the single parameter 'category' well-documented in the schema. The description adds no additional parameter semantics beyond implying filtering by category, which is already covered. Baseline 3 is appropriate as the schema handles parameter documentation adequately.

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 verb ('Get') and resource ('knowledge base entries') with specific filtering ('for a specific category'). It distinguishes from 'list_categories' (which lists categories rather than entries) and 'get_by_id' (which retrieves by ID rather than category), but doesn't explicitly differentiate from 'advanced_search' or 'search_knowledge' which might also filter by category.

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?

The description provides no guidance on when to use this tool versus alternatives like 'advanced_search' or 'search_knowledge', which might offer similar category filtering with additional capabilities. There's no mention of prerequisites, limitations, or comparative contexts for tool selection.

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/dannwaneri/mcp-knowledge-base-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server