draw2agent 2.0.1 → 2.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -57,15 +57,16 @@ The MCP server exposes the following tools:
57
57
  | Tool | Description |
58
58
  |---|---|
59
59
  | `launch_canvas` | Opens your dev page with the drawing overlay |
60
- | `launch_ipad_canvas` | Creates a tunnel and returns a QR code for remote drawing from iPad/mobile |
60
+ | `launch_ipad_canvas` | Creates a tunnel and returns a QR code for remote drawing from iPad/mobile (does not block) |
61
+ | `wait_for_ipad_submission` | Blocks and waits for the user to submit their drawing from the iPad. Must be called after `launch_ipad_canvas`. |
61
62
  | `launch_scratch` | Opens a standalone Excalidraw whiteboard for freehand sketching |
62
63
  | `get_drawing_state` | Returns screenshot, DOM nodes, and annotations for the current state |
63
64
 
64
65
  ### `launch_canvas`
65
66
  The core tool — proxies your localhost dev server and injects an Excalidraw overlay. Draw annotations directly on your running app, then submit to send visual context to your agent. The tool blocks until you submit.
66
67
 
67
- ### `launch_ipad_canvas`
68
- Same as `launch_canvas`, but exposes the proxy over the internet via a secure tunnel. Returns a QR code that you can scan from your iPad or phone to draw annotations with touch. Perfect for whiteboard-style feedback sessions.
68
+ ### `launch_ipad_canvas` & `wait_for_ipad_submission`
69
+ Exposes the proxy over the internet via a secure tunnel. Returns a QR code image to your agent so it can be displayed in the chat. You can scan it from your iPad or phone to draw annotations with touch. `wait_for_ipad_submission` blocks and waits for the actual drawing data.
69
70
 
70
71
  ### `launch_scratch`
71
72
  Opens a blank Excalidraw whiteboard — no target URL needed. Sketch UI mockups, wireframes, or diagrams from scratch. Your agent receives the drawing and implements the design.
package/dist/index.js CHANGED
@@ -14306,7 +14306,7 @@ function createMcpServer() {
14306
14306
  );
14307
14307
  server2.tool(
14308
14308
  "launch_ipad_canvas",
14309
- "Launch a remote drawing canvas accessible from an iPad or mobile device. Creates a tunnel to expose the local dev page over the internet and returns a QR code that the user can scan from their iPad. The user draws annotations on their device, and this tool blocks until they submit, returning the visual context. Ideal for touch-based annotation workflows.",
14309
+ "Launch a remote drawing canvas accessible from an iPad or mobile device. Creates a tunnel and returns a QR code image to show in the chat. You MUST immediately call `wait_for_ipad_submission` right after this tool to receive the actual drawing.",
14310
14310
  {
14311
14311
  targetUrl: external_exports.string().describe("The URL of the local dev server to overlay (e.g. http://localhost:3000)"),
14312
14312
  port: external_exports.number().optional().describe("Port for the draw2agent proxy server (default: 9742)")
@@ -14337,11 +14337,34 @@ function createMcpServer() {
14337
14337
  }
14338
14338
  const tunnelUrl = await startTunnel(proxyPort);
14339
14339
  const qr = await generateQR(tunnelUrl);
14340
- console.error(`
14341
- [draw2agent] \u{1F4F1} iPad Canvas Ready!`);
14342
- console.error(`[draw2agent] \u{1F517} Scan this QR code or open: ${tunnelUrl}`);
14343
- console.error(qr.ascii);
14344
14340
  clearState();
14341
+ return {
14342
+ content: [
14343
+ {
14344
+ type: "text",
14345
+ text: `iPad Canvas Ready! The QR code is attached. The user needs to scan it with their iPad.
14346
+
14347
+ IMPORTANT: You must NOW immediately call the \`wait_for_ipad_submission\` tool without asking the user. That tool will wait for them to finish drawing and return the result.`
14348
+ },
14349
+ {
14350
+ type: "image",
14351
+ data: qr.dataUrl.replace(/^data:image\/\w+;base64,/, ""),
14352
+ mimeType: "image/png"
14353
+ }
14354
+ ]
14355
+ };
14356
+ } catch (err) {
14357
+ await stopTunnel();
14358
+ return handleToolError(err, "launch_ipad_canvas");
14359
+ }
14360
+ }
14361
+ );
14362
+ server2.tool(
14363
+ "wait_for_ipad_submission",
14364
+ "Wait for the user to submit their drawing from the iPad. Must be called immediately after `launch_ipad_canvas`.",
14365
+ {},
14366
+ async () => {
14367
+ try {
14345
14368
  const state = await waitForState();
14346
14369
  await stopTunnel();
14347
14370
  const customInstructions = readPromptFile(
@@ -14363,7 +14386,7 @@ function createMcpServer() {
14363
14386
  };
14364
14387
  } catch (err) {
14365
14388
  await stopTunnel();
14366
- return handleToolError(err, "launch_ipad_canvas");
14389
+ return handleToolError(err, "wait_for_ipad_submission");
14367
14390
  }
14368
14391
  }
14369
14392
  );