update_tag
Update a tag's name or color, propagating changes to all assets using that tag.
Instructions
Update a tag's name or color. Side effect: changes apply to all assets using this tag.
Args:
tag_id: The tag's UUID.
name: New tag name. Omit to keep current.
color: New hex color (e.g. '#FF5733'). Omit to keep current.
Returns: JSON with the updated tag object.Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| tag_id | Yes | ||
| name | No | ||
| color | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- The MCP tool handler for 'update_tag'. Decorated with @mcp.tool(), it accepts tag_id, name, and color parameters, builds a fields dict, calls the client's update_tag method, and returns JSON.
@mcp.tool() async def update_tag(ctx: Context, tag_id: str, name: str | None = None, color: str | None = None) -> str: """Update a tag's name or color. Side effect: changes apply to all assets using this tag. Args: tag_id: The tag's UUID. name: New tag name. Omit to keep current. color: New hex color (e.g. '#FF5733'). Omit to keep current. Returns: JSON with the updated tag object. """ fields: dict = {} if name is not None: fields["name"] = name if color is not None: fields["color"] = color if not fields: return json.dumps({"error": "No fields to update. Provide name or color."}) try: result = await _client(ctx).update_tag(tag_id, **fields) return json.dumps(result, default=str) except httpx.HTTPStatusError as e: return json.dumps({"error": f"Immich API error: {e.response.status_code}", "detail": e.response.text[:200]}) - The ImmichClient.update_tag helper method that sends a PUT request to /tags/{tag_id} with the provided fields to update the tag on the Immich server.
async def update_tag(self, tag_id: str, **fields) -> dict: """Update a tag (name, color).""" return await self._request("PUT", f"/tags/{tag_id}", json=fields) - src/immich_mcp_server/server.py:1163-1163 (registration)The @mcp.tool() decorator registers 'update_tag' as an MCP tool in the FastMCP server instance.
@mcp.tool()