Skip to main content
Glama

create_drawing

Generate a new Excalidraw drawing by providing a name and content. This tool enables diagram creation through natural language commands.

Instructions

Create a new Excalidraw drawing

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYes
contentYes

Implementation Reference

  • The core handler function that implements the create_drawing tool logic: generates a unique ID, saves the drawing content to a JSON file, creates metadata, and returns the ID and name.
    export async function createDrawing(
      name: string,
      content: string
    ): Promise<{ id: string; name: string }> {
      await ensureStorageDir();
    
      // Generate a unique ID for the drawing
      const id = `${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
    
      // Create the drawing file
      const filePath = path.join(STORAGE_DIR, `${id}.json`);
    
      // Save the drawing content
      await fs.writeFile(filePath, content, "utf-8");
    
      // Create a metadata file for the drawing
      const metadataPath = path.join(STORAGE_DIR, `${id}.meta.json`);
      const metadata = {
        id,
        name,
        createdAt: new Date().toISOString(),
        updatedAt: new Date().toISOString(),
      };
    
      await fs.writeFile(metadataPath, JSON.stringify(metadata, null, 2), "utf-8");
    
      return { id, name };
    }
  • Zod schema for input validation of the create_drawing tool, requiring 'name' and 'content' as non-empty strings.
    export const CreateDrawingSchema = z.object({
      name: z.string().min(1),
      content: z.string().min(1),
    });
  • src/index.ts:66-69 (registration)
    Tool registration in the MCP server's listTools response, defining name, description, and input schema.
      name: "create_drawing",
      description: "Create a new Excalidraw drawing",
      inputSchema: zodToJsonSchema(drawings.CreateDrawingSchema),
    },
  • MCP server dispatch handler for 'create_drawing': parses arguments using the schema and delegates to drawings.createDrawing.
    case "create_drawing": {
      const args = drawings.CreateDrawingSchema.parse(
        request.params.arguments
      );
      const result = await drawings.createDrawing(args.name, args.content);
      return {
        content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
      };
    }

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv1.0.0
    • addedInput schema / $schema
      Added value: +"http://json-schema.org/draft-07/schema#"
    • addedInput schema / additionalProperties
      Added value: +false
  2. First observed

TDQS

C2.8/5.0
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the action ('Create') but does not mention permissions, side effects, or response format. This is inadequate for a mutation tool, as it omits critical behavioral details like what happens on success or failure.

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

Conciseness5/5

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

The description is a single, efficient sentence with no wasted words, making it easy to parse. It is appropriately sized and front-loaded, earning full marks for conciseness.

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 of a creation tool with no annotations, 0% schema coverage, and no output schema, the description is incomplete. It lacks details on parameters, behavioral traits, and expected outcomes, making it insufficient for effective tool invocation.

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?

Schema description coverage is 0%, so the description must compensate by explaining parameters. It adds no meaning beyond the schema, failing to clarify what 'name' and 'content' represent (e.g., drawing title vs. Excalidraw JSON data). This leaves parameters undocumented and reduces usability.

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

Purpose4/5

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

The description clearly states the verb ('Create') and resource ('new Excalidraw drawing'), making the purpose evident. However, it does not distinguish this tool from its sibling 'update_drawing' in terms of when to create versus update, which prevents a perfect score.

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 like 'update_drawing' or prerequisites for creation. It lacks explicit instructions on usage context or exclusions, leaving the agent with minimal direction.

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