Skip to main content
Glama

knowledge-base-retrieve

Search the Knowledge Base to retrieve company policies, procedures, technical documentation, or project data. Use this tool to find relevant information and answer company-specific questions efficiently.

Instructions

Look up information in the Knowledge Base. Use this tool when you need to:

  • Find relevant documents or information on specific topics

  • Retrieve company policies, procedures, or guidelines

  • Access product specifications or technical documentation

  • Get contextual information to answer company-specific questions

  • Find historical data or information about projects

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesThe query to search for data in the Knowledge Base
rerankNoWhether to rerank the results based on relevance. Defaults to true.
topKNoThe maximum number of results to return. Defaults to 10.

Implementation Reference

  • The handler function for the 'knowledge-base-retrieve' tool. It takes a query and optional parameters topK and rerank, searches the namespace using ns.search, maps the results to a content array of text items, and returns it.
    async ({ query, topK, rerank }) => {
      const result = await ns.search(
        query,
        {
          topK,
          rerank,
        },
        tenantId ? { tenantId } : undefined,
      );
    
      const content = result.map((item) => ({
        type: "text" as const,
        text: item.text,
      }));
    
      return { content };
    },
  • Input schema using Zod for the tool parameters: query (required string), topK (optional number 1-100 default 10), rerank (optional boolean default true).
    {
      query: z
        .string()
        .describe("The query to search for data in the Knowledge Base"),
      topK: z
        .number()
        .describe("The maximum number of results to return. Defaults to 10.")
        .min(1)
        .max(100)
        .optional()
        .default(10),
      rerank: z
        .boolean()
        .describe(
          "Whether to rerank the results based on relevance. Defaults to true.",
        )
        .optional()
        .default(true),
    },
  • src/index.ts:50-89 (registration)
    Registration of the 'knowledge-base-retrieve' tool on the MCP server, including name, dynamic description, input schema, and handler function.
    server.tool(
      "knowledge-base-retrieve",
      description,
      {
        query: z
          .string()
          .describe("The query to search for data in the Knowledge Base"),
        topK: z
          .number()
          .describe("The maximum number of results to return. Defaults to 10.")
          .min(1)
          .max(100)
          .optional()
          .default(10),
        rerank: z
          .boolean()
          .describe(
            "Whether to rerank the results based on relevance. Defaults to true.",
          )
          .optional()
          .default(true),
      },
      async ({ query, topK, rerank }) => {
        const result = await ns.search(
          query,
          {
            topK,
            rerank,
          },
          tenantId ? { tenantId } : undefined,
        );
    
        const content = result.map((item) => ({
          type: "text" as const,
          text: item.text,
        }));
    
        return { content };
      },
    );
  • Default description string for the 'knowledge-base-retrieve' tool, used if not overridden.
    const defaultDescription = `
    Look up information in the Knowledge Base. Use this tool when you need to:
      - Find relevant documents or information on specific topics
      - Retrieve company policies, procedures, or guidelines
      - Access product specifications or technical documentation
      - Get contextual information to answer company-specific questions
      - Find historical data or information about projects
    `.trim();
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 what the tool does (look up information), it lacks details on behavioral traits such as authentication requirements, rate limits, error handling, or what the output format looks like (e.g., list of documents with metadata). The description is functional but insufficient for a mutation-free tool with no annotation support.

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 well-structured with a clear purpose statement followed by a bulleted list of use cases. It is appropriately sized and front-loaded, with no wasted sentences. However, the bulleted list could be slightly more concise (e.g., some items overlap like 'Find relevant documents' and 'Get contextual information'), preventing a perfect 5.

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 complexity (a search/retrieval function with 3 parameters), no annotations, and no output schema, the description is incomplete. It explains the purpose and usage but lacks details on behavioral aspects (e.g., how results are returned, pagination, errors) and output format. This is adequate for a basic understanding but has clear gaps for effective agent 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?

The schema description coverage is 100%, meaning all parameters are documented in the schema itself. The description does not add any parameter-specific information beyond what's in the schema (e.g., it doesn't explain query syntax or result ranking details). According to the rules, with high schema coverage (>80%), the baseline is 3 even without param info in the description, which is appropriate here.

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 as 'Look up information in the Knowledge Base' with a specific verb ('look up') and resource ('Knowledge Base'). It provides concrete examples of what can be retrieved (documents, policies, specifications, etc.), making the purpose clear. However, without sibling tools, we cannot assess differentiation from alternatives, so it cannot achieve a perfect 5.

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

Usage Guidelines5/5

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

The description explicitly states 'Use this tool when you need to:' followed by five specific use cases (e.g., 'Find relevant documents', 'Retrieve company policies', 'Access product specifications'). This provides clear guidance on when to use the tool. Since there are no sibling tools mentioned, there are no alternatives to compare against, but the explicit 'when to use' list meets the criteria for a 5.

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

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/agentset-ai/mcp-server'

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