retell_publish_agent
Deploy the current agent configuration as a new version to update and activate changes in your Retell AI voice and chat agents.
Instructions
Publish/deploy the current agent configuration as a new version.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| agent_id | Yes | The agent ID to publish |
Implementation Reference
- src/index.ts:1181-1182 (handler)The handler logic for executing the retell_publish_agent tool by making a POST request to the Retell API's publish-agent endpoint with the agent_id.case "retell_publish_agent": return retellRequest(`/publish-agent/${args.agent_id}`, "POST");
- src/index.ts:578-590 (schema)The input schema and metadata definition for the retell_publish_agent tool, including required agent_id parameter.{ name: "retell_publish_agent", description: "Publish/deploy the current agent configuration as a new version.", inputSchema: { type: "object", properties: { agent_id: { type: "string", description: "The agent ID to publish" } }, required: ["agent_id"] }
- src/index.ts:23-57 (helper)Generic API request helper function that handles authentication, HTTP requests, error handling, and JSON parsing for all Retell AI API calls used by tool handlers.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:1283-1285 (registration)MCP server registration for the ListToolsRequestSchema handler, which returns the tools array containing the retell_publish_agent tool definition.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools }; });
- src/index.ts:1287-1313 (registration)MCP server registration for the CallToolRequestSchema handler, which dispatches tool execution to executeTool based on the tool name, handling retell_publish_agent via its case.// Register tool execution handler 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, }; } });