Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 29 additions & 2 deletions photoshop_mcp_server/ps_adapter/action_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,35 @@ def get_active_document_info(cls) -> dict[str, Any]:
except Exception as e:
print(f"Error getting document path: {e}")

# Get layers info would require more complex Action Manager code
# This is a simplified implementation
# Layer information is easier and more reliable through the DOM API.
# Use it as a companion to the Action Manager document metadata above.
try:
doc = ps_app.get_active_document()
if doc:
for i, layer in enumerate(doc.artLayers):
is_background = bool(getattr(layer, "isBackgroundLayer", False))
if is_background:
continue

result["layers"].append(
{
"index": i,
"name": getattr(layer, "name", ""),
"visible": getattr(layer, "visible", True),
"kind": str(getattr(layer, "kind", "Unknown")),
}
)

for i, layer_set in enumerate(doc.layerSets):
result["layer_sets"].append(
{
"index": i,
"name": getattr(layer_set, "name", ""),
"visible": getattr(layer_set, "visible", True),
}
)
except Exception as e:
print(f"Error getting layer info: {e}")

return result

Expand Down