delete_job
Remove a voiceover job and its files from the ElevenLabs MCP Server to manage storage and clean up completed tasks.
Instructions
Delete a voiceover job and its associated files
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| job_id | Yes | ID of the job to delete |
Implementation Reference
- src/elevenlabs_mcp/server.py:479-509 (handler)The main handler logic for the delete_job tool. It retrieves the job, deletes the associated audio file if present, then calls the database delete_job method, and returns success message.elif name == "delete_job": job_id = arguments.get("job_id") if not job_id: raise ValueError("job_id is required") # Get job to check if it exists and get file path job = await self.db.get_job(job_id) if not job: return [types.TextContent( type="text", text=f"Job {job_id} not found" )] # Delete associated audio file if it exists if job.output_file: try: output_path = Path(job.output_file) if output_path.exists(): output_path.unlink() except Exception as e: return [types.TextContent( type="text", text=f"Error deleting audio file: {str(e)}" )] # Delete job from database deleted = await self.db.delete_job(job_id) return [types.TextContent( type="text", text=f"Successfully deleted job {job_id} and associated files" )]
- src/elevenlabs_mcp/server.py:253-266 (registration)Tool registration in list_tools(), including name, description, and input schema.types.Tool( name="delete_job", description="Delete a voiceover job and its associated files", inputSchema={ "type": "object", "properties": { "job_id": { "type": "string", "description": "ID of the job to delete" } }, "required": ["job_id"] } ),
- Database helper method that performs the SQL DELETE on the audio_jobs table for the given job_id.async def delete_job(self, job_id: str) -> bool: """Delete an audio job by ID. Returns True if job was deleted.""" async with aiosqlite.connect(self.db_path) as db: cursor = await db.execute("DELETE FROM audio_jobs WHERE id = ?", (job_id,)) deleted = cursor.rowcount > 0 await db.commit() return deleted