retell_list_chats
Retrieve chat session records from Retell AI's platform with optional filters and pagination to manage conversation history.
Instructions
List all chat sessions with optional filtering.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Number of results to return | |
| pagination_key | No | Pagination key for fetching next page |
Implementation Reference
- src/index.ts:1147-1148 (handler)The execution handler for the 'retell_list_chats' tool. It calls the generic retellRequest helper function with a GET request to the Retell API endpoint '/list-chat' (note: input arguments like limit and pagination_key are not forwarded).
case "retell_list_chats": return retellRequest("/list-chat", "GET"); - src/index.ts:280-296 (registration)Tool registration entry in the MCP tools array, defining the name, description, and input schema for 'retell_list_chats'.
{ name: "retell_list_chats", description: "List all chat sessions with optional filtering.", inputSchema: { type: "object", properties: { limit: { type: "integer", description: "Number of results to return" }, pagination_key: { type: "string", description: "Pagination key for fetching next page" } } } }, - src/index.ts:283-295 (schema)Input schema definition for validating parameters (limit, pagination_key) of the 'retell_list_chats' tool.
inputSchema: { type: "object", properties: { limit: { type: "integer", description: "Number of results to return" }, pagination_key: { type: "string", description: "Pagination key for fetching next page" } } } - src/index.ts:23-57 (helper)Generic helper function retellRequest used by the handler to make authenticated HTTP requests to the Retell 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(); }