Skip to main content
Glama

export_to_svg

Convert Excalidraw drawings to SVG format for scalable vector graphics that maintain quality at any size.

Instructions

Export an Excalidraw drawing to SVG

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYes

Implementation Reference

  • The core handler function that executes the export_to_svg tool logic: validates ID, fetches drawing, generates placeholder SVG, handles errors.
    export async function exportToSvg(id: string): Promise<string> {
      // Validate the ID for security
      validateFileId(id);
    
      try {
        // Get the drawing
        const drawing = await getDrawing(id);
    
        // Return the SVG content
        // Note: In a real implementation, we would use the Excalidraw API to convert the drawing to SVG
        // For now, we'll just return a placeholder
        return `<svg>
          <text x="10" y="20">Drawing: ${drawing.name}</text>
          <text x="10" y="40">This is a placeholder for the SVG export.</text>
        </svg>`;
      } catch (error) {
        if (error instanceof ExcalidrawResourceNotFoundError) {
          throw error;
        }
        throw new Error(
          sanitizeErrorMessage(error, "Failed to export drawing to SVG")
        );
      }
  • Zod schema for input validation of the export_to_svg tool, requiring a non-empty string 'id'.
    export const ExportToSvgSchema = z.object({
      id: z.string().min(1),
    });
  • src/index.ts:90-94 (registration)
    Tool registration entry in the listTools handler, defining name, description, and input schema for export_to_svg.
    {
      name: "export_to_svg",
      description: "Export an Excalidraw drawing to SVG",
      inputSchema: zodToJsonSchema(exportOps.ExportToSvgSchema),
    },
  • Dispatch logic in the CallToolRequestSchema handler that parses arguments, calls the exportToSvg function, and formats the response.
    case "export_to_svg": {
      const args = exportOps.ExportToSvgSchema.parse(
        request.params.arguments
      );
      const result = await exportOps.exportToSvg(args.id);
      return {
        content: [{ type: "text", text: result }],
      };
    }

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.9/5.0
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 the action ('Export') but doesn't describe what happens during export (e.g., whether it modifies the drawing, requires specific permissions, has rate limits, or returns the SVG as data or a file). For a tool with zero 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.

Conciseness5/5

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

The description is a single, efficient sentence with zero wasted words. It's appropriately sized for a simple export tool and front-loads the core action. Every word earns its place.

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's moderate complexity (export operation), no annotations, no output schema, and 1 undocumented parameter, the description is insufficient. It doesn't explain what the export produces (e.g., SVG string, file download), error conditions, or how it differs from sibling export tools. The agent lacks critical context for proper use.

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

Parameters3/5

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

The description doesn't mention any parameters, while the schema has 1 parameter (id) with 0% description coverage. The description doesn't compensate by explaining what 'id' represents (e.g., drawing identifier). However, with only 1 parameter, the baseline is 4, but the lack of any parameter context in the description reduces this to 3.

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 ('Export') and resource ('an Excalidraw drawing to SVG'), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like export_to_json or export_to_png, which perform similar export operations to different formats.

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 export_to_json or export_to_png. It doesn't mention any prerequisites, context for choosing SVG format, or exclusions. The agent must infer usage from the tool name alone.

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