create-document-item
Add a document to a Miro board by specifying its URL, title, position, and dimensions for organized collaboration and visualization.
Instructions
Create a new document item on a Miro board
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| boardId | Yes | Unique identifier (ID) of the board where the document will be created | |
| data | Yes | The content and configuration of the document | |
| geometry | No | Dimensions of the document | |
| position | Yes | Position of the document 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 document will be created",
"type": "string"
},
"data": {
"additionalProperties": false,
"description": "The content and configuration of the document",
"properties": {
"title": {
"description": "Title of the document",
"type": "string"
},
"url": {
"description": "URL of the document to be added to the board",
"type": "string"
}
},
"required": [
"url"
],
"type": "object"
},
"geometry": {
"additionalProperties": false,
"description": "Dimensions of the document",
"properties": {
"height": {
"description": "Height of the document",
"type": "number"
},
"width": {
"description": "Width of the document",
"type": "number"
}
},
"type": "object"
},
"position": {
"additionalProperties": false,
"description": "Position of the document on the board",
"properties": {
"x": {
"description": "X coordinate of the document",
"type": "number"
},
"y": {
"description": "Y coordinate of the document",
"type": "number"
}
},
"required": [
"x",
"y"
],
"type": "object"
}
},
"required": [
"boardId",
"data",
"position"
],
"type": "object"
}
Implementation Reference
- src/tools/createDocumentItem.ts:27-52 (handler)The asynchronous handler function that implements the core logic of the 'create-document-item' tool. It validates the boardId, constructs a DocumentCreateRequest using the provided data, position, and optional geometry, then calls the MiroClient API to create the document item on the board, returning the result or an error.fn: async ({ boardId, data, position, geometry }) => { try { if (!boardId) { return ServerResponse.error("Board ID is required"); } const createRequest = new DocumentCreateRequest(); const documentData = new DocumentUrlData(); documentData.url = data.url; if (data.title !== undefined) documentData.title = data.title; createRequest.data = documentData; createRequest.position = position; if (geometry) { createRequest.geometry = geometry; } const result = await MiroClient.getApi().createDocumentItemUsingUrl(boardId, createRequest); return ServerResponse.text(JSON.stringify(result, null, 2)); } catch (error) { return ServerResponse.error(error); } }
- The Zod-based input schema defining the parameters for the 'create-document-item' tool: boardId (required string), data (object with url and optional title), position (object with x and y coordinates), and optional geometry (object with width and height).args: { boardId: z.string().describe("Unique identifier (ID) of the board where the document will be created"), data: z.object({ url: z.string().describe("URL of the document to be added to the board"), title: z.string().optional().nullish().describe("Title of the document") }).describe("The content and configuration of the document"), position: z.object({ x: z.number().describe("X coordinate of the document"), y: z.number().describe("Y coordinate of the document") }).describe("Position of the document on the board"), geometry: z.object({ width: z.number().optional().nullish().describe("Width of the document"), height: z.number().optional().nullish().describe("Height of the document") }).optional().nullish().describe("Dimensions of the document") },
- src/tools/createDocumentItem.ts:9-53 (registration)The tool definition object conforming to ToolSchema, which includes name, description, input args schema, and handler function. Exported as default for potential registration in a tool registry.const createDocumentItemTool: ToolSchema = { name: "create-document-item", description: "Create a new document item on a Miro board", args: { boardId: z.string().describe("Unique identifier (ID) of the board where the document will be created"), data: z.object({ url: z.string().describe("URL of the document to be added to the board"), title: z.string().optional().nullish().describe("Title of the document") }).describe("The content and configuration of the document"), position: z.object({ x: z.number().describe("X coordinate of the document"), y: z.number().describe("Y coordinate of the document") }).describe("Position of the document on the board"), geometry: z.object({ width: z.number().optional().nullish().describe("Width of the document"), height: z.number().optional().nullish().describe("Height of the document") }).optional().nullish().describe("Dimensions of the document") }, fn: async ({ boardId, data, position, geometry }) => { try { if (!boardId) { return ServerResponse.error("Board ID is required"); } const createRequest = new DocumentCreateRequest(); const documentData = new DocumentUrlData(); documentData.url = data.url; if (data.title !== undefined) documentData.title = data.title; createRequest.data = documentData; createRequest.position = position; if (geometry) { createRequest.geometry = geometry; } const result = await MiroClient.getApi().createDocumentItemUsingUrl(boardId, createRequest); return ServerResponse.text(JSON.stringify(result, null, 2)); } catch (error) { return ServerResponse.error(error); } } }