darktable icon indicating copy to clipboard operation
darktable copied to clipboard

MCP server: constructive usage report after an intensive morning session (feature requests + stability notes)

Open andreagosto opened this issue 2 months ago • 6 comments

MCP server: constructive usage report after an intensive morning session (feature requests + stability notes)

Hi darktable team — first of all: thank you for the MCP server, it's a great foundation. This is a constructive case study written after a full morning of real, intensive use of the nightly MCP (2026-09-06, darktable 5.7.0+758~gd63f1023a3) to develop a batch of RAW photos (Olympus ORF, pine forest series) end-to-end: iterate a develop on a scene-referred pipeline, validate with image_stats, compare variants, and save a reusable style. It is a nightly, so nothing below is a complaint — just structured feedback + concrete feature suggestions, with the reproducible quirks we hit. Happy to help test or detail any of these.

Already filed separately: #22174 — export/render capped at 1363×1024 and PNG-only output.

What worked well (thanks!)

  • Module introspection (module_schema, encode_params, decode_params) is excellent — it made parameter-driven development possible despite the absence of docs.
  • image_stats (per-channel percentiles + clip counts) is a superb "eyes for an agent" primitive; the whole tonal iteration loop was driven by it without a single visual check.
  • Rendering on throwaway duplicates (non-destructive) is the right default for agent workflows.

A. Workflow blockers: no way to write a develop back

The single biggest gap. We had to produce variants via transient stack renders + exported PNGs, and creating a saved style out of that variant required hand-crafting a .dtstyle file and writing it straight into the database. Suggested tools (GUI concepts that currently have no MCP equivalent):

  • set/reset/overwrite an image's history: e.g. set_history {imgid, stack} (replace), reset_history {imgid};
  • clone/duplicate an image (cheap safe experiments without touching the original);
  • apply_style with replace semantics or module selection;
  • save_style from a module list (GUI has per-module checkboxes; MCP save_style clones the whole stored history, which includes auto/builtin modules that don't belong in a style).

B. stack/pipeline semantics are fragile and undocumented

  • history_end combined with stack silently discards the stack (output equals the bare raw base). Discovered by accident; cost a lot of time.
  • Module behaviour inside stack is inconsistent: some modules are inert (colorcorrection), temperature behaves with relative-to-camera semantics that depend on the image, colorbalancergb hue/chroma casts catastrophically crush channels, and channelmixerrgb cannot be set via named params (non-scalar → requires a full blob_hex, undocumented).
  • No way to control where a module sits in the pixelpipe, and parameter units are not documented in the tool schema (mcp-tools.json gives bare integer/no description for e.g. width).

C. Stability notes

  • import_style crashes the server (process exits; client sees "Connection closed"). The harness auto-restarts it; the style is not imported. Workaround used: direct INSERT into styles/style_items.
  • Some parameter combinations produced non-reproducible results between runs (e.g. a temperature green coefficient ≠ 1.0 gave very different stats on re-render, while green: 1.0 was reproducible). Parallel tool calls from one client occasionally returned self-consistent but non-reproducible families. Worth an internal check for shared/static state during renders.

D. Missing conveniences (lower priority)

  • No EXIF/camera metadata access (ISO/time/aperture) — needed to reason about noise/shadow headroom; I had to probe the raw with exposure pushes instead.
  • No catalog filtering/browsing (film roll/folder/rating/color label) beyond a flat list_images.
  • No batch operations (apply style to selection, export queue).

Suggested priority for the roadmap

  1. Write-back develop tools (A) — unlocks "actually edit the photo" agent workflows.
  2. Stack semantics stability + parameter completeness (B) — trustworthiness of renders.
  3. import_style crash fix (C).
  4. Metadata access + batch/filter (D).

Thanks again for this — the direction is right, and I'm available to provide repro cases for any of the above (e.g. minimal stacks that reproduce the inert/crashing modules).

andreagosto avatar Sep 06 '26 11:09 andreagosto

@andreagosto : Thank you for the details feedback. I will work on updates according to it. Please stay tuned.

andriiryzhkov avatar Sep 07 '26 06:09 andriiryzhkov

Quick update: import_style reproduced crashing the MCP server a second time (2026-09-07, same nightly 5.7.0+758~gd63f1023a3): the process exits and the client sees "Connection closed"; the style is not imported. Workaround that works reliably: insert the style rows directly into data.db (styles + style_items), using the same structure save_style writes. Happy to provide a minimal repro .dtstyle and logs if useful.

andreagosto avatar Sep 07 '26 08:09 andreagosto

For import_style crash please create a separate bug report with more details. I can not reproduce it so far.

andriiryzhkov avatar Sep 07 '26 09:09 andriiryzhkov

Hi andriiryzhkov, my AI agent just goes ahead and writes these sometimes without asking — like this last one. Sorry, it's pretty presumptuous :)

andreagosto avatar Sep 07 '26 09:09 andreagosto

@andreagosto : Please test recent update. Most of your requests were implemented there. And if you experience reproducible crashes, please post a separate bug report.

andriiryzhkov avatar Sep 07 '26 19:09 andriiryzhkov

Quick results from testing the recent update (5.7.0+768):

  • Confirmed working: apply_style now writes back to the image history (a style applied via apply_style is rendered); import_style on a system-generated style no longer crashes; colorcorrection and colorbalancergb H/C behave better inside a stack.
  • Still open: the import_style crash on the handcrafted 4-module .dtstyle — I opened a separate report as you asked: #22197. Also still open: history_end+stack still discarding the stack, channelmixerrgb still blob-only, and no new write-back tools (set/reset history, clone image).
  • Resolution cap (#22174): already fixed upstream (PR #22186 merged into master; the issue is closed as completed for 5.8) — it just wasn't in the 20260907 nightly I tested (built before that merge, still capped at 1363×1024). Happy to re-test once a newer nightly with the fix is out.

Thanks for the update.

andreagosto avatar Sep 07 '26 20:09 andreagosto