photoshop_get_state
Read a cheap, read-only snapshot of the current Photoshop session to get the active document, layer, and selection. Use it before edits or after errors to recover context safely.
Instructions
Return a cheap read-only snapshot of Photoshop session state (active document, layer, selection).
Use when: before any tool that needs an active document/layer, or after an error to recover context. Do NOT use when: you only need a visual preview — use photoshop_get_preview instead.
Returns: JSON with hasDocument, openDocumentCount, document.id/name/dimensions/colorMode/artboards, activeLayer, activeArtboard, hasSelection. Capture document.id and pass it as document_id on later mutating calls. Artboard ids come from document.artboards[].id. When openDocumentCount > 1, call photoshop_list_documents before acting across tabs. Preconditions: none (safe on empty session). Side effects: none.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| document_id | No | Optional Photoshop document id from photoshop_get_state / photoshop_list_documents. When set, the tool activates that document before running so a UI tab switch cannot retarget the edit. |