revert_asset_edits
Reverts non-destructive edits like rotation, crop, and mirror from assets, restoring their original appearance. Provide asset IDs or album ID to apply.
Instructions
Remove all non-destructive edits (rotation, crop, mirror) from assets, restoring original appearance. Use this to undo rotate_assets or any other display transforms. Provide EITHER asset_ids OR album_id. Side effect: deletes all edit records for the assets.
Args:
asset_ids: List of asset UUIDs to revert. Mutually exclusive with album_id.
album_id: Revert all assets in this album. Mutually exclusive with asset_ids.
Returns: JSON with reverted/failed counts.Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| asset_ids | No | ||
| album_id | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- src/immich_mcp_server/server.py:298-343 (handler)The `revert_asset_edits` MCP tool handler: accepts asset_ids or album_id, resolves assets, then calls client.delete_asset_edits on each to remove all non-destructive edits.
@mcp.tool() async def revert_asset_edits( ctx: Context, asset_ids: list[str] | None = None, album_id: str = "", ) -> str: """Remove all non-destructive edits (rotation, crop, mirror) from assets, restoring original appearance. Use this to undo rotate_assets or any other display transforms. Provide EITHER asset_ids OR album_id. Side effect: deletes all edit records for the assets. Args: asset_ids: List of asset UUIDs to revert. Mutually exclusive with album_id. album_id: Revert all assets in this album. Mutually exclusive with asset_ids. Returns: JSON with reverted/failed counts. """ client = _client(ctx) ids: list[str] = [] album_name = "" if album_id: album = await client.get_album(album_id) album_name = album.get("albumName", "") ids = [a["id"] for a in album.get("assets", [])] if not ids: return json.dumps({"error": f"Album '{album_name}' is empty."}) elif asset_ids: ids = asset_ids else: return json.dumps({"error": "Provide either asset_ids or album_id."}) results: dict = {"reverted": 0, "failed": 0, "errors": []} for aid in ids: try: await client.delete_asset_edits(aid) results["reverted"] += 1 except Exception as e: results["failed"] += 1 results["errors"].append({"asset_id": aid, "error": str(e)}) results["total_requested"] = len(ids) if album_name: results["album"] = album_name if not results["errors"]: del results["errors"] return json.dumps(results, default=str) - src/immich_mcp_server/server.py:298-298 (registration)The tool is registered as an MCP tool via the @mcp.tool() decorator on line 298.
@mcp.tool() - The `delete_asset_edits` method on ImmichClient that performs the actual HTTP DELETE to /api/assets/{asset_id}/edits to revert edits.
async def delete_asset_edits(self, asset_id: str) -> None: """Remove all edits from an asset (revert to original).""" await self._request("DELETE", f"/assets/{asset_id}/edits")