PhotoFresco
v0.1.2Let AI agents edit images in a PhotoFresco window you approve: layers, masks, previews and export.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
photofresco_connect Connect to PhotoFresco
Open PhotoFresco in its own browser window on this computer and ask the user to allow this agent. The window shows a connection code; tell the user the code returned here so they can check it before clicking Allow. Inputs: access (optional) asks for permissions right away; document is "active" (default), "none" or a document_id; wait_seconds (default 40, at most 170) is how long this call waits for the user. Returns state "connected" with the session status, or state "pairing" with the code while the user has not decided yet: call photofresco_connect again to keep waiting (the request expires…
| Parameter | Type | Description |
|---|---|---|
access | object | Permissions to ask the user for once connected. Asking grants nothing; the user decides in the PhotoFresco window |
document | string | "active" (default), "none", or a document_id from photofresco_documents |
wait_seconds | number | Seconds to wait for the user's decision before returning the pending code (default 40) |
photofresco_status PhotoFresco status
Connection state, the pending connection code, the session (target document_id, revision, granted permissions, pending permission request, credit budget, pause state), folders granted for import/export and the enabled tool groups. Inputs: none. Effect: reads state only; never starts a browser.
photofresco_request_access Ask the user for permissions
Ask the user for permissions in the PhotoFresco window (replaces any pending request). The user may grant fewer; nothing is granted until they click Allow there. Tools appear as permissions arrive (tools/list_changed); photofresco_status shows grants and the pending request. Inputs: capabilities (required), budget_credits (required with spend, 1–100000 credits), reason (shown to the user, at most 200 characters). Effect: shows a request in the editor; changes no document. Needs a connected session.
| Parameter | Type | Description |
|---|---|---|
capabilities * | array | Permissions to ask for: read (see the document and previews), edit (change documents, open/close tabs), export (files leave the editor), external-write (send data to PhotoFresco services), spend (paid… |
budget_credits | integer | Credit budget for paid AI (required with spend) |
reason | string | Why, shown to the user (at most 200 characters) |
photofresco_documents List open documents
Open documents in the PhotoFresco window: document_id, name, whether it is the active tab, revision, which agent controls it and whether it is paused. Inputs: none. Effect: reads state only. Needs a connected session.
photofresco_attach Target a document
Make this session target another open document by document_id (from photofresco_documents). Operations run only while the target is the active tab, so ask the user to switch tabs if needed. Inputs: document (required). Effect: changes the session target; no document edit. Needs a connected session.
| Parameter | Type | Description |
|---|---|---|
document * | string | document_id to target |
photofresco_disconnect Disconnect from PhotoFresco
End this session (same as the user pressing Stop): in-flight work is interrupted, permissions are cleared, applied edits stay in History. The window stays open for the user unless close_window is true. Reconnecting needs the user's Allow again. Inputs: close_window (optional). Effect: ends the session; edits nothing.
| Parameter | Type | Description |
|---|---|---|
close_window | boolean | Also close the PhotoFresco browser window this server opened |
photofresco_list_tool_groups List PhotoFresco tool groups
The op groups this server can list as tools, which are enabled, and how many tools each adds now. Inputs: none. Effect: reads server state only.
photofresco_select_tool_groups Enable or disable tool groups
Enable or disable op groups to change which PhotoFresco operations are listed as tools (sends tools/list_changed). Use it when a needed operation is not listed. Listing never grants permissions. Inputs: enable, disable (group IDs from photofresco_list_tool_groups, or "all"). Effect: changes this server's tool list only.
| Parameter | Type | Description |
|---|---|---|
disable | array | Groups to remove |
enable | array | Groups to add |
adjust_add Adjustment: Add
Add a non-destructive adjustment layer above the active node. Types include brightness-contrast, levels, curves, exposure, hue-saturation, vibrance, color-balance, black-white, photo-filter, channel-mixer, gradient-map, selective-color, color-lookup, shadows-highlights, match-replace-color, invert, posterize, and threshold. Pass type-specific params in "params". Match color accepts source_layer_id/target_layer_id to sample RGB statistics. Set clipped=true (layer.set_props) to affect only the layer below. Inputs: adjustment_type (required), params. Units, ranges and allowed values are in the i…
adjust_set_params Adjustment: Set params
Update the active adjustment layer’s parameters (same shapes as adjust.add). Undoable. Inputs: params (required). Units, ranges and allowed values are in the input schema; the editor rejects arguments outside it before anything runs. Effect: Edits the document through an undoable command that appears in History. Undo: history_undo reverts it. Permission: Edit, granted by the user in the PhotoFresco window (ask with photofresco_request_access). Returns immediately with the result. Results carry document_id and revision. PhotoFresco operation: adjust.set_params.
canvas_resize Canvas: Resize
Change canvas size without resampling; content shifts by (dx, dy) px (e.g. dx=(newW−oldW)/2 to center). Clears the selection. Undoable. Inputs: width (required), height (required), dx, dy. Units, ranges and allowed values are in the input schema; the editor rejects arguments outside it before anything runs. Effect: Edits the document through an undoable command that appears in History. Undo: history_undo reverts it. Permission: Edit, granted by the user in the PhotoFresco window (ask with photofresco_request_access). Returns immediately with the result. Results carry document_id and revisio…
| Parameter | Type | Description |
|---|---|---|
height * | number | New height px |
width * | number | New width px |
dx | number | Content shift x (default 0) |
dy | number | Content shift y (default 0) |
crop_apply Crop: Apply
Apply pending crop or set a rectangle then apply. Undoable. Inputs: x, y, width, height. Units, ranges and allowed values are in the input schema; the editor rejects arguments outside it before anything runs. Effect: Edits the document through an undoable command that appears in History. Undo: history_undo reverts it. Permission: Edit, granted by the user in the PhotoFresco window (ask with photofresco_request_access). Returns immediately with the result. Results carry document_id and revision. PhotoFresco operation: crop.apply.
| Parameter | Type | Description |
|---|---|---|
height | number | Height |
width | number | Width |
x | number | Document x |
y | number | Document y |
doc_get_state Document: Get state
Get the full document state: document_id and content revision (agent sessions), dimensions, color mode, the layer tree (ids, names, kinds, blend modes, opacity, visibility, locks, pixel bounds), the active node id, and the current selection bounds. Call this first to orient yourself. Inputs: none. Effect: Reads the document or editor state; changes nothing. Permission: Read, granted by the user in the PhotoFresco window (ask with photofresco_request_access). Returns immediately with the result. Results carry document_id and revision. PhotoFresco operation: doc.get_state.
doc_histogram Document: Histogram
Return 256-bin histogram counts for the flattened visible document, restricted to the active selection when one exists. mode defaults to luminosity; rgb returns composite plus red/green/blue counts. Inputs: mode. Units, ranges and allowed values are in the input schema; the editor rejects arguments outside it before anything runs. Effect: Reads the document or editor state; changes nothing. Permission: Read, granted by the user in the PhotoFresco window (ask with photofresco_request_access). Returns immediately with the result. Results carry document_id and revision. PhotoFresco operation: do…
| Parameter | Type | Description |
|---|---|---|
mode | string | rgb, red, green, blue, or luminosity |
doc_new Document: New
Create a new document tab. Width/height use unit (px, in, cm, mm) and resolution; background is white, transparent, or color. Inputs: name, width, height, unit, resolution, background, background_color, preset. Units, ranges and allowed values are in the input schema; the editor rejects arguments outside it before anything runs. Effect: Opens, closes, duplicates or reverts documents (tabs); history_undo does not reverse it. Undo: not reversible with history_undo. Permission: Edit, granted by the user in the PhotoFresco window (ask with photofresco_request_access). Returns immediately with the…
| Parameter | Type | Description |
|---|---|---|
background | string | Background contents |
background_color | array | [r,g,b] when background=color |
height | number | Height in the selected unit |
name | string | Document name (default Untitled) |
preset | string | Preset id for UI bookkeeping |
resolution | number | Pixels per inch for physical units |
unit | string | Measurement unit |
width | number | Width in the selected unit |
doc_sample_color Document: Sample color
Read the flattened composite color at document coordinate (x, y). Returns RGB, RGBA, and HSB; does not change the foreground color. Inputs: x (required), y (required). Units, ranges and allowed values are in the input schema; the editor rejects arguments outside it before anything runs. Effect: Reads the document or editor state; changes nothing. Permission: Read, granted by the user in the PhotoFresco window (ask with photofresco_request_access). Returns immediately with the result. Results carry document_id and revision. PhotoFresco operation: doc.sample_color.
| Parameter | Type | Description |
|---|---|---|
x * | number | Doc x |
y * | number | Doc y |
edit_fill Edit: Fill
Fill the selection (or the whole canvas if none) on the active layer. Default contents=color uses color [r,g,b] or the current foreground; contents=pattern uses the active pattern or pattern_id. Inputs: contents, color, pattern_id, blend_mode, opacity. Units, ranges and allowed values are in the input schema; the editor rejects arguments outside it before anything runs. Effect: Edits the document through an undoable command that appears in History. Undo: history_undo reverts it. Permission: Edit, granted by the user in the PhotoFresco window (ask with photofresco_request_access). Returns imme…
| Parameter | Type | Description |
|---|---|---|
blend_mode | string | Pattern blend mode (default normal) |
color | array | [r, g, b] each 0-255 |
contents | string | color (default) or pattern |
opacity | number | Pattern opacity 0..1 (default 1) |
pattern_id | string | Pattern preset id; defaults to the active pattern when contents=pattern |
export_artifact Export: Artifact
Export the active document and keep the file in the editor as a retrievable artifact instead of starting a browser download. format "png" is the flattened visible composite (or, with layer_id, that layer's own pixels at its content bounds); "psd" is the layered Photoshop interchange file from File > Save; "pfd" is PhotoFresco's native editable document from Save to My Documents. Returns { artifact_id, format, mime_type, filename, byte_length, sha256, document_id, revision, width, height, layer_id, fidelity, loss, created_at, expires_at }; read the bytes with artifact.read. Artifacts are bound…
| Parameter | Type | Description |
|---|---|---|
format * | string | png (flattened or one layer), psd (layered interchange) or pfd (native, full fidelity) |
layer_id | string | PNG only: export this layer's own pixels instead of the composite |
filter_apply Filter: Apply
Apply a destructive filter to the active layer (selection restricts it). Types: gaussian-blur {radius px}, sharpen {amount 0..3, radius px}, sharpen-more, sharpen-edges, unsharp-mask {amount percent 1..500, radius px, threshold 0..255}, noise {amount 0..1}, box-blur {radius px}, motion-blur {angle deg, distance px}, radial-blur {amount 1..100, method spin|zoom}, average, median {radius 1..8}, mosaic {cellSize px}, high-pass {radius px}, ripple {amount px, wavelength px}, twirl {angle deg}, spherize {amount -100..100}, wave {amplitude px, wavelength px}, zigzag {amount px, ridges}, polar-coordi…
| Parameter | Type | Description |
|---|---|---|
filter_type * | string | Which filter |
params | object | Type-specific parameters |
history_redo History: Redo
Redo the next edit. Returns the label of what was redone, or null. Inputs: none. Effect: Edits the document through an undoable command that appears in History. Permission: Edit, granted by the user in the PhotoFresco window (ask with photofresco_request_access). Returns immediately with the result. Results carry document_id and revision. PhotoFresco operation: history.redo.
history_undo History: Undo
Undo the last edit. Returns the label of what was undone, or null. Reverts the last History entry, including edits made by the user. Inputs: none. Effect: Edits the document through an undoable command that appears in History. Permission: Edit, granted by the user in the PhotoFresco window (ask with photofresco_request_access). Returns immediately with the result. Results carry document_id and revision. PhotoFresco operation: history.undo.
image_resize Image: Resize
Resample the whole document to new pixel dimensions (bilinear). Undoable. Inputs: width (required), height (required). Units, ranges and allowed values are in the input schema; the editor rejects arguments outside it before anything runs. Effect: Edits the document through an undoable command that appears in History. Undo: history_undo reverts it. Permission: Edit, granted by the user in the PhotoFresco window (ask with photofresco_request_access). Returns immediately with the result. Results carry document_id and revision. PhotoFresco operation: image.resize.
| Parameter | Type | Description |
|---|---|---|
height * | number | New height px |
width * | number | New width px |
image_rotate Image: Rotate
Rotate the whole canvas by quarter turns: 1 = 90° clockwise, 2 = 180°, 3 = 90° counter-clockwise. Undoable. Inputs: turns (required). Units, ranges and allowed values are in the input schema; the editor rejects arguments outside it before anything runs. Effect: Edits the document through an undoable command that appears in History. Undo: history_undo reverts it. Permission: Edit, granted by the user in the PhotoFresco window (ask with photofresco_request_access). Returns immediately with the result. Results carry document_id and revision. PhotoFresco operation: image.rotate.
| Parameter | Type | Description |
|---|---|---|
turns * | number | 1, 2, or 3 quarter turns |
layer_add Layer: Add
Add a new empty layer above the active node and make it active. Inputs: name. Units, ranges and allowed values are in the input schema; the editor rejects arguments outside it before anything runs. Effect: Edits the document through an undoable command that appears in History. Undo: history_undo reverts it. Permission: Edit, granted by the user in the PhotoFresco window (ask with photofresco_request_access). Returns immediately with the result. Results carry document_id and revision. PhotoFresco operation: layer.add.
| Parameter | Type | Description |
|---|---|---|
name | string | Layer name (default "Layer N") |
layer_delete Layer: Delete
Delete the active node. Refused if it would leave no layers. Inputs: none. Effect: Edits the document through an undoable command that appears in History. Undo: history_undo reverts it. Permission: Edit, granted by the user in the PhotoFresco window (ask with photofresco_request_access). Returns immediately with the result. Results carry document_id and revision. PhotoFresco operation: layer.delete.
layer_duplicate Layer: Duplicate
Duplicate the active node (deep for groups); the copy becomes active. Inputs: none. Effect: Edits the document through an undoable command that appears in History. Undo: history_undo reverts it. Permission: Edit, granted by the user in the PhotoFresco window (ask with photofresco_request_access). Returns immediately with the result. Results carry document_id and revision. PhotoFresco operation: layer.duplicate.
layer_set_active Layer: Set active
Set the active node (layers paint/transform; groups move as a unit). Inputs: id (required). Units, ranges and allowed values are in the input schema; the editor rejects arguments outside it before anything runs. Effect: Changes editor view or tool settings; not a document edit and not in History. Permission: Edit, granted by the user in the PhotoFresco window (ask with photofresco_request_access). Returns immediately with the result. Results carry document_id and revision. PhotoFresco operation: layer.set_active.
| Parameter | Type | Description |
|---|---|---|
id * | string | Node id from doc.get_state |
layer_set_props Layer: Set props
Set properties on a node (default: the active one). Only provided fields change. blend_mode "pass-through" is groups-only. Inputs: id, name, visible, opacity, blend_mode, locked, lock_pixels, lock_position, lock_transparency, clipped, blend_if, channel_mask, knockout, blend_interior_as_group, blend_clipped_as_group, transparency_shapes_layer, mask_hides_effects, vector_mask_hides_effects. Units, ranges and allowed values are in the input schema; the editor rejects arguments outside it before anything runs. Effect: Edits the document through an undoable command that appears in History. Undo: h…
| Parameter | Type | Description |
|---|---|---|
blend_clipped_as_group | boolean | Apply the clipping base blend/opacity to the whole clip unit |
blend_if | object | null | Raster layer Blend If {channel,thisLayer:[b0,b1,w1,w0],underlying:[...]}; null clears it |
blend_interior_as_group | boolean | Blend fill and interior effects as one source |
blend_mode | string | Blend mode |
channel_mask | object | Raster layer RGB write mask {r:boolean,g:boolean,b:boolean} |
clipped | boolean | Clipping mask: confine rendering to the alpha of the layer below (⌥⌘G) |
id | string | Target node id (default: active) |
knockout | string | Knockout depth |
lock_pixels | boolean | Raster layer pixel lock |
lock_position | boolean | Raster layer position lock |
lock_transparency | boolean | Raster layer transparency lock |
locked | boolean | Lock/unlock |
mask_hides_effects | boolean | Apply the raster layer mask to generated effect output |
name | string | Rename |
opacity | number | 0..1 |
transparency_shapes_layer | boolean | Use source transparency to shape fill and interior effects |
vector_mask_hides_effects | boolean | Apply the vector mask to generated effect output |
visible | boolean | Show/hide |
mask_add Mask: Add
Add a raster mask to the active layer. mode "selection" rasterizes the current selection (selected = visible); default is "selection" when one exists, else "reveal". Inputs: mode. Units, ranges and allowed values are in the input schema; the editor rejects arguments outside it before anything runs. Effect: Edits the document through an undoable command that appears in History. Undo: history_undo reverts it. Permission: Edit, granted by the user in the PhotoFresco window (ask with photofresco_request_access). Returns immediately with the result. Results carry document_id and revision. PhotoFre…
| Parameter | Type | Description |
|---|---|---|
mode | string | Mask contents |
mask_remove Mask: Remove
Delete the active layer’s mask (the layer becomes fully visible again). Inputs: none. Effect: Edits the document through an undoable command that appears in History. Undo: history_undo reverts it. Permission: Edit, granted by the user in the PhotoFresco window (ask with photofresco_request_access). Returns immediately with the result. Results carry document_id and revision. PhotoFresco operation: mask.remove.
render_mask Preview: Mask
Preview a mask over a document-space region as a grayscale PNG (black 0 = hidden/unselected, white 255 = shown/selected) with exact coverage statistics { pixels, nonzero, full, mean } computed at document resolution over the region. source "layer" (default) is a layer's raster mask (layer_id, default the active layer), placed at its document position; source "selection" is the current selection. Read-only. Returns image { mime_type: "image/png", data_base64, width, height, byte_length } plus document_id, revision (the document revision rendered), document { width, height }, requested and regio…
| Parameter | Type | Description |
|---|---|---|
height | number | Region height in document pixels (whole number; default: to the bottom canvas edge) |
layer_id | string | Layer whose raster mask to show (source layer; default the active layer) |
max_size | number | Fit the preview inside this many pixels per side, never magnifying (default 1024). Use scale instead for exact detail |
scale | number | Exact output pixels per document pixel (1 = actual pixels, 4 = 4× magnified with nearest sampling, 0.25 = area-averaged). Output is limited to 2048 px per side and 4194304 px |
source | string | layer: the raster mask of layer_id (default); selection: the active selection |
width | number | Region width in document pixels (whole number; default: to the right canvas edge) |
x | number | Left edge in document pixels (whole number, default 0). May be negative; the region is clipped to the canvas |
y | number | Top edge in document pixels (whole number, default 0). May be negative; the region is clipped to the canvas |
render_preview Preview: Preview
Render the whole flattened composite to a PNG data URL, downscaled to fit max_size (never magnified). Use after edits to see the result. For a region at detail scale, one layer, a mask, or coordinate metadata use render.region / render.mask. Inputs: max_size. Units, ranges and allowed values are in the input schema; the editor rejects arguments outside it before anything runs. Effect: Reads the document or editor state; changes nothing. Permission: Read, granted by the user in the PhotoFresco window (ask with photofresco_request_access). Returns immediately with the result. Results carry docu…
| Parameter | Type | Description |
|---|---|---|
max_size | number | Max width/height in px (default 512, at most 2048) |
render_region Preview: Region
Preview a document-space region at a chosen scale as a PNG, without rendering the whole document. Without layer_id it shows the flattened visible composite (same compositor as PNG export); with layer_id it shows that layer's own pixels (raster, text, shape or smart object) before its mask, opacity, blend mode and effects. Use scale 1–16 to inspect detail at actual or magnified pixels, or max_size to fit an overview. Read-only; nothing is added to history. Returns image { mime_type: "image/png", data_base64, width, height, byte_length } plus document_id, revision (the document revision render…
| Parameter | Type | Description |
|---|---|---|
height | number | Region height in document pixels (whole number; default: to the bottom canvas edge) |
layer_id | string | Optional layer id (doc.get_state) to preview that layer alone instead of the composite |
max_size | number | Fit the preview inside this many pixels per side, never magnifying (default 1024). Use scale instead for exact detail |
scale | number | Exact output pixels per document pixel (1 = actual pixels, 4 = 4× magnified with nearest sampling, 0.25 = area-averaged). Output is limited to 2048 px per side and 4194304 px |
width | number | Region width in document pixels (whole number; default: to the right canvas edge) |
x | number | Left edge in document pixels (whole number, default 0). May be negative; the region is clipped to the canvas |
y | number | Top edge in document pixels (whole number, default 0). May be negative; the region is clipped to the canvas |
selection_all Selection: All
Select the whole document. Inputs: none. Effect: Edits the document through an undoable command that appears in History. Undo: history_undo reverts it. Permission: Edit, granted by the user in the PhotoFresco window (ask with photofresco_request_access). Returns immediately with the result. Results carry document_id and revision. PhotoFresco operation: selection.all.
selection_ellipse Selection: Ellipse
Select an ellipse inscribed in the given rect (doc coordinates). Inputs: x (required), y (required), w (required), h (required), mode, feather. Units, ranges and allowed values are in the input schema; the editor rejects arguments outside it before anything runs. Effect: Edits the document through an undoable command that appears in History. Undo: history_undo reverts it. Permission: Edit, granted by the user in the PhotoFresco window (ask with photofresco_request_access). Returns immediately with the result. Results carry document_id and revision. PhotoFresco operation: selection.ellipse.
| Parameter | Type | Description |
|---|---|---|
h * | number | Height |
w * | number | Width |
x * | number | Left |
y * | number | Top |
feather | number | Feather radius in px (softens the edge) |
mode | string | How to combine with the existing selection |
selection_invert Selection: Invert
Invert the current selection. Inputs: none. Effect: Edits the document through an undoable command that appears in History. Undo: history_undo reverts it. Permission: Edit, granted by the user in the PhotoFresco window (ask with photofresco_request_access). Returns immediately with the result. Results carry document_id and revision. PhotoFresco operation: selection.invert.
selection_none Selection: None
Deselect — clear the selection so edits affect the whole canvas again. Inputs: none. Effect: Edits the document through an undoable command that appears in History. Undo: history_undo reverts it. Permission: Edit, granted by the user in the PhotoFresco window (ask with photofresco_request_access). Returns immediately with the result. Results carry document_id and revision. PhotoFresco operation: selection.none.
selection_rect Selection: Rect
Select a rectangle in doc coordinates. Inputs: x (required), y (required), w (required), h (required), mode, feather. Units, ranges and allowed values are in the input schema; the editor rejects arguments outside it before anything runs. Effect: Edits the document through an undoable command that appears in History. Undo: history_undo reverts it. Permission: Edit, granted by the user in the PhotoFresco window (ask with photofresco_request_access). Returns immediately with the result. Results carry document_id and revision. PhotoFresco operation: selection.rect.
| Parameter | Type | Description |
|---|---|---|
h * | number | Height |
w * | number | Width |
x * | number | Left |
y * | number | Top |
feather | number | Feather radius in px (softens the edge) |
mode | string | How to combine with the existing selection |