create-image-item-using-url
Add an image to a Miro board using a URL. Specify the board ID, image URL, position, and dimensions to place the image accurately.
Instructions
Create a new image item on a Miro board using a URL
Input 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 | |
| geometry | No | Dimensions of the image | |
| position | Yes | Position of the image on the board |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"boardId": {
"description": "Unique identifier (ID) of the board where the image will be created",
"type": "string"
},
"data": {
"additionalProperties": false,
"description": "The content and configuration of the image",
"properties": {
"title": {
"description": "Title of the image",
"type": "string"
},
"url": {
"description": "URL of the image to be added to the board",
"type": "string"
}
},
"required": [
"url"
],
"type": "object"
},
"geometry": {
"additionalProperties": false,
"description": "Dimensions of the image",
"properties": {
"height": {
"description": "Height of the image",
"type": "number"
},
"width": {
"description": "Width of the image",
"type": "number"
}
},
"type": "object"
},
"position": {
"additionalProperties": false,
"description": "Position of the image on the board",
"properties": {
"origin": {
"description": "Origin of the image (center, top-left, etc.)",
"type": "string"
},
"relativeTo": {
"description": "Reference point (canvas_center, etc.)",
"type": "string"
},
"x": {
"description": "X coordinate of the image",
"type": "number"
},
"y": {
"description": "Y coordinate of the image",
"type": "number"
}
},
"required": [
"x",
"y"
],
"type": "object"
}
},
"required": [
"boardId",
"data",
"position"
],
"type": "object"
}
Implementation Reference
- The asynchronous handler function that executes the tool's logic: validates input, constructs ImageCreateRequest and ImageUrlData objects, calls MiroClient API to create the image item, and returns the result or error.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: boardId, data (url and optional title), position (x, y, origin, relativeTo), and 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)Registers the tool schema and handler with the ToolBootstrapper instance..register(createImageItemUsingUrlTool)
- src/index.ts:51-51 (registration)Imports the tool definition for registration.import createImageItemUsingUrlTool from './tools/createImageItemUsingUrl.js';