retell_delete_agent
Remove a voice agent from your Retell AI account by specifying its agent ID to manage your agent inventory.
Instructions
Delete a voice agent from your account.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| agent_id | Yes | The agent ID to delete |
Implementation Reference
- src/index.ts:1179-1180 (handler)The execution handler within the executeTool switch statement that handles the retell_delete_agent tool by calling the Retell API DELETE endpoint /delete-agent/{agent_id}.case "retell_delete_agent": return retellRequest(`/delete-agent/${args.agent_id}`, "DELETE");
- src/index.ts:564-577 (schema)The tool schema definition in the tools array, specifying the name, description, and input schema that requires an agent_id string.{ name: "retell_delete_agent", description: "Delete a voice agent from your account.", inputSchema: { type: "object", properties: { agent_id: { type: "string", description: "The agent ID to delete" } }, required: ["agent_id"] } },
- src/index.ts:1283-1285 (registration)MCP server registration for listing tools, which exposes the retell_delete_agent tool via the tools array.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools }; });
- src/index.ts:23-57 (helper)Shared helper function retellRequest that performs authenticated API calls to Retell, used by the handler to execute the DELETE request.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(); }
- src/index.ts:1288-1313 (registration)MCP server handler for tool execution requests, which dispatches to executeTool based on the tool name (retell_delete_agent).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, }; } });