Skip to main content
Glama

get_resource

Retrieve Excalidraw diagrams, libraries, themes, or elements from the MCP server for diagram creation and manipulation.

Instructions

Get an Excalidraw resource

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
resourceYes

Implementation Reference

  • The handler function for the 'get_resource' tool. It validates input using ResourceSchema, switches on the resource type (scene, library, theme, elements), retrieves data from in-memory state, and returns JSON-formatted content.
    case 'get_resource': { const params = ResourceSchema.parse(args); const { resource } = params; logger.info('Getting resource', { resource }); let result; switch (resource) { case 'scene': result = { theme: sceneState.theme, viewport: sceneState.viewport, selectedElements: Array.from(sceneState.selectedElements) }; break; case 'library': result = { elements: Array.from(elements.values()) }; break; case 'theme': result = { theme: sceneState.theme }; break; case 'elements': result = { elements: Array.from(elements.values()) }; break; default: throw new Error(`Unknown resource: ${resource}`); } return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] }; }
  • Zod schema used for input validation in the get_resource handler.
    const ResourceSchema = z.object({ resource: z.enum(['scene', 'library', 'theme', 'elements']) });
  • src/index.js:171-183 (registration)
    Tool registration in server capabilities, including description and input schema definition.
    get_resource: { description: 'Get an Excalidraw resource', inputSchema: { type: 'object', properties: { resource: { type: 'string', enum: ['scene', 'library', 'theme', 'elements'] } }, required: ['resource'] } },

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