retell_create_chat_completion
Send a message in an existing chat session and receive the AI agent's response to continue the conversation.
Instructions
Send a message in an existing chat session and get the agent's response.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| chat_id | Yes | The chat session ID | |
| content | Yes | The message content to send |
Implementation Reference
- src/index.ts:1145-1146 (handler)Handler logic within the executeTool switch statement that dispatches the tool call to Retell AI's /create-chat-completion endpoint via POST request using the shared retellRequest helper.case "retell_create_chat_completion": return retellRequest("/create-chat-completion", "POST", args);
- src/index.ts:265-278 (schema)Input schema defining the parameters for the retell_create_chat_completion tool: required chat_id (string) and content (string).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:262-279 (registration)Tool registration in the tools array, including name, description, and input schema, which is provided to MCP clients via ListToolsRequest.{ 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:23-57 (helper)Generic helper function for making authenticated HTTP requests to the Retell AI API, used by all tool handlers including retell_create_chat_completion.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(); }