photoshop_get_state
Retrieve a read-only snapshot of Photoshop session state, including active document, layer, and selection. Use it before document-dependent actions or after errors to recover context.
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, documents[] (id, name, width, height, saved, is_active for every open file), document (id, name, path, saved, width, height, resolution, colorMode, bitsPerChannel, layerCount, layers[] up to 40 top-level layers, artboards), activeLayer, activeArtboard, hasSelection. path is omitted until the file has been saved. Capture document.id and pass it as document_id on later mutating calls. Artboard ids come from document.artboards[].id. Preconditions: none (safe on empty session). Side effects: none.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| document_id | Yes | Photoshop document id from photoshop_get_state / photoshop_list_documents. Send null or 0 to use the active document. A positive number activates that document before the tool runs. When no document is open, a stale id does not block the call. |