You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- userGuide.md gains an "Icons and stock photos" section under MCP usage,
describing the 3 new tools, the zero-config / key-upgrade paths, and
the renderer's image-inlining + hostname allowlist behaviour.
- Tool count bumped from 29 to 32. New "Assets" category added.
- mcp-server/index.js gains a header comment listing the new
UNSPLASH_ACCESS_KEY / PEXELS_API_KEY env vars alongside existing args
with an explicit "never logged, never persisted" reminder.
@@ -894,6 +895,33 @@ A typical agent interaction looks like this:
894
895
895
896
You can then open the saved `.drawd` file in Drawd to visually inspect the flow, adjust screen positions, refine hotspots, and regenerate instructions.
896
897
898
+
### Icons and stock photos
899
+
900
+
Three asset tools let agents enrich screens with real imagery instead of hand-drawn shapes or emoji substitutes.
901
+
902
+
-`generate_icon` — Fetch one icon by `collection` + `name` from Iconify (275k+ icons across `mdi`, `ph`, `lucide`, `tabler`, `heroicons`, `solar`, `carbon`, and more). Returns an inline SVG string the agent embeds verbatim in the screen HTML. Use `color: "currentColor"` to inherit the surrounding text color.
903
+
-`search_icons` — Search Iconify across all (or one) collections. Returns ranked candidate icon IDs the agent can preview and pick from before calling `generate_icon`.
904
+
-`find_stock_image` — Search royalty-free photos and get back URLs with attribution. Embed via `<img src="...">` in the screen HTML; the renderer fetches and inlines the bytes at PNG-render time. Sources: Unsplash, Pexels, Picsum.
905
+
906
+
#### Zero-config and key-upgrade paths
907
+
908
+
The tools work on a fresh install with no API keys — Iconify and Picsum are keyless. Setting environment variables upgrades the photo source without code changes:
-`PEXELS_API_KEY` — enables Pexels as the secondary photo source.
912
+
913
+
`find_stock_image` tries `unsplash` → `pexels` → `picsum` in order based on which keys are configured. When a keyed source is requested but the key is missing, the tool transparently falls back to the next provider and includes a `warning` field describing what happened, so the agent can surface it to the user.
914
+
915
+
> [!NOTE]
916
+
> Picsum does not actually search by query — it returns deterministic seeded photos for a given query string. Set `UNSPLASH_ACCESS_KEY` for query-relevant results.
917
+
918
+
#### Renderer image inlining
919
+
920
+
When `create_screen` HTML contains `<img src="https://...">`, the renderer downloads each image and bakes the bytes into the rendered PNG so the screen looks complete. Only an allowlist of provider hosts (`api.iconify.design`, `images.unsplash.com`, `api.unsplash.com`, `api.pexels.com`, `images.pexels.com`, `picsum.photos`, `fastly.picsum.photos`) is fetched. Any other host (or a failed fetch) is replaced with a transparent 1×1 placeholder so a single bad URL never breaks the whole render.
921
+
922
+
> [!TIP]
923
+
> Cached image bytes live under `~/.cache/drawd-mcp/` and persist across runs. The first render of a screen with photos is the slow one; re-renders use the disk cache.
924
+
897
925
### Reading the user's current selection
898
926
899
927
The `get_current_selection` tool lets an AI agent know which element(s) you currently have selected in the Drawd browser app — so you can say "update this screen" or "add a hotspot here" without pasting IDs.
0 commit comments