retell_create_sms_chat
Start an outbound SMS conversation using a specified chat agent. Initiate automated SMS chats by providing sender and recipient phone numbers along with the agent ID to handle the conversation.
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)Handler case in executeTool function that implements the tool logic by calling retellRequest to POST to /create-sms-chat endpoint with input args.case "retell_create_sms_chat": return retellRequest("/create-sms-chat", "POST", args);
- src/index.ts:222-247 (schema)Tool schema definition including name, description, and inputSchema with required parameters from_number, to_number, 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)MCP server handler for listing tools, which returns the tools array containing the retell_create_sms_chat tool definition.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools }; });
- src/index.ts:1288-1313 (registration)MCP server handler for calling tools, which invokes executeTool(name, args) dispatching to the specific handler case.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, }; } });
- src/index.ts:23-57 (helper)Helper function used by all tool handlers 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(); }