Skip to main content
Glama

create-items-in-bulk

Add multiple sticky notes, cards, or text items to a Miro board in one operation to streamline content creation and organization.

Instructions

Create multiple items on a Miro board in a single operation

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
boardIdYesUnique identifier (ID) of the board where the items will be created
itemsYesArray of items to create

Implementation Reference

  • Main handler function for creating multiple items (sticky notes, cards, text) in bulk on a Miro board. Validates inputs, processes items in parallel using helper functions, collects results and errors.
    fn: async ({ boardId, items }) => {
      try {
        if (!boardId) {
          return ServerResponse.error("Board ID is required");
        }
    
        if (!items || !Array.isArray(items) || items.length === 0) {
          return ServerResponse.error("At least one item is required");
        }
    
        const results = [];
        const errors = [];
    
        const createPromises = items.map(async (item, index) => {
          try {
            let result;
            
            if (item.type === 'sticky_note') {
              result = await createStickyNote(boardId, item);
            } else if (item.type === 'card') {
              result = await createCard(boardId, item);
            } else if (item.type === 'text') {
              result = await createText(boardId, item);
            }
            
            return { index, result };
          } catch (error) {
            return { index, error: error.message || String(error) };
          }
        });
        
        const promiseResults = await Promise.all(createPromises);
        
        for (const promiseResult of promiseResults) {
          const { index, result, error } = promiseResult;
          if (error) {
            errors.push({ index, error });
          } else if (result) {
            results.push({ index, item: result });
          }
        }
        
        return ServerResponse.text(JSON.stringify({
          created: results.length,
          failed: errors.length,
          results,
          errors
        }, null, 2));
        
      } catch (error) {
        return ServerResponse.error(error);
      }
    }
  • Tool schema definition including name, description, and Zod input schema for boardId and array of items (referencing itemSchema discriminated union of sticky_note, card, text).
    const createItemsInBulkTool: ToolSchema = {
      name: "create-items-in-bulk",
      description: "Create multiple items on a Miro board in a single operation",
      args: {
        boardId: z.string().describe("Unique identifier (ID) of the board where the items will be created"),
        items: z.array(itemSchema).describe("Array of items to create")
      },
  • src/index.ts:150-150 (registration)
    Registers the create-items-in-bulk tool with the ToolBootstrapper instance.
    .register(createItemsInBulkTool)
  • Helper function to create a single sticky note item using Miro API.
    async function createStickyNote(boardId: string, item: z.infer<typeof stickyNoteSchema>) {
      const createRequest = new StickyNoteCreateRequest();
      
      const stickyNoteData = new StickyNoteData();
      stickyNoteData.content = item.data.content;
      stickyNoteData.shape = item.data.shape || 'square';
      
      createRequest.data = stickyNoteData;
      createRequest.position = item.position;
      
      if (item.style) {
        const style: Record<string, string> = {};
        
        if (item.style.fillColor) {
          if (validStickyNoteColors.includes(item.style.fillColor)) {
            style.fillColor = item.style.fillColor;
          } else {
            style.fillColor = 'light_yellow';
          }
        }
        
        if (item.style.textAlign) {
          if (validTextAligns.includes(item.style.textAlign)) {
            style.textAlign = item.style.textAlign;
          } else {
            style.textAlign = 'center';
          }
        }
        
        createRequest.style = style;
      }
      
      return await MiroClient.getApi().createStickyNoteItem(boardId, createRequest);
    }
  • Helper function to create a single card item using Miro API.
    async function createCard(boardId: string, item: z.infer<typeof cardSchema>) {
      const createRequest = new CardCreateRequest();
      
      const cardData = new CardData();
      cardData.title = item.data.title;
      
      if (item.data.description) {
        cardData.description = item.data.description;
      }
      
      if (item.data.assigneeId) {
        cardData.assigneeId = item.data.assigneeId;
      }
      
      if (item.data.dueDate) {
        cardData.dueDate = new Date(item.data.dueDate);
      }
      
      createRequest.data = cardData;
      createRequest.position = item.position;
      
      if (item.style) {
        createRequest.style = item.style as Record<string, any>;
      }
      
      return await MiroClient.getApi().createCardItem(boardId, createRequest);
    }
Install Server

Other 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