Working with agents WebMCP

Work inside the art explorer

Let a compatible in-browser agent use browser-local context and update the visible gallery through Explore Art MCP.

Experimental progressive enhancement

The agent can understand the page you see

When WebMCP is enabled and a supporting browser host exposes document.modelContext.registerTool, Explore Art registers page-scoped tools. Without both conditions, nothing is fetched or registered and ordinary browsing continues unchanged.

Same v2 contract

The browser does not change search semantics

WebMCP search tools accept the same explore_art_mcp.v2 structure as standard MCP: filters are hard eligibility, preferences influence rank, and selection shapes the final batch. Subjective semantic text goes directly to the shared retrieval engine; WebMCP does not call Luna or turn prose into hidden filters. Post-engine color/surface preferences, caps, and diversity operate only on the first 100 engine-ranked candidates.

list_filter_options and list_color_options are read-only ways to discover exact reusable criteria before a visible search.

Page context

A bounded view, not private browser state

get_art_explorer_context may report:

  • the current route and page kind;
  • the canonical query, mode, hard filter, and reuse scope;
  • visible ranked artwork and representation IDs;
  • active color criteria;
  • the current artwork and up to six selected references;
  • a selected or ready crop with normalized geometry.

This context is assembled locally from the current browser page; it is not a durable server-side session. It does not inspect cookies, login state, arbitrary DOM contents, or private page data. Imported museum text and model-authored analysis are marked as untrusted data, never instructions.

Contextual defaults

Less ID plumbing, still explicit

get_artwork

Can default to the artwork currently open or selected.

get_artwork_assets

Can default to current, selected, or visible works and returns an ordered grouped v2 manifest using a fresh open scope.

show_related_artworks

Can use a selected crop, selected references, or the current artwork.

If related search omits rights, it preserves the current gallery’s reuse scope instead of silently returning to a broader default. Asset lookup is different: get_artwork_assets is always open and does not retain a narrower prior search scope. Pass expected_representation_id for guarded handoff and review the returned rights evidence again.

Visible tools

One coherent gallery update

show_artwork_search and show_related_artworks deliberately are not marked read-only: they change what the person sees. During a call, Explore Art keeps the old gallery stable and busy, then replaces it once with the final server-rendered order, updates the chips and same-document URL, waits one animation frame, and resolves.

Current galleryBusyFinal order

Registrations and fetches are connected to abort signals, so Turbo navigation, cancellation, or a superseding visible search cannot commit a stale gallery swap. Once Rails has begun handling the request, aborting the fetch does not guarantee that its server work stops.

Signed canonical state

Integrity, not a frozen snapshot

A visible v2 search may add signed mcp_state to the URL. It is integrity-protected, not encrypted, and it is not an immutable result snapshot. Reloading validates the token and reruns the normalized request against the current live corpus. Tampering returns HTTP 422; rotating the signing key invalidates older tokens.

Registered tools

The WebMCP surface

  • list_color_options
  • list_filter_options
  • get_artwork
  • get_artwork_assets
  • show_artwork_search
  • show_related_artworks
  • get_art_explorer_context