create-image-item-using-file
Add an image to a Miro board by uploading a file or using base64 encoded data. Specify the board ID, image position, and optional title to customize placement.
Instructions
Create a new image item on a Miro board using file from device or from chat
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| boardId | Yes | Unique identifier (ID) of the board where the image will be created | |
| imageData | Yes | Base64 encoded image data from the chat | |
| position | Yes | Position of the image on the board | |
| title | No | Title of the image |
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"
},
"imageData": {
"description": "Base64 encoded image data from the chat",
"type": "string"
},
"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"
},
"title": {
"description": "Title of the image",
"type": "string"
}
},
"required": [
"boardId",
"imageData",
"position"
],
"type": "object"
}
Implementation Reference
- Executes the tool: validates inputs, decodes base64 image to buffer, constructs position metadata, calls Miro API to create image item on board.fn: async ({ boardId, imageData, position, title }) => { try { if (!boardId) { return ServerResponse.error("Board ID is required"); } if (!imageData) { return ServerResponse.error("Image data is required"); } let imageBuffer; try { const base64Data = imageData.replace(/^data:image\/\w+;base64,/, ''); imageBuffer = Buffer.from(base64Data, 'base64'); } catch (error) { return ServerResponse.error(`Error decoding Base64 image data: ${error.message}`); } try { const metadata = {}; if (position) { metadata['position'] = { ...position, origin: position.origin || 'center', relativeTo: position.relativeTo || 'canvas_center' }; } if (title) { metadata['title'] = title; } const result = await MiroClient.getApi().createImageItemUsingLocalFile(boardId, imageBuffer, metadata); return ServerResponse.text(JSON.stringify(result, null, 2)); } catch (error) { return ServerResponse.error(`Error uploading image to Miro: ${error.message}`); } } catch (error) { return ServerResponse.error(error); } }
- Zod schema defining input parameters: boardId, imageData (base64), position (x,y,origin,relativeTo), optional title.args: { boardId: z.string().describe("Unique identifier (ID) of the board where the image will be created"), imageData: z.string().describe("Base64 encoded image data from the chat"), 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"), title: z.string().optional().nullish().describe("Title of the image") },
- src/index.ts:152-152 (registration)Registers the create-image-item-using-file tool with the ToolBootstrapper instance..register(createImageItemUsingFileFromDeviceTool)