Skip to main content
Glama
DumplingAI

Dumpling AI MCP Server

Official
by DumplingAI

search-knowledge-base

Query a knowledge base to retrieve relevant information using a specific ID and search term, with options to customize the number of results.

Instructions

Search a knowledge base for relevant information.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
knowledgeBaseIdYesKnowledge base ID
queryYesSearch query
resultCountNoNumber of results

Implementation Reference

  • The asynchronous handler function for the 'search-knowledge-base' tool. It fetches an API key from environment variables, makes a POST request to the knowledge base query endpoint, handles errors, and returns the JSON response as text content.
    async ({ knowledgeBaseId, query, resultCount }) => { const apiKey = process.env.DUMPLING_API_KEY; if (!apiKey) throw new Error("DUMPLING_API_KEY not set"); const response = await fetch( `${NWS_API_BASE}/api/v1/query-knowledge-base`, { method: "POST", headers: { "Content-Type": "application/json", Authorization: `Bearer ${apiKey}`, }, body: JSON.stringify({ knowledgeBaseId, query, resultCount }), } ); if (!response.ok) throw new Error(`Failed: ${response.status} ${await response.text()}`); const data = await response.json(); return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] }; }
  • Input schema for the 'search-knowledge-base' tool using Zod validation: knowledgeBaseId (string), query (string), resultCount (optional number, default 5).
    { knowledgeBaseId: z.string().describe("Knowledge base ID"), query: z.string().describe("Search query"), resultCount: z.number().optional().default(5).describe("Number of results"), },
  • src/index.ts:895-922 (registration)
    Registration of the 'search-knowledge-base' tool on the MCP server using server.tool, including name, description, schema, and handler.
    server.tool( "search-knowledge-base", "Search a knowledge base for relevant information.", { knowledgeBaseId: z.string().describe("Knowledge base ID"), query: z.string().describe("Search query"), resultCount: z.number().optional().default(5).describe("Number of results"), }, async ({ knowledgeBaseId, query, resultCount }) => { const apiKey = process.env.DUMPLING_API_KEY; if (!apiKey) throw new Error("DUMPLING_API_KEY not set"); const response = await fetch( `${NWS_API_BASE}/api/v1/query-knowledge-base`, { method: "POST", headers: { "Content-Type": "application/json", Authorization: `Bearer ${apiKey}`, }, body: JSON.stringify({ knowledgeBaseId, query, resultCount }), } ); if (!response.ok) throw new Error(`Failed: ${response.status} ${await response.text()}`); const data = await response.json(); return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] }; } );

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/DumplingAI/mcp-server-dumplingai'

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