create-image-item-using-url
Add images to Miro boards by providing a URL, board ID, and position coordinates to enhance visual collaboration.
Instructions
Create a new image item on a Miro board using a URL
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| boardId | Yes | Unique identifier (ID) of the board where the image will be created | |
| data | Yes | The content and configuration of the image | |
| position | Yes | Position of the image on the board | |
| geometry | No | Dimensions of the image |
Implementation Reference
- Handler function that implements the core logic: constructs Miro API request objects (ImageCreateRequest, ImageUrlData), sets position and geometry, and calls the MiroClient API to create an image item from URL on the board.fn: async ({ boardId, data, position, geometry }) => { try { if (!boardId) { return ServerResponse.error("Board ID is required"); } const createRequest = new ImageCreateRequest(); const imageData = new ImageUrlData(); imageData.url = data.url; if (data.title !== undefined) { imageData.title = data.title; } createRequest.data = imageData; const completePosition = { ...position, origin: position.origin || "center", relativeTo: position.relativeTo || "canvas_center" }; createRequest.position = completePosition; if (geometry) { createRequest.geometry = geometry; } const result = await MiroClient.getApi().createImageItemUsingUrl(boardId, createRequest); return ServerResponse.text(JSON.stringify(result, null, 2)); } catch (error) { return ServerResponse.error(error); } }
- Zod schema defining the input parameters for the tool: boardId (string), data (url and optional title), position (x, y, optional origin and relativeTo), optional geometry (width, height).args: { boardId: z.string().describe("Unique identifier (ID) of the board where the image will be created"), data: z.object({ url: z.string().describe("URL of the image to be added to the board"), title: z.string().optional().nullish().describe("Title of the image") }).describe("The content and configuration of the image"), position: z.object({ x: z.number().describe("X coordinate of the image"), y: z.number().describe("Y coordinate of the image"), origin: z.string().optional().nullish().describe("Origin of the image (center, top-left, etc.)"), relativeTo: z.string().optional().nullish().describe("Reference point (canvas_center, etc.)") }).describe("Position of the image on the board"), geometry: z.object({ width: z.number().optional().nullish().describe("Width of the image"), height: z.number().optional().nullish().describe("Height of the image") }).optional().nullish().describe("Dimensions of the image") },
- src/index.ts:151-151 (registration)Registration of the tool in the ToolBootstrapper chain in the main index file..register(createImageItemUsingUrlTool)
- src/index.ts:51-51 (registration)Import of the tool module for registration.import createImageItemUsingUrlTool from './tools/createImageItemUsingUrl.js';