Skip to main content
Glama

vectorize_svg

Convert any raster image (PNG, JPG) to an SVG vector graphic using QuiverAI. Provide a URL or base64 image, with optional auto-crop, target size, and output path.

Instructions

Convert a raster image (PNG, JPG, etc.) into an SVG using QuiverAI. Provide the image as a URL or base64-encoded string.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
modelYesModel ID to use. Use list_models to find models that support svg_vectorize.
imageYesThe image to vectorize — either a URL or base64 data.
autoCropNoAuto-crop to the dominant subject before vectorizing. Defaults to false.
targetSizeNoSquare resize target in pixels before vectorizing.
temperatureNoSampling temperature (0–2). Defaults to 1.
outputPathNoOptional absolute file path to save the vectorized SVG to disk. If omitted, SVG markup is returned in the response only. Parent directories are created automatically.

Implementation Reference

  • Handler function for the vectorize_svg tool. It destructures arguments (model, image, autoCrop, targetSize, temperature, outputPath), builds the image reference, calls quiver.vectorizeSVG.vectorizeSVG(), asserts the response, extracts the SVG from result.data[0].svg, and optionally saves it to disk via writeSvgs(). Returns the SVG markup as text content.
    if (name === "vectorize_svg") {
      const { model, image, autoCrop, targetSize, temperature, outputPath } = args as {
        model: string;
        image: { url?: string; base64?: string };
        autoCrop?: boolean;
        targetSize?: number;
        temperature?: number;
        outputPath?: string;
      };
    
      const imageRef =
        image.url !== undefined
          ? { url: image.url }
          : { base64: image.base64! };
    
      const response = await quiver.vectorizeSVG.vectorizeSVG({
        model,
        image: imageRef,
        autoCrop,
        targetSize,
        temperature,
        stream: false,
      });
    
      const result = response.result;
      assertSvgResponse(result);
    
      const svg = result.data[0].svg;
      const content: Array<{ type: "text"; text: string }> = [
        { type: "text", text: svg },
      ];
    
      if (outputPath) {
        const paths = await writeSvgs([svg], outputPath);
        content.push({ type: "text", text: `Saved to: ${paths.join(", ")}` });
      }
    
      return { content };
    }
  • Input schema definition for the vectorize_svg tool as part of the ListToolsRequestSchema handler. Registers the tool with name 'vectorize_svg' and defines required parameters (model: string, image: object with oneOf url/base64) and optional parameters (autoCrop, targetSize, temperature, outputPath).
    {
      name: "vectorize_svg",
      description:
        "Convert a raster image (PNG, JPG, etc.) into an SVG using QuiverAI. " +
        "Provide the image as a URL or base64-encoded string.",
      inputSchema: {
        type: "object",
        required: ["model", "image"],
        properties: {
          model: {
            type: "string",
            description:
              "Model ID to use. Use list_models to find models that support svg_vectorize.",
          },
          image: {
            type: "object",
            description: "The image to vectorize — either a URL or base64 data.",
            oneOf: [
              {
                required: ["url"],
                properties: {
                  url: { type: "string", description: "HTTP/HTTPS image URL." },
                },
              },
              {
                required: ["base64"],
                properties: {
                  base64: {
                    type: "string",
                    description: "Base64-encoded image data.",
                  },
                },
              },
            ],
          },
          autoCrop: {
            type: "boolean",
            description:
              "Auto-crop to the dominant subject before vectorizing. Defaults to false.",
          },
          targetSize: {
            type: "number",
            description: "Square resize target in pixels before vectorizing.",
          },
          temperature: {
            type: "number",
            description: "Sampling temperature (0–2). Defaults to 1.",
          },
          outputPath: {
            type: "string",
            description:
              "Optional absolute file path to save the vectorized SVG to disk. " +
              "If omitted, SVG markup is returned in the response only. " +
              "Parent directories are created automatically.",
          },
        },
      },
  • src/index.ts:101-271 (registration)
    Registration of all tools via server.setRequestHandler(ListToolsRequestSchema, ...). The 'vectorize_svg' tool is listed at line 203 among other tools (generate_svg, list_models).
    server.setRequestHandler(ListToolsRequestSchema, async () => ({
      tools: [
        {
          name: "generate_svg",
          description:
            "Generate one or more SVGs from a text prompt using QuiverAI. Returns raw SVG markup.\n\n" +
            "## Prompt guide\n\n" +
            "A good prompt has three parts: **subject** (specific object), **style** (aesthetic keywords), and **color palette** (hex codes if possible).\n\n" +
            "### What works\n" +
            "- Use concrete, famous physical objects the model has seen (AirPods, Nike Dunks, Shure SM7B, Montblanc pen, Leica camera, Nest thermostat, espresso machines). " +
            "Cylindrical/round objects explode especially cleanly in isometric style.\n" +
            "- Name the style explicitly: 'line art', 'hand drawn', 'duotone', 'flat monochrome icon', 'geometric', 'minimalist', 'isometric', 'blueprint'.\n" +
            "- Specify colors with hex codes: 'background: #e9edc9 and logo in #fb8500'.\n" +
            "- Add composition framing: 'centered icon', 'wide horizontal logo'.\n" +
            "- Prompt modifiers: 'geometric' → angular shapes, 'detailed' → more elements, 'simple' → clearer shapes, 'minimalist' → fewer details, 'flat monochrome' → single-color, 'duotone' → two-color.\n\n" +
            "### What does NOT work\n" +
            "- NEVER mention 'AI', 'machine learning', 'voice assistant', 'workflow automation', or abstract software concepts — produces garbage. Use physical metaphors instead (microphone for voice, watch movement for precision).\n" +
            "- Abstract concepts without physical objects: 'knowledge graph', 'automation pipeline', 'data flow'.\n" +
            "- Obscure B2B hardware the model hasn't seen (e.g. Loxone Miniserver → generic blob).\n" +
            "- 'minimalist line icon' constraints — model ignores them and fills with color.\n\n" +
            "### Iteration strategy\n" +
            "Start specific, not vague. Bad: 'Tech logo'. Better: 'Tech startup logo with geometric shapes, blue gradient'. " +
            "Best: 'SaaS productivity logo with connected geometric nodes, electric blue to purple gradient, clean modern style'.\n\n" +
            "### Verified template\n" +
            "`exploded isometric view of a {FAMOUS_OBJECT}, technical blueprint drawing, thin line art, dotted grid background, labeled components, engineering illustration`\n\n" +
            "### Known issues\n" +
            "- ~1 in 10 generations have corrupted SVG tails (malformed XML). Generate 3+ variants as insurance.\n" +
            "- Model may ignore 'no fills'/'monochrome' and hardcode its own palette. Post-process with find/replace for brand colors.\n" +
            "- First call may 504 — retry succeeds.",
          inputSchema: {
            type: "object",
            required: ["prompt", "model"],
            properties: {
              prompt: {
                type: "string",
                description:
                  "WHAT to generate. Be specific: name a concrete famous object, add style keywords, and specify colors with hex codes. " +
                  "Example: 'Heraldic lion crest with ornate medieval style details and gold gradient accents'. " +
                  "Never use abstract concepts like 'AI agent' or 'workflow' — use physical metaphors instead.",
              },
              model: {
                type: "string",
                description:
                  "Model ID to use. Recommended: 'arrow-preview' (Arrow 1.0, #1 on SVG Arena). Use list_models to discover all options.",
              },
              instructions: {
                type: "string",
                description:
                  "HOW it should look — style guidance separate from the subject. Think of prompt as 'what' and instructions as 'how'. " +
                  "Example: prompt='Japanese crane', instructions='Use a warm muted palette with detailed feather work'.",
              },
              n: {
                type: "number",
                description:
                  "Number of SVG variants to generate (max 16). Recommended: 3+ at higher temperature for best results, since ~1 in 10 generations can have corrupted tails.",
              },
              temperature: {
                type: "number",
                description:
                  "Sampling temperature (0–2). Lower (0.4) = more consistent, higher (0.9) = more creative variation. Use 0.9 with n≥3 for exploration.",
              },
              references: {
                type: "array",
                description:
                  "Up to 4 reference images for style, color, and composition guidance. " +
                  "References pull palette/color hints from the image, but style keywords ('blueprint', 'isometric', 'flat') must still be in the text prompt — references alone won't change drawing style.",
                items: {
                  type: "object",
                  oneOf: [
                    {
                      required: ["url"],
                      properties: {
                        url: {
                          type: "string",
                          description: "HTTP/HTTPS image URL.",
                        },
                      },
                    },
                    {
                      required: ["base64"],
                      properties: {
                        base64: {
                          type: "string",
                          description: "Base64-encoded image data.",
                        },
                      },
                    },
                  ],
                },
              },
              outputPath: {
                type: "string",
                description:
                  "Optional absolute file path to save the SVG(s) to disk. " +
                  "If omitted, SVG markup is returned in the response only. " +
                  "For multiple variants (n > 1), files are saved with _1, _2 … suffixes. " +
                  "Parent directories are created automatically.",
              },
            },
          },
        },
        {
          name: "vectorize_svg",
          description:
            "Convert a raster image (PNG, JPG, etc.) into an SVG using QuiverAI. " +
            "Provide the image as a URL or base64-encoded string.",
          inputSchema: {
            type: "object",
            required: ["model", "image"],
            properties: {
              model: {
                type: "string",
                description:
                  "Model ID to use. Use list_models to find models that support svg_vectorize.",
              },
              image: {
                type: "object",
                description: "The image to vectorize — either a URL or base64 data.",
                oneOf: [
                  {
                    required: ["url"],
                    properties: {
                      url: { type: "string", description: "HTTP/HTTPS image URL." },
                    },
                  },
                  {
                    required: ["base64"],
                    properties: {
                      base64: {
                        type: "string",
                        description: "Base64-encoded image data.",
                      },
                    },
                  },
                ],
              },
              autoCrop: {
                type: "boolean",
                description:
                  "Auto-crop to the dominant subject before vectorizing. Defaults to false.",
              },
              targetSize: {
                type: "number",
                description: "Square resize target in pixels before vectorizing.",
              },
              temperature: {
                type: "number",
                description: "Sampling temperature (0–2). Defaults to 1.",
              },
              outputPath: {
                type: "string",
                description:
                  "Optional absolute file path to save the vectorized SVG to disk. " +
                  "If omitted, SVG markup is returned in the response only. " +
                  "Parent directories are created automatically.",
              },
            },
          },
        },
        {
          name: "list_models",
          description:
            "List all models available on QuiverAI, including supported operations " +
            "(svg_generate, svg_vectorize, etc.) and pricing.",
          inputSchema: {
            type: "object",
            properties: {},
          },
        },
      ],
    }));
  • Helper function writeSvgs() used by the vectorize_svg handler to write SVG files to disk. Handles single and multiple SVG outputs, creating necessary parent directories and adding _1, _2 suffixes for multiple variants.
    async function writeSvgs(
      svgs: string[],
      outputPath: string
    ): Promise<string[]> {
      await mkdir(dirname(outputPath), { recursive: true });
    
      if (svgs.length === 1) {
        const p = outputPath.endsWith(".svg") ? outputPath : `${outputPath}.svg`;
        await writeFile(p, svgs[0], "utf-8");
        return [p];
      }
    
      const ext = extname(outputPath);
      const base = ext ? outputPath.slice(0, -ext.length) : outputPath;
      const suffix = ext || ".svg";
    
      const paths: string[] = [];
      for (let i = 0; i < svgs.length; i++) {
        const p = `${base}_${i + 1}${suffix}`;
        await writeFile(p, svgs[i], "utf-8");
        paths.push(p);
      }
      return paths;
    }
  • Helper function assertSvgResponse() used by the vectorize_svg handler to validate the API response shape (must contain data array of objects with svg string).
    function assertSvgResponse(
      result: unknown
    ): asserts result is { data: Array<{ svg: string }> } {
      if (
        typeof result !== "object" ||
        result === null ||
        !("data" in result) ||
        !Array.isArray((result as Record<string, unknown>).data)
      ) {
        const err = result as { message?: string };
        throw new Error(
          `QuiverAI API error: ${err.message ?? JSON.stringify(result)}`
        );
      }
    }
Behavior2/5

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

No annotations, so description carries full burden; it lacks details on failure modes, rate limits, output quality, or side effects beyond basic conversion.

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?

Two sentences, front-loaded with purpose, no extraneous information—efficient and clear.

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

Completeness3/5

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

Covers basic purpose and input method but omits return value format, side effects of optional parameters, and behavioral traits; adequate given schema coverage but incomplete.

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?

Schema coverage is 100% with detailed parameter descriptions, so description adds no new semantics beyond mentioning input image formats; baseline score applies.

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

Purpose5/5

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

Description clearly states the tool converts raster images (PNG, JPG) to SVG using QuiverAI, distinguishing it from sibling generate_svg which likely creates SVGs from scratch.

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

Usage Guidelines3/5

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

Implies usage when a raster image needs conversion, but no explicit guidance on when not to use or alternatives like generate_svg or list_models.

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/syntropicsignal-ai/quiver-mcp'

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