Skip to main content
Glama
YonasValentin

Design Inspiration MCP Server

Extract design tokens from website

design_extract_tokens
Read-onlyIdempotent

Extract design tokens like colors, typography, and spacing from any live website URL to analyze and implement visual styles.

Instructions

Extract actual design tokens (colors, typography, spacing, borders, shadows) from a live website using headless browser. Give it any URL and get back the exact values used. Pairs well with the search tools — find inspiration, then extract tokens from sites you like.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesWebsite URL to extract design tokens from. Examples: "https://stripe.com", "https://linear.app"
dark_modeNoExtract colors from dark mode variant
mobileNoExtract from mobile viewport (375px)

Implementation Reference

  • The tool handler function for "design_extract_tokens" which orchestrates the call to `runDembrandt` and `formatTokens`.
    }, async (params: ExtractTokensInput) => {
      try {
        const url = params.url.startsWith("http") ? params.url : `https://${params.url}`;
        const flags: string[] = [];
        if (params.dark_mode) flags.push("--dark-mode");
        if (params.mobile) flags.push("--mobile");
    
        const stdout = await runDembrandt(url, flags);
        const tokens: DesignTokens = JSON.parse(stdout);
        const text = formatTokens(tokens, url);
    
        return {
          content: [{ type: "text" as const, text }],
          structuredContent: { url, dark_mode: params.dark_mode, mobile: params.mobile, tokens },
        };
      } catch (error) {
        return {
          content: [
            {
              type: "text" as const,
              text: error instanceof Error ? error.message : `Error: ${String(error)}`,
            },
          ],
        };
      }
    });
  • Zod schema defining the inputs for the design_extract_tokens tool.
    const ExtractTokensInputSchema = z
      .object({
        url: z
          .string()
          .min(4, "URL is required")
          .describe('Website URL to extract design tokens from. Examples: "https://stripe.com", "https://linear.app"'),
        dark_mode: z
          .boolean()
          .default(false)
          .describe("Extract colors from dark mode variant"),
        mobile: z
          .boolean()
          .default(false)
          .describe("Extract from mobile viewport (375px)"),
      })
      .strict();
  • src/index.ts:515-524 (registration)
    Tool registration for "design_extract_tokens" with the MCP server.
    server.registerTool("design_extract_tokens", {
      title: "Extract design tokens from website",
      description: `Extract actual design tokens (colors, typography, spacing, borders, shadows) from a live website using headless browser. Give it any URL and get back the exact values used. Pairs well with the search tools — find inspiration, then extract tokens from sites you like.`,
      inputSchema: ExtractTokensInputSchema,
      annotations: {
        readOnlyHint: true,
        destructiveHint: false,
        idempotentHint: true,
        openWorldHint: true,
      },
  • Helper function to execute the dembrandt command-line tool.
    function runDembrandt(url: string, flags: string[]): Promise<string> {
      return new Promise((resolve, reject) => {
        const args = [url, "--json-only", ...flags];
        execFile("dembrandt", args, { timeout: 60_000, maxBuffer: 5 * 1024 * 1024 }, (error, stdout, stderr) => {
          if (error) {
            const msg = stderr?.trim() || error.message;
            if (error.killed) return reject(new Error("Timed out after 60s. The site may be too slow — try with --slow via CLI."));
            if (msg.includes("net::ERR_NAME_NOT_RESOLVED")) return reject(new Error(`Could not resolve URL: ${url}`));
            if (msg.includes("net::ERR_CONNECTION_REFUSED")) return reject(new Error(`Connection refused: ${url}`));
            return reject(new Error(`dembrandt failed: ${msg}`));
          }
          resolve(stdout);
        });
      });
  • Helper function to format the design tokens into a Markdown representation.
    function formatTokens(tokens: DesignTokens, url: string): string {
      const lines = [`# Design Tokens: ${url}`, ""];
    
      if (tokens.colors && Object.keys(tokens.colors).length) {
        lines.push("## Colors", "");
        for (const [name, value] of Object.entries(tokens.colors)) {
          if (typeof value === "string") {
            lines.push(`- **${name}**: \`${value}\``);
          } else if (typeof value === "object" && value !== null) {
            lines.push(`- **${name}**: \`${JSON.stringify(value)}\``);
          }
        }
        lines.push("");
      }
    
      if (tokens.typography && Object.keys(tokens.typography).length) {
        lines.push("## Typography", "");
        for (const [name, value] of Object.entries(tokens.typography)) {
          if (typeof value === "string") {
            lines.push(`- **${name}**: \`${value}\``);
          } else if (typeof value === "object" && value !== null) {
            lines.push(`- **${name}**: \`${JSON.stringify(value)}\``);
          }
        }
        lines.push("");
      }
    
      if (tokens.spacing && Object.keys(tokens.spacing).length) {
        lines.push("## Spacing", "");
        for (const [name, value] of Object.entries(tokens.spacing)) {
          lines.push(`- **${name}**: \`${JSON.stringify(value)}\``);
        }
        lines.push("");
      }
    
      if (tokens.borders && Object.keys(tokens.borders).length) {
        lines.push("## Borders", "");
        for (const [name, value] of Object.entries(tokens.borders)) {
          lines.push(`- **${name}**: \`${JSON.stringify(value)}\``);
        }
        lines.push("");
      }
    
      if (tokens.shadows && Object.keys(tokens.shadows).length) {
        lines.push("## Shadows", "");
        for (const [name, value] of Object.entries(tokens.shadows)) {
          lines.push(`- **${name}**: \`${JSON.stringify(value)}\``);
        }
        lines.push("");
      }
    
      // Any remaining top-level keys
      const handled = new Set(["colors", "typography", "spacing", "borders", "shadows"]);
      for (const [key, value] of Object.entries(tokens)) {
        if (handled.has(key) || value === undefined || value === null) continue;
        lines.push(`## ${key.charAt(0).toUpperCase() + key.slice(1)}`, "");
        if (typeof value === "object") {
          for (const [k, v] of Object.entries(value as Record<string, unknown>)) {
            lines.push(`- **${k}**: \`${typeof v === "string" ? v : JSON.stringify(v)}\``);
          }
        } else {
          lines.push(`- ${JSON.stringify(value)}`);
        }
        lines.push("");
      }
    
      let result = lines.join("\n");
      if (result.length > CHARACTER_LIMIT) {
        result = result.slice(0, CHARACTER_LIMIT) + "\n\n...(truncated)";
      }
      return result;
    }
Behavior4/5

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

The description adds valuable behavioral context beyond what annotations provide: it specifies the extraction method ('using headless browser'), indicates it works on 'live websites,' and mentions the tool's purpose in a design workflow. While annotations already cover safety (readOnlyHint=true, destructiveHint=false) and reliability (idempotentHint=true, openWorldHint=true), the description enhances understanding of how the tool operates in practice.

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 efficiently structured in two sentences: the first explains the core functionality, and the second provides usage context and integration with sibling tools. Every phrase adds value without redundancy, making it easy to parse and understand quickly.

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

Completeness4/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 (3 parameters, no output schema) and rich annotations (covering safety and reliability), the description provides sufficient context for effective use. It explains what the tool does, how it fits with other tools, and its practical application. The main gap is the lack of output format details, but this is partially mitigated by the clear purpose statement.

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?

With 100% schema description coverage, the input schema already fully documents all three parameters (url, dark_mode, mobile). The description doesn't add any parameter-specific details beyond what's in the schema, so it meets the baseline expectation without providing extra semantic value.

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?

The description clearly states the specific action ('Extract actual design tokens'), the resource ('from a live website'), and the method ('using headless browser'). It explicitly lists the types of tokens extracted (colors, typography, spacing, borders, shadows) and distinguishes itself from sibling search tools by focusing on extraction rather than discovery.

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

Usage Guidelines5/5

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

The description provides explicit guidance on when to use this tool ('Give it any URL and get back the exact values used') and how it complements sibling tools ('Pairs well with the search tools — find inspiration, then extract tokens from sites you like'). This clearly differentiates it from the search-focused siblings (design_search_images, design_search_references, design_search_styles).

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/YonasValentin/design-inspiration-mcp-server'

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