add_keywords
Add hierarchical keywords to photos in Lightroom Classic to organize and categorize your catalog for efficient searching and filtering.
Instructions
Add keywords (supports hierarchical format: A > B > C).
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| keywords | Yes | ||
| local_ids | No |
Implementation Reference
- The `add_keywords` tool is defined as an MCP tool using the `@mcp.tool()` decorator. It validates the input keywords and local_ids, creates a payload, and calls the internal `_call` function with the `metadata.add_keywords` command to interact with the Lightroom bridge.
async def add_keywords(keywords: list[str], local_ids: list[int] | None = None) -> dict[str, Any]: """Add keywords (supports hierarchical format: A > B > C).""" if not keywords: raise ValueError("keywords cannot be empty") payload: dict[str, Any] = {"keywords": [str(k) for k in keywords]} ids = validate_local_ids(local_ids) if ids: payload["local_ids"] = ids return await _call("metadata.add_keywords", payload)