Skip to main content
Glama

retell_create_chat_completion

Send messages in existing chat sessions and receive AI agent responses to continue conversations.

Instructions

Send a message in an existing chat session and get the agent's response.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
chat_idYesThe chat session ID
contentYesThe message content to send

Implementation Reference

  • The specific switch case in the executeTool function that handles the retell_create_chat_completion tool by calling the Retell API's /create-chat-completion endpoint with POST method and the input arguments.
    case "retell_create_chat_completion": return retellRequest("/create-chat-completion", "POST", args);
  • Defines the tool's metadata including name, description, and input schema (requiring chat_id and content) used for validation and listing.
    { name: "retell_create_chat_completion", description: "Send a message in an existing chat session and get the agent's response.", inputSchema: { type: "object", properties: { chat_id: { type: "string", description: "The chat session ID" }, content: { type: "string", description: "The message content to send" } }, required: ["chat_id", "content"] } },
  • src/index.ts:1283-1285 (registration)
    Registers the handler for listing all tools, exposing the schema for retell_create_chat_completion via the 'tools' array.
    server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools }; });
  • Generic helper function that performs authenticated HTTP requests to the Retell AI API, used by the tool handler.
    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:1288-1313 (registration)
    Registers the MCP CallToolRequestSchema handler which invokes executeTool (containing the specific case for this tool) based on the tool name.
    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