Skip to main content
Glama

retell_create_chat_completion

Send a message in an existing chat session and receive the AI agent's response to continue the conversation.

Instructions

Send a message in an existing chat session and get the agent's response.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
chat_idYesThe chat session ID
contentYesThe message content to send

Implementation Reference

  • Handler logic within the executeTool switch statement that dispatches the tool call to Retell AI's /create-chat-completion endpoint via POST request using the shared retellRequest helper.
    case "retell_create_chat_completion":
      return retellRequest("/create-chat-completion", "POST", args);
  • Input schema defining the parameters for the retell_create_chat_completion tool: required chat_id (string) and content (string).
    inputSchema: {
      type: "object",
      properties: {
        chat_id: {
          type: "string",
          description: "The chat session ID"
        },
        content: {
          type: "string",
          description: "The message content to send"
        }
      },
      required: ["chat_id", "content"]
    }
  • src/index.ts:262-279 (registration)
    Tool registration in the tools array, including name, description, and input schema, which is provided to MCP clients via ListToolsRequest.
    {
      name: "retell_create_chat_completion",
      description: "Send a message in an existing chat session and get the agent's response.",
      inputSchema: {
        type: "object",
        properties: {
          chat_id: {
            type: "string",
            description: "The chat session ID"
          },
          content: {
            type: "string",
            description: "The message content to send"
          }
        },
        required: ["chat_id", "content"]
      }
    },
  • Generic helper function for making authenticated HTTP requests to the Retell AI API, used by all tool handlers including retell_create_chat_completion.
    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