Skip to main content
Glama

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
NameRequiredDescriptionDefault
from_numberYesThe sender's phone number in E.164 format
to_numberYesThe recipient's phone number in E.164 format
agent_idYesThe chat agent ID to handle the conversation
metadataNoOptional: Custom metadata for the SMS chat

Implementation Reference

  • 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);
  • 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,
        };
      }
    });
  • 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();
    }

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