Skip to main content
Glama

create-shape-item

Add customizable shapes like rectangles, circles, or triangles to a Miro board, specifying position, dimensions, text content, and styling for clearer visual communication.

Instructions

Create a new shape item on a Miro board

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
boardIdYesUnique identifier (ID) of the board where the shape will be created
dataYesThe content and configuration of the shape
geometryYesDimensions of the shape
positionYesPosition of the shape on the board
styleNoStyle configuration of the shape

Implementation Reference

  • The asynchronous function that implements the core logic of the 'create-shape-item' tool. It validates inputs, constructs a ShapeCreateRequest using Miro API models, and calls the MiroClient to create a shape item on the specified board.
    fn: async ({ boardId, data, position, geometry, style }) => { try { if (!boardId) { return ServerResponse.error("Board ID is required"); } if (!validShapeTypes.includes(data.type)) { return ServerResponse.error("Invalid shape type. Valid types are: " + validShapeTypes.join(", ")); } const createRequest = new ShapeCreateRequest(); const shapeData = new ShapeData(); // Set shape type via property assignment (shapeData as any).type = data.type; if (data.content !== undefined) { shapeData.content = data.content; } createRequest.data = shapeData; const completePosition = { ...position, origin: position.origin || "center", relativeTo: position.relativeTo || "canvas_center" }; createRequest.position = completePosition; createRequest.geometry = geometry; if (style) { createRequest.style = style as Record<string, any>; } const result = await MiroClient.getApi().createShapeItem(boardId, createRequest); return ServerResponse.text(JSON.stringify(result, null, 2)); } catch (error) { return ServerResponse.error(error); } }
  • Zod-based input schema defining parameters for boardId, shape data (type and content), position, geometry (width, height, rotation), and optional style properties for the shape item.
    args: { boardId: z.string().describe("Unique identifier (ID) of the board where the shape will be created"), data: z.object({ shape: z.string().describe("Type of the shape (rectangle, circle, triangle, etc.)"), content: z.string().optional().nullish().describe("Text content to display inside the shape") }).describe("The content and configuration of the shape"), position: z.object({ x: z.number().describe("X coordinate of the shape"), y: z.number().describe("Y coordinate of the shape") }).describe("Position of the shape on the board"), geometry: z.object({ width: z.number().describe("Width of the shape"), height: z.number().describe("Height of the shape"), rotation: z.number().optional().nullish().describe("Rotation angle of the shape") }).describe("Dimensions of the shape"), style: z.object({ borderColor: z.string().optional().nullish().describe("Color of the shape border (hex format, e.g. #000000)"), borderWidth: z.number().optional().nullish().describe("Width of the shape border"), borderStyle: z.string().optional().nullish().describe("Style of the shape border (normal, dashed, etc.)"), borderOpacity: z.number().optional().nullish().describe("Opacity of the shape border (0-1)"), fillColor: z.string().optional().nullish().describe("Fill color of the shape (hex format, e.g. #000000)"), fillOpacity: z.number().optional().nullish().describe("Opacity of the shape fill (0-1)"), color: z.string().optional().nullish().describe("Color of the text in the shape (hex format, e.g. #000000)") }).optional().nullish().describe("Style configuration of the shape") },
  • src/index.ts:157-157 (registration)
    Registers the createShapeItemTool instance with the ToolBootstrapper in the main application index file.
    .register(createShapeItemTool)

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/k-jarzyna/mcp-miro'

If you have feedback or need assistance with the MCP directory API, please join our Discord server