Skip to content

Publish every tool, command, filter and adjustment over MCP - #80

Merged
IAmJSD merged 1 commit into
mainfrom
t3code/expose-mcp-tools-clearly
Aug 30, 2026
Merged

IAmJSD merged 1 commit into
mainfrom
t3code/expose-mcp-tools-clearly

Conversation

@IAmJSD

@IAmJSD IAmJSD commented Aug 30, 2026

Copy link
Copy Markdown
Member

What

tools/list no longer advertises five generic invokers plus a describe call to find out what they can be pointed at. Every installed feature is published as its own MCP tool, with its own typed, documented parameters, built from the same plugin registry the app assembles its menus from.

prefix count what
filter_* 134 one per filter; params carry label, range, default, unit, and dropdowns as string enums
tool_* 55 one per canvas tool; the call activates it and applies any options-bar values passed with it
cmd_* 34 one per menu command
adjust_* 18 sliders as numbers, checkboxes as booleans, plus a params escape hatch for curve points / gradient stops / per-range tables
builtins 13 sessions, get_state, tool_stroke/tool_input, layer props, render, save/export, photoshop_plugins

Sample of what a client now sees without a second call:

filter_gaussian_blur
  Gaussian Blur — Filter ▸ Blur. Runs on the active raster layer, feathered
  through the selection when there is one, as one undoable edit.
    radius   number [0..100]   "Radius. 0..100 px (default 4)"

cmd_select_similar
  Similar — Select every pixel in the layer resembling the selection, touching
  it or not, within the magic wand's tolerance. Menu command "select.similar".

Structures extended

  • Command gained a description — a menu title ("Grow", "Similar") says nothing to a caller that cannot see the menu around it. All 34 core commands got one written.
  • ToolPlugin gained a defaulted description(), implemented for all 55 tools (per-mode text for the 14 paint modes, 3 lassos, 4 shapes…). Defaulted so plugins built outside this repo still compile.
  • Filters and adjustments needed no new fields: FilterParam and Params::param_specs() already carry ranges and defaults, and adjustment flags are read/written through the serialized form, so an adjustment that grows a checkbox is published without further work.

Removed

describe, select_tool, set_tool_options, run_command, apply_filter, apply_adjustment. Nothing describe reported is lost: codec extensions are in the create_session/save descriptions, blend modes are an enum on set_layer_props, and the Photoshop diagnostics survive as the photoshop_plugins tool (the plug-ins that loaded are filters now; what is left to report is the ones that did not).

Notes for review

  • 254 tools is a large list (~250 KB of JSON per connection). That is inherent to publishing everything, and it is called out in docs/mcp.md rather than silently capped. The biggest single contributor is tool_type's type-family enum, which is every installed font.
  • filter_add_noise's monochrome publishes as number [0..1] rather than a boolean, faithfully: FilterParam has no toggle kind, so inferring one would be guesswork. Worth a follow-up if we want it typed.

Verification

  • cargo build --workspace --all-targets — clean
  • cargo test --workspace — passes, including 9 new tests (name uniqueness and validity, every published name dispatches, filter params published, choices reaching filters as indices, tool select+configure in one call, adjustment flags and sliders together, collision numbering)
  • cargo clippy --workspace --all-targets -- -D warnings — clean
  • cargo fmt --all --check — clean
  • Exercised end to end over real stdio JSON-RPC: session → tool select with options → stroke → filter with a named choice → adjustment with a flag → undo → error paths.

🤖 Generated with Claude Code

The server exposed five generic invokers and a `describe` call that
listed what they could be pointed at. That put a caller two round trips
away from doing anything and left parameters undiscoverable: nothing in
the tool list said `apply_filter` takes a `radius` of 0..250 for one id
and a `cell_size` for another.

The registry is already a catalog, so project it straight into MCP. One
tool per canvas tool, menu command, filter and adjustment -- 254 of
them -- each carrying the label, range, default, unit and choices the
options bar or dialog would have shown. A third-party plugin is
published the same way, because it comes through the same registry.

Metadata the generated text could not invent was added where it was
missing. `Command` gains a description: "Grow" is a menu label and says
nothing to a caller that cannot see the menu around it. `ToolPlugin`
gains one too, defaulted so plugins outside this repo still compile.
Filters and adjustments needed no new fields -- `FilterParam` and
`param_specs` already carry the ranges -- and adjustment flags are read
and written through the serialized form, so an adjustment that grows a
checkbox gets it published without further work.

`describe` is gone with the invokers. Its codec list is now in the
create_session and save descriptions, its blend modes are an enum on
set_layer_props, and its Photoshop diagnostics are the photoshop_plugins
tool: the plug-ins that loaded are filters now, so what is left to
report is the ones that did not.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@IAmJSD
IAmJSD merged commit 12390b9 into main Aug 30, 2026
3 checks passed
@IAmJSD
IAmJSD deleted the t3code/expose-mcp-tools-clearly branch August 30, 2026 13:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant