Skip to main content
Glama
dannwaneri

MCP Knowledge Base Server

by dannwaneri

search_knowledge

Find specific facts or documentation by searching a knowledge base with semantic capabilities. Use keywords to retrieve relevant information efficiently.

Instructions

Search the knowledge base for relevant information. Use this when you need to find specific facts or documentation.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch query or keywords
limitNoMaximum number of results to return

Implementation Reference

  • Core handler function implementing simple keyword search over the knowledge base by filtering entries where content or category matches the query (case-insensitive), then slicing to the requested limit.
    function searchKnowledge(query: string, limit: number = 5): KnowledgeEntry[] {
        const lowerQuery = query.toLowerCase();
        return knowledgeBase
          .filter((item) =>
            item.content.toLowerCase().includes(lowerQuery) ||
            item.category.toLowerCase().includes(lowerQuery)
          )
          .slice(0, limit);
      }
  • Type definition for KnowledgeEntry, which structures the data returned by the search tool.
    interface KnowledgeEntry {
        id: string;
        content: string;
        category: string;
        metadata: {
          source: string;
          date: string;
        };
      }
  • Input schema defining the parameters for the search_knowledge tool: required 'query' string and optional 'limit' number.
    inputSchema: {
      type: "object",
      properties: {
        query: {
          type: "string",
          description: "Search query or keywords",
        },
        limit: {
          type: "number",
          description: "Maximum number of results to return",
          default: 5,
        },
      },
      required: ["query"],
    },
  • src/index.ts:136-155 (registration)
    Tool registration in the ListTools response, defining name, description, and inputSchema for search_knowledge.
    {
      name: "search_knowledge",
      description:
        "Search the knowledge base for relevant information. Use this when you need to find specific facts or documentation.",
      inputSchema: {
        type: "object",
        properties: {
          query: {
            type: "string",
            description: "Search query or keywords",
          },
          limit: {
            type: "number",
            description: "Maximum number of results to return",
            default: 5,
          },
        },
        required: ["query"],
      },
    },
  • MCP CallTool handler branch for search_knowledge: validates input, calls searchKnowledge, formats JSON response with results, caches it, and returns MCP content.
    if (name === "search_knowledge") {
      const query = args?.query as string;
      const limit = (args?.limit as number) || 5;
    
      if (!query) {
        throw new Error("Query parameter is required");
      }
    
      const results = searchKnowledge(query, limit);
      
      const responseText = JSON.stringify(
        {
          query,
          resultsCount: results.length,
          results: results.map((r) => ({
            id: r.id,
            content: r.content,
            category: r.category,
          })),
        },
        null,
        2
      );
    
      // Cache the response
      setCache(cacheKey, responseText);
    
      return {
        content: [
          {
            type: "text",
            text: responseText,
          },
        ],
      };
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. While it mentions the tool searches for 'relevant information', it doesn't describe what 'relevant' means (e.g., ranking algorithm, freshness), whether results are paginated, if there are rate limits, or what the output format looks like. For a search tool with no annotation coverage, this leaves significant behavioral aspects unclear.

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

Conciseness4/5

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

The description is concise with two sentences that efficiently convey the tool's purpose and basic usage. It's front-loaded with the core functionality, and every sentence adds value without redundancy. However, it could be slightly more structured by explicitly mentioning parameters or output, though this isn't required for full marks.

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

Completeness3/5

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

Given the tool's moderate complexity (search functionality with 2 parameters), no annotations, and no output schema, the description is minimally adequate. It covers the 'what' and basic 'when', but lacks details on behavioral aspects like result format, error handling, or performance characteristics. For a search tool without structured output documentation, this leaves gaps in completeness.

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 has 100% description coverage, with clear documentation for both parameters ('query' as search keywords, 'limit' as maximum results). The description adds no additional parameter semantics beyond what the schema provides, such as query syntax examples or limit constraints. With high schema coverage, the baseline score of 3 is appropriate as the schema does the heavy lifting.

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 tool's purpose with a specific verb ('Search') and resource ('knowledge base'), making it immediately understandable. However, it doesn't distinguish this tool from its siblings like 'advanced_search' or 'get_by_category', which likely offer alternative search approaches. The description is clear but lacks sibling differentiation.

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 provides some usage guidance with 'Use this when you need to find specific facts or documentation', which implies it's for general keyword-based searches. However, it doesn't explicitly state when to use this versus alternatives like 'advanced_search' (presumably for more complex queries) or 'get_by_category' (for category-based retrieval). The guidance is helpful but incomplete regarding sibling tools.

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