Skip to main content
Glama
Abdullah007bajwa

Excalidraw MCP Server

query_elements

Find specific elements in Excalidraw diagrams by applying filters to search for shapes, text, or drawings based on type or other criteria.

Instructions

Query Excalidraw elements with optional filters

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
typeNo
filterNo

Implementation Reference

  • The handler function for the 'query_elements' tool. It parses the input arguments using QuerySchema, filters the global 'elements' Map based on optional 'type' and 'filter' parameters, and returns the matching elements as a JSON string in the tool response content.
    case 'query_elements': {
      const params = QuerySchema.parse(args || {});
      const { type, filter } = params;
      
      let results = Array.from(elements.values());
      
      if (type) {
        results = results.filter(element => element.type === type);
      }
      
      if (filter) {
        results = results.filter(element => {
          return Object.entries(filter).every(([key, value]) => {
            return element[key] === value;
          });
        });
      }
      
      return {
        content: [{ type: 'text', text: JSON.stringify(results, null, 2) }]
      };
    }
  • src/index.js:155-170 (registration)
    Registration of the 'query_elements' tool in the MCP server capabilities object, defining its description and input schema for tool discovery.
    query_elements: {
      description: 'Query Excalidraw elements with optional filters',
      inputSchema: {
        type: 'object',
        properties: {
          type: { 
            type: 'string', 
            enum: Object.values(EXCALIDRAW_ELEMENT_TYPES) 
          },
          filter: { 
            type: 'object',
            additionalProperties: true
          }
        }
      }
    },
  • Zod validation schema (QuerySchema) used internally in the 'query_elements' handler to parse and validate input parameters.
    const QuerySchema = z.object({
      type: z.enum(Object.values(EXCALIDRAW_ELEMENT_TYPES)).optional(),
      filter: z.record(z.any()).optional()
    });
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It states it's a query operation with optional filters, implying it's read-only and non-destructive, but doesn't specify authentication needs, rate limits, error conditions, or what happens with invalid filters. For a tool with 2 parameters and no annotation coverage, this leaves significant behavioral gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that gets straight to the point without unnecessary words. It's appropriately sized for a basic query tool, though it could be more informative without sacrificing brevity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool has 2 parameters (one with an enum, one as a nested object), no annotations, and no output schema, the description is insufficient. It doesn't explain the return format, how results are structured, or provide enough context about parameter usage to make the tool fully understandable without external documentation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description mentions 'optional filters' which hints at the 'filter' parameter, but with 0% schema description coverage, it doesn't explain what 'type' does (despite having an enum) or provide details about the filter object's structure or usage. The description adds minimal value beyond the bare schema, failing to compensate for the low coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states the tool's purpose as 'Query Excalidraw elements with optional filters', which clearly indicates it retrieves elements with filtering capabilities. However, it doesn't differentiate from sibling tools like 'get_resource' (which might also retrieve data) or specify what makes this query operation unique compared to other read operations in the toolset.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention when query_elements is appropriate compared to other tools like 'get_resource' (which might fetch different resources) or 'create_element'/'update_element' for modifications. There's no context about prerequisites, typical use cases, or exclusions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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

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