Skip to main content
Glama

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

TableJSON Schema
NameRequiredDescriptionDefault
asset_idsNo
album_idNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • 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)
  • 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")
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Discloses side effect: 'Side effect: deletes all edit records for the assets.' No annotations provided, so description carries the full burden. This is sufficient for a revert operation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Description is moderately concise, but includes a separate 'Args:' section that largely repeats parameter info from the schema description (which is absent). Could be tightened, but structure is logical: purpose, usage, args, returns.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no output schema, the description provides return format ('JSON with reverted/failed counts'). Mentions side effect and mutual exclusivity. No annotations, but behavioral side effect is covered. Lacks error handling info, but acceptable.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 0%, but description adds full meaning: asset_ids (list of UUIDs, mutually exclusive with album_id) and album_id (revert all in album). Also clarifies the mutual exclusivity and provides argument context.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description uses specific verb 'remove' and resource 'non-destructive edits (rotation, crop, mirror) from assets', clearly distinguishing from siblings like rotate_assets. It explicitly states the restoration of original appearance.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Provides explicit usage context: 'Use this to undo rotate_assets or any other display transforms.' Also explains mutual exclusivity of asset_ids and album_id. Lacks explicit when-not-to-use, but the non-destructive scope is implied.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/drolosoft/immich-photo-manager'

If you have feedback or need assistance with the MCP directory API, please join our Discord server