Skip to main content
Glama

retell_create_chat

Start a new chat session with a Retell AI agent by providing an agent ID, enabling personalized conversations through dynamic variables and custom metadata.

Instructions

Create a new chat session with a chat agent.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
agent_idYesThe chat agent ID to use for the session
metadataNoOptional: Custom metadata for the chat session
retell_llm_dynamic_variablesNoOptional: Dynamic variables for personalized responses

Implementation Reference

  • The handler logic for the 'retell_create_chat' tool within the executeTool switch statement. It invokes the generic retellRequest helper to perform a POST request to the Retell API endpoint '/create-chat' with the provided arguments.
    case "retell_create_chat": return retellRequest("/create-chat", "POST", args);
  • Input schema defining the parameters for the retell_create_chat tool: requires 'agent_id', optional 'metadata' and 'retell_llm_dynamic_variables'.
    inputSchema: { type: "object", properties: { agent_id: { type: "string", description: "The chat agent ID to use for the session" }, metadata: { type: "object", description: "Optional: Custom metadata for the chat session" }, retell_llm_dynamic_variables: { type: "object", description: "Optional: Dynamic variables for personalized responses" } }, required: ["agent_id"] }
  • src/index.ts:200-221 (registration)
    Tool registration in the tools array, including name, description, and input schema. This array is returned by the ListTools handler.
    { name: "retell_create_chat", description: "Create a new chat session with a chat agent.", inputSchema: { type: "object", properties: { agent_id: { type: "string", description: "The chat agent ID to use for the session" }, metadata: { type: "object", description: "Optional: Custom metadata for the chat session" }, retell_llm_dynamic_variables: { type: "object", description: "Optional: Dynamic variables for personalized responses" } }, required: ["agent_id"] } },
  • Generic helper function used by all Retell API tools, including retell_create_chat. Handles authentication, request construction, error handling, and response parsing.
    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