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();

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