Skip to main content
Glama

retell_create_knowledge_base

Create a knowledge base to provide context for AI agents, enabling them to access and use relevant information during conversations.

Instructions

Create a new knowledge base for providing context to agents.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
knowledge_base_nameYesName for the knowledge base
enable_auto_refreshNoWhether to automatically refresh sources

Implementation Reference

  • The handler logic for the tool within the executeTool switch statement. It simply forwards the input arguments as a POST request to the Retell API endpoint /create-knowledge-base using the retellRequest helper.
    case "retell_create_knowledge_base": return retellRequest("/create-knowledge-base", "POST", args);
  • The tool definition in the tools array, including name, description, and inputSchema for validation (requires knowledge_base_name string, optional enable_auto_refresh boolean). This serves as both schema and registration entry.
    { name: "retell_create_knowledge_base", description: "Create a new knowledge base for providing context to agents.", inputSchema: { type: "object", properties: { knowledge_base_name: { type: "string", description: "Name for the knowledge base" }, enable_auto_refresh: { type: "boolean", description: "Whether to automatically refresh sources" } }, required: ["knowledge_base_name"] }
  • The retellRequest helper function that performs authenticated HTTP requests to the Retell API using fetch, handling headers, body, errors, and JSON parsing.
    async function retellRequest( endpoint: string, method: string = "GET", body?: Record<string, unknown> ): Promise<unknown> { const apiKey = getApiKey(); const headers: Record<string, string> = { "Authorization": `Bearer ${apiKey}`, "Content-Type": "application/json", }; const options: RequestInit = { method, headers, }; if (body && method !== "GET") { options.body = JSON.stringify(body); } const response = await fetch(`${RETELL_API_BASE}${endpoint}`, options); if (!response.ok) { const errorText = await response.text(); throw new Error(`Retell API error (${response.status}): ${errorText}`); } // Handle 204 No Content if (response.status === 204) { return { success: true }; } return response.json(); }
  • src/index.ts:1283-1285 (registration)
    MCP server registration for listing available tools, which returns the tools array including the definition for retell_create_knowledge_base.
    server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools }; });
  • src/index.ts:1288-1313 (registration)
    MCP server registration for tool execution (CallToolRequestSchema), which parses the request, calls executeTool (containing the handler), and returns the result or error.
    server.setRequestHandler(CallToolRequestSchema, async (request) => { const { name, arguments: args } = request.params; try { const result = await executeTool(name, args as Record<string, unknown>); return { content: [ { type: "text", text: JSON.stringify(result, null, 2), }, ], }; } catch (error) { const errorMessage = error instanceof Error ? error.message : String(error); return { content: [ { type: "text", text: `Error: ${errorMessage}`, }, ], isError: true, }; } });

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/itsanamune/retellsimp'

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