retell_create_sms_chat
Initiate SMS conversations using AI agents by specifying sender, recipient, and agent ID. Enables automated outbound messaging through Retell AI's platform.
Instructions
Start an outbound SMS conversation using a specified chat agent.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| from_number | Yes | The sender's phone number in E.164 format | |
| to_number | Yes | The recipient's phone number in E.164 format | |
| agent_id | Yes | The chat agent ID to handle the conversation | |
| metadata | No | Optional: Custom metadata for the SMS chat |
Implementation Reference
- src/index.ts:1141-1142 (handler)The handler logic for the retell_create_sms_chat tool, which makes a POST request to the Retell API's /create-sms-chat endpoint using the generic retellRequest helper.case "retell_create_sms_chat": return retellRequest("/create-sms-chat", "POST", args);
- src/index.ts:222-247 (schema)Input schema definition and description for the retell_create_sms_chat tool, defining required parameters like from_number, to_number, and agent_id.{ name: "retell_create_sms_chat", description: "Start an outbound SMS conversation using a specified chat agent.", inputSchema: { type: "object", properties: { from_number: { type: "string", description: "The sender's phone number in E.164 format" }, to_number: { type: "string", description: "The recipient's phone number in E.164 format" }, agent_id: { type: "string", description: "The chat agent ID to handle the conversation" }, metadata: { type: "object", description: "Optional: Custom metadata for the SMS chat" } }, required: ["from_number", "to_number", "agent_id"] } },
- src/index.ts:1283-1285 (registration)Registration of the tools list handler that exposes the retell_create_sms_chat tool (and others) via MCP's ListToolsRequestSchema.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools }; });
- src/index.ts:23-57 (helper)Generic helper function used by all Retell tools, including retell_create_sms_chat, to make authenticated HTTP requests to the Retell AI API.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(); }