Skip to main content
Glama
yctimlin

Excalidraw MCP Server

by yctimlin

get_resource

Retrieve specific Excalidraw resources such as scenes, libraries, themes, or elements using the Excalidraw MCP Server for diagram manipulation and management.

Instructions

Get an Excalidraw resource

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
resourceYes

Implementation Reference

  • The handler case for 'get_resource' tool execution. Validates input with ResourceSchema, fetches the specified resource ('scene', 'library'/'elements', 'theme') from sceneState or canvas API, and returns JSON stringified result.
    case 'get_resource': {
      const params = ResourceSchema.parse(args);
      const { resource } = params;
      logger.info('Getting resource', { resource });
      
      let result: any;
      switch (resource) {
        case 'scene':
          result = {
            theme: sceneState.theme,
            viewport: sceneState.viewport,
            selectedElements: Array.from(sceneState.selectedElements)
          };
          break;
        case 'library':
        case 'elements':
          try {
            // Get elements from HTTP server
            const response = await fetch(`${EXPRESS_SERVER_URL}/api/elements`);
            if (!response.ok) {
              throw new Error(`HTTP server error: ${response.status} ${response.statusText}`);
            }
            const data = await response.json() as ApiResponse;
            result = {
              elements: data.elements || []
            };
          } catch (error) {
            throw new Error(`Failed to get elements: ${(error as Error).message}`);
          }
          break;
        case 'theme':
          result = {
            theme: sceneState.theme
          };
          break;
        default:
          throw new Error(`Unknown resource: ${resource}`);
      }
      
      return {
        content: [{ type: 'text', text: JSON.stringify(result, null, 2) }]
      };
    }
  • src/index.ts:314-327 (registration)
    Registration of the 'get_resource' tool in the tools array, defining its name, description, and input schema for MCP capabilities and list_tools.
    {
      name: 'get_resource',
      description: 'Get an Excalidraw resource',
      inputSchema: {
        type: 'object',
        properties: {
          resource: { 
            type: 'string', 
            enum: ['scene', 'library', 'theme', 'elements'] 
          }
        },
        required: ['resource']
      }
    },
  • Zod validation schema (ResourceSchema) used in the handler to parse and validate the tool input parameters.
    const ResourceSchema = z.object({
      resource: z.enum(['scene', 'library', 'theme', 'elements'])
    });
Behavior2/5

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

No annotations are provided, so the description carries full burden. It only states 'Get an Excalidraw resource', which implies a read operation but doesn't disclose behavioral traits such as permissions needed, rate limits, whether it's idempotent, or what the output looks like. This is a significant gap for a tool with no annotation coverage.

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 sentence, 'Get an Excalidraw resource', which is very concise and front-loaded. It wastes no words, but it may be overly terse given the lack of detail needed for clarity and completeness.

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 complexity (1 parameter with enum but no output schema or annotations), the description is incomplete. It doesn't explain what 'Get' does operationally, what the resource types entail, or what the return value is. For a tool with no structured support, this leaves too many gaps for effective use.

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

Parameters4/5

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

The input schema has 1 parameter with an enum list (scene, library, theme, elements) but 0% schema description coverage. The description doesn't add any parameter details beyond the schema, but since there's only one parameter and the enum provides clear options, the baseline is high. However, it doesn't explain what each enum value means, so it doesn't fully compensate for the coverage gap.

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 'Get an Excalidraw resource' which provides a basic verb ('Get') and resource type ('Excalidraw resource'), but it's vague about what specific resources are available or what 'Get' entails (e.g., fetch metadata, retrieve content). It doesn't distinguish from siblings like 'query_elements' or 'create_element', leaving ambiguity in scope.

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?

No guidance is provided on when to use this tool versus alternatives. With siblings like 'query_elements' and 'create_element', there's no indication if this is for general resource retrieval, specific types, or different contexts. The description lacks any when-to-use or exclusion statements.

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

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

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