retell_create_knowledge_base
Create a knowledge base to provide context for AI agents, enabling them to access relevant information during conversations.
Instructions
Create a new knowledge base for providing context to agents.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| knowledge_base_name | Yes | Name for the knowledge base | |
| enable_auto_refresh | No | Whether to automatically refresh sources |
Implementation Reference
- src/index.ts:1229-1230 (handler)The switch case handler in the executeTool function that executes the tool by calling the generic retellRequest helper to POST to the Retell API's /create-knowledge-base endpoint with the provided arguments.case "retell_create_knowledge_base": return retellRequest("/create-knowledge-base", "POST", args);
- src/index.ts:890-907 (schema)The tool registration object in the tools array, including name, description, and inputSchema for parameter validation in MCP.{ 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"] } },
- src/index.ts:23-57 (helper)Generic helper function for making authenticated API requests to Retell AI, used by all tool handlers including this one.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 request handler for ListToolsRequestSchema that returns the tools array containing this tool's definition.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools }; });