Skip to main content
Glama

retell_create_web_call

Initiate a web call session with an AI agent by generating a call ID and access token for WebRTC connection setup.

Instructions

Create a new web call session. Returns a call ID and access token for establishing a WebRTC connection.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
agent_idYesThe agent ID to use for the web call
metadataNoOptional: Custom metadata to attach to the call
retell_llm_dynamic_variablesNoOptional: Dynamic variables to pass to the LLM

Implementation Reference

  • Handler case for retell_create_web_call tool. Makes a POST request to the Retell API's /v2/create-web-call endpoint using the generic retellRequest helper.
    case "retell_create_web_call":
      return retellRequest("/v2/create-web-call", "POST", args);
  • Input schema for retell_create_web_call defining required agent_id and optional metadata/llm variables.
    inputSchema: {
      type: "object",
      properties: {
        agent_id: {
          type: "string",
          description: "The agent ID to use for the web call"
        },
        metadata: {
          type: "object",
          description: "Optional: Custom metadata to attach to the call"
        },
        retell_llm_dynamic_variables: {
          type: "object",
          description: "Optional: Dynamic variables to pass to the LLM"
        }
      },
      required: ["agent_id"]
    }
  • src/index.ts:92-113 (registration)
    Tool registration in the tools array: defines name, description, and inputSchema for MCP tool listing.
    {
      name: "retell_create_web_call",
      description: "Create a new web call session. Returns a call ID and access token for establishing a WebRTC connection.",
      inputSchema: {
        type: "object",
        properties: {
          agent_id: {
            type: "string",
            description: "The agent ID to use for the web call"
          },
          metadata: {
            type: "object",
            description: "Optional: Custom metadata to attach to the call"
          },
          retell_llm_dynamic_variables: {
            type: "object",
            description: "Optional: Dynamic variables to pass to the LLM"
          }
        },
        required: ["agent_id"]
      }
    },
  • Generic helper function used by all Retell tools to make authenticated API requests to Retell AI servers.
    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();
    }
  • Helper to retrieve and validate the Retell API key from environment variable.
    function getApiKey(): string {
      const apiKey = process.env.RETELL_API_KEY;
      if (!apiKey) {
        throw new Error("RETELL_API_KEY environment variable is required");
      }
      return apiKey;
    }

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