delete_tag
Remove a tag from all assets and permanently delete it from the library.
Instructions
Delete a tag and remove it from all assets. The assets themselves are unaffected. Side effect: permanently deletes the tag (cannot be undone).
Args:
tag_id: The tag's UUID to delete.
Returns: JSON with deleted confirmation and tag_id.Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| tag_id | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- The MCP tool handler that defines and registers the 'delete_tag' tool. It receives tag_id from the client, calls the immich client's delete_tag method, and returns a JSON confirmation or error.
@mcp.tool() async def delete_tag(ctx: Context, tag_id: str) -> str: """Delete a tag and remove it from all assets. The assets themselves are unaffected. Side effect: permanently deletes the tag (cannot be undone). Args: tag_id: The tag's UUID to delete. Returns: JSON with deleted confirmation and tag_id. """ try: await _client(ctx).delete_tag(tag_id) return json.dumps({"deleted": True, "tag_id": tag_id}) except httpx.HTTPStatusError as e: return json.dumps({"error": f"Immich API error: {e.response.status_code}", "detail": e.response.text[:200]}) - The ImmichClient helper method that actually performs the HTTP DELETE request to the Immich API endpoint /tags/{tag_id}. This is the low-level API call.
async def delete_tag(self, tag_id: str) -> None: """Delete a tag.""" await self._request("DELETE", f"/tags/{tag_id}") - src/immich_mcp_server/server.py:1188-1188 (registration)The tool is registered via the @mcp.tool() decorator on the delete_tag function in server.py. This is how the MCP framework discovers and exposes the tool.
@mcp.tool()