update_shared_link
Modify a shared link's permissions and expiry. Control download, upload, metadata visibility, or set expiration date; changes take effect immediately.
Instructions
Update a shared link's permissions or expiry. Use this to tighten/loosen access or set an expiration date. Side effect: changes public link behavior immediately.
Args:
link_id: The shared link's UUID.
allow_download: Allow visitors to download original files.
show_metadata: Show EXIF data to visitors.
allow_upload: Allow visitors to upload photos to the shared album.
description: Link description. Empty string clears it.
expiry_at: ISO 8601 expiry datetime. Empty string removes expiry (link never expires).
Returns: JSON with the updated shared link object.Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| link_id | Yes | ||
| allow_download | No | ||
| show_metadata | No | ||
| allow_upload | No | ||
| description | No | ||
| expiry_at | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- src/immich_mcp_server/server.py:782-822 (handler)MCP tool handler for update_shared_link — builds a fields dict from optional parameters and delegates to ImmichClient.update_shared_link, with error handling.
@mcp.tool() async def update_shared_link( ctx: Context, link_id: str, allow_download: bool | None = None, show_metadata: bool | None = None, allow_upload: bool | None = None, description: str | None = None, expiry_at: str | None = None, ) -> str: """Update a shared link's permissions or expiry. Use this to tighten/loosen access or set an expiration date. Side effect: changes public link behavior immediately. Args: link_id: The shared link's UUID. allow_download: Allow visitors to download original files. show_metadata: Show EXIF data to visitors. allow_upload: Allow visitors to upload photos to the shared album. description: Link description. Empty string clears it. expiry_at: ISO 8601 expiry datetime. Empty string removes expiry (link never expires). Returns: JSON with the updated shared link object. """ fields: dict = {} if allow_download is not None: fields["allowDownload"] = allow_download if show_metadata is not None: fields["showMetadata"] = show_metadata if allow_upload is not None: fields["allowUpload"] = allow_upload if description is not None: fields["description"] = description # empty string clears it if expiry_at is not None: fields["expiresAt"] = expiry_at if expiry_at else None # empty string removes expiry if not fields: return json.dumps({"error": "No fields to update."}) try: result = await _client(ctx).update_shared_link(link_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]}) - src/immich_mcp_server/server.py:782-822 (registration)The @mcp.tool() decorator registers this function as an MCP tool named 'update_shared_link'.
@mcp.tool() async def update_shared_link( ctx: Context, link_id: str, allow_download: bool | None = None, show_metadata: bool | None = None, allow_upload: bool | None = None, description: str | None = None, expiry_at: str | None = None, ) -> str: """Update a shared link's permissions or expiry. Use this to tighten/loosen access or set an expiration date. Side effect: changes public link behavior immediately. Args: link_id: The shared link's UUID. allow_download: Allow visitors to download original files. show_metadata: Show EXIF data to visitors. allow_upload: Allow visitors to upload photos to the shared album. description: Link description. Empty string clears it. expiry_at: ISO 8601 expiry datetime. Empty string removes expiry (link never expires). Returns: JSON with the updated shared link object. """ fields: dict = {} if allow_download is not None: fields["allowDownload"] = allow_download if show_metadata is not None: fields["showMetadata"] = show_metadata if allow_upload is not None: fields["allowUpload"] = allow_upload if description is not None: fields["description"] = description # empty string clears it if expiry_at is not None: fields["expiresAt"] = expiry_at if expiry_at else None # empty string removes expiry if not fields: return json.dumps({"error": "No fields to update."}) try: result = await _client(ctx).update_shared_link(link_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]}) - Client helper method that makes the actual PATCH /shared-links/{link_id} API call to Immich.
async def update_shared_link(self, link_id: str, **fields) -> dict: """Update a shared link.""" return await self._request("PATCH", f"/shared-links/{link_id}", json=fields)