Skip to main content
Glama
lorecraft-io

Refero MCP

Official
by lorecraft-io

refero_design_md

Render a Refero style into an agent-friendly DESIGN.md with frontmatter, color table, fonts, dos/donts, and tags. Optionally save to a project vault.

Instructions

Render a Refero style as an agent-friendly DESIGN.md (frontmatter, north star, color table, fonts, dos/donts, tags). When save_to_project is set, writes the file to /05-Projects//DESIGN.md.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
identifierYesuuid, hostname/URL, or site name to render.
save_to_projectNoVault project folder name (e.g. "PARZVL"). Sanitized; must be [A-Za-z0-9_.-].

Implementation Reference

  • Main handler for refero_design_md. Resolves an identifier via resolveAndFetch, renders the style as markdown via renderDesignMd, and optionally writes to vault/05-Projects/<name>/DESIGN.md.
    export async function handleDesignMd(args: DesignMdArgs): Promise<DesignMdResult> {
      const identifier = asIdentifier(args.identifier);
      const projectName = asProjectName(args.save_to_project);
    
      const full = await resolveAndFetch(identifier);
      const markdown = renderDesignMd(full);
    
      if (!projectName) {
        return {
          identifier,
          siteName: full.siteName,
          styleId: full.id,
          markdown,
        };
      }
    
      // resolveProjectDir throws PathSafetyError on bad input — let it propagate
      // so the MCP error envelope surfaces a useful message to the caller.
      const targetDir = resolveProjectDir(projectName);
      await mkdir(targetDir, { recursive: true });
      const targetPath = join(targetDir, "DESIGN.md");
      await writeFile(targetPath, markdown, "utf8");
    
      return {
        identifier,
        siteName: full.siteName,
        styleId: full.id,
        markdown,
        savedTo: targetPath,
      };
    }
  • Input types (DesignMdArgs: identifier, save_to_project) and output shape (DesignMdResult) for the tool.
    export interface DesignMdArgs {
      identifier?: unknown;
      save_to_project?: unknown;
    }
    
    export interface DesignMdResult {
      identifier: string;
      siteName: string;
      styleId: string;
      markdown: string;
      savedTo?: string;
    }
  • src/server.ts:75-94 (registration)
    Tool registration in the TOOLS array with name 'refero_design_md', description, inputSchema (identifier required, save_to_project optional).
    {
      name: "refero_design_md",
      description:
        "Render a Refero style as an agent-friendly DESIGN.md (frontmatter, north star, color table, fonts, dos/donts, tags). When `save_to_project` is set, writes the file to <vault>/05-Projects/<NAME>/DESIGN.md.",
      inputSchema: {
        type: "object",
        properties: {
          identifier: {
            type: "string",
            description: "uuid, hostname/URL, or site name to render.",
          },
          save_to_project: {
            type: "string",
            description: "Vault project folder name (e.g. \"PARZVL\"). Sanitized; must be [A-Za-z0-9_.-].",
          },
        },
        required: ["identifier"],
        additionalProperties: false,
      },
    },
  • src/server.ts:166-167 (registration)
    Dispatch case in the CallToolRequestSchema switch that routes 'refero_design_md' to handleDesignMd.
    case "refero_design_md":
      return handleDesignMd(a);
  • The pure renderDesignMd function that takes a FullStyle and produces the DESIGN.md markdown string (frontmatter, north star, colors table, fonts, dos/donts, tags, footer).
    export function renderDesignMd(full: FullStyle): string {
      const ds = full.fullResult.designSystem;
      const detailUrl = `${REFERO_DETAIL_BASE}/${full.id}`;
      const extractedAt = isoDay(full.previewVideoCapturedAt ?? full.createdAt);
    
      // ---- Frontmatter ----
      const fmLines: string[] = [
        "---",
        `source_url: ${yamlEscape(full.url)}`,
        `site_name: ${yamlEscape(full.siteName)}`,
        `extracted_at: ${yamlEscape(extractedAt)}`,
        `theme: ${yamlEscape(ds.theme ?? full.colorScheme)}`,
      ];
      if (full.industry) fmLines.push(`industry: ${yamlEscape(full.industry)}`);
      fmLines.push(`tags: ${yamlList(ds.tags ?? [])}`);
      fmLines.push("---", "");
    
      // ---- Heading + north star ----
      const lines: string[] = [
        ...fmLines,
        `# ${full.siteName}`,
        "",
      ];
      if (full.northStar && full.northStar.trim()) {
        for (const ln of full.northStar.trim().split(/\r?\n/)) {
          lines.push(`> ${ln}`);
        }
        lines.push("");
      }
    
      // ---- Colors ----
      const colors = ds.colors ?? [];
      if (colors.length > 0) {
        lines.push(
          "## Colors",
          "",
          "| Hex | Name | Role | Group |",
          "| --- | --- | --- | --- |",
          ...colors.map(colorRow),
          "",
        );
      }
    
      // ---- Fonts ----
      const fonts = ds.fonts ?? full.fonts ?? [];
      if (fonts.length > 0) {
        lines.push(
          "## Fonts",
          "",
          ...fonts.map((f) => `- ${f}`),
          "",
        );
      }
    
      // ---- Do ----
      if ((ds.dos ?? []).length > 0) {
        lines.push(
          "## Do",
          "",
          ...ds.dos.map((d) => `- ${d}`),
          "",
        );
      }
    
      // ---- Don't ----
      if ((ds.donts ?? []).length > 0) {
        lines.push(
          "## Don't",
          "",
          ...ds.donts.map((d) => `- ${d}`),
          "",
        );
      }
    
      // ---- Tags ----
      if ((ds.tags ?? []).length > 0) {
        lines.push(
          "## Tags",
          "",
          ds.tags.map((t) => `\`${t}\``).join(" · "),
          "",
        );
      }
    
      // ---- Footer ----
      lines.push(
        "---",
        "",
        `Generated by refero-mcp from ${detailUrl} on ${extractedAt}`,
        "",
      );
    
      return lines.join("\n");
    }
Behavior3/5

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

With no annotations, the description discloses the side effect of writing a file when save_to_project is set and specifies the file path. However, it does not detail overwrite behavior, error handling, or permission requirements, leaving some behavioral ambiguity.

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 concise sentences: first states purpose and content, second adds conditional behavior. No superfluous information, efficiently communicates core functionality.

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?

For a tool with two parameters and no output schema, the description explains the main action and optional save. It could mention that it generates a document without modifying the original style, but overall it is sufficient for an agent to understand what the tool does.

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

Parameters4/5

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

The input schema already has 100% coverage with clear descriptions. The tool description adds context by explaining the file path construction from save_to_project, going beyond the schema. Good addition but not essential.

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 tool renders a Refero style as a DESIGN.md file with specified contents (frontmatter, north star, etc.) and optionally writes it to a project folder. This distinguishes it from sibling tools that retrieve, list, or search styles.

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?

The description explains what the tool does but lacks explicit guidance on when to use it over alternatives like refero_get or refero_search. No when/ when-not or comparison to siblings is provided.

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/lorecraft-io/refero-design-mcp'

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