Skip to main content
Glama
Abdullah007bajwa

Excalidraw MCP Server

group_elements

Combine multiple diagram elements into a single group for easier organization and manipulation in Excalidraw diagrams.

Instructions

Group multiple elements together

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
elementIdsYes

Implementation Reference

  • The handler function for the 'group_elements' tool. It parses the input arguments using ElementIdsSchema, generates a unique groupId, stores the elementIds in sceneState.groups Map, and returns a JSON response with the groupId and elementIds.
    case 'group_elements': {
      const params = ElementIdsSchema.parse(args);
      const { elementIds } = params;
      
      const groupId = generateId();
      sceneState.groups.set(groupId, elementIds);
      
      const result = { groupId, elementIds };
      return {
        content: [{ type: 'text', text: JSON.stringify(result, null, 2) }]
      };
    }
  • Zod schema used for input validation in the group_elements handler (and others). Defines required elementIds as array of strings.
    const ElementIdsSchema = z.object({
      elementIds: z.array(z.string())
    });
  • Input schema definition for the group_elements tool in the MCP server capabilities declaration.
    group_elements: {
      description: 'Group multiple elements together',
      inputSchema: {
        type: 'object',
        properties: {
          elementIds: { 
            type: 'array',
            items: { type: 'string' }
          }
        },
        required: ['elementIds']
      }
    },
  • src/index.js:753-764 (registration)
    Tool registration in the ListToolsRequestHandler response, listing the group_elements tool with its schema.
    name: 'group_elements',
    description: 'Group multiple elements together',
    inputSchema: {
      type: 'object',
      properties: {
        elementIds: { 
          type: 'array',
          items: { type: 'string' }
        }
      },
      required: ['elementIds']
    }

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/Abdullah007bajwa/mcp_excalidraw'

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