Skip to main content
Glama
mastergo-design

MasterGo Magic MCP

Official

mcp__getDsl

Retrieve DSL data and code generation rules from MasterGo design files using fileId, layerId, or a short link. Analyze design structure, component hierarchy, and extract properties in JSON format for parsing or framework-specific code generation.

Instructions

"Use this tool to retrieve the DSL (Domain Specific Language) data from MasterGo design files and the rules you must follow when generating code. This tool is useful when you need to analyze the structure of a design, understand component hierarchy, or extract design properties. You can provide either:

  1. fileId and layerId directly, or

  2. a short link (like https://{domain}/goto/LhGgBAK) This tool returns the raw DSL data in JSON format that you can then parse and analyze. This tool also returns the rules you must follow when generating code. The DSL data can also be used to transform and generate code for different frameworks."

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fileIdNoMasterGo design file ID (format: file/<fileId> in MasterGo URL). Required if shortLink is not provided.
layerIdNoLayer ID of the specific component or element to retrieve (format: ?layer_id=<layerId> / file=<fileId> in MasterGo URL). Required if shortLink is not provided.
shortLinkNoShort link (like https://{domain}/goto/LhGgBAK).

Implementation Reference

  • The async execute method implementing the tool logic: extracts fileId and layerId from shortLink if provided, fetches DSL using httpUtilInstance.getDsl, returns structured content or error.
    async execute({ fileId, layerId, shortLink }: z.infer<typeof this.schema>) {
      try {
        if (!shortLink && (!fileId || !layerId)) {
          throw new Error(
            "Either provide both fileId and layerId, or provide a MasterGo URL"
          );
        }
    
        let finalFileId = fileId;
        let finalLayerId = layerId;
    
        // If URL is provided, extract fileId and layerId from it
        if (shortLink) {
          const ids = await httpUtilInstance.extractIdsFromUrl(shortLink);
          finalFileId = ids.fileId;
          finalLayerId = ids.layerId;
        }
    
        if (!finalFileId || !finalLayerId) {
          throw new Error("Could not determine fileId or layerId");
        }
    
        const dsl = await httpUtilInstance.getDsl(finalFileId, finalLayerId);
        return {
          content: [
            {
              type: "text" as const,
              text: JSON.stringify(dsl),
            },
          ],
        };
      } catch (error: any) {
        const errorMessage = error.response?.data ?? error?.message;
        return {
          isError: true,
          content: [
            {
              type: "text" as const,
              text: JSON.stringify(errorMessage),
            },
          ],
        };
      }
    }
  • Zod schema defining the input parameters for the tool: fileId, layerId (optional), shortLink (optional).
    schema = z.object({
      fileId: z
        .string()
        .optional()
        .describe(
          "MasterGo design file ID (format: file/<fileId> in MasterGo URL). Required if shortLink is not provided."
        ),
      layerId: z
        .string()
        .optional()
        .describe(
          "Layer ID of the specific component or element to retrieve (format: ?layer_id=<layerId> / file=<fileId> in MasterGo URL). Required if shortLink is not provided."
        ),
      shortLink: z
        .string()
        .optional()
        .describe("Short link (like https://{domain}/goto/LhGgBAK)."),
    });
  • src/index.ts:35-35 (registration)
    Registration of the GetDslTool instance with the MCP server.
    new GetDslTool().register(server);
Behavior3/5

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

No annotations are provided, so the description carries the full burden. It discloses that the tool returns 'raw DSL data in JSON format' and 'rules you must follow when generating code,' which helps understand the output. However, it lacks details on error handling, authentication needs, rate limits, or whether the operation is read-only or has side effects, leaving behavioral gaps for a tool with no annotation coverage.

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

Conciseness4/5

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

The description is well-structured and front-loaded with the core purpose. Each sentence adds useful information, such as usage context, input options, and output details, with minimal redundancy. However, the final sentence about transforming and generating code is somewhat repetitive with earlier content, slightly reducing efficiency.

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?

Given no annotations and no output schema, the description partially compensates by explaining the return format (JSON) and including rules for code generation. However, for a tool with three parameters and no structured output documentation, it lacks details on error cases, response structure examples, or prerequisites, leaving room for improvement in completeness.

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 description coverage is 100%, so the schema already documents all three parameters thoroughly. The description adds marginal value by summarizing the input options ('You can provide either: 1. fileId and layerId directly, or 2. a short link') but does not provide additional syntax or format details beyond what the schema specifies. This meets the baseline for high schema coverage.

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's purpose: 'retrieve the DSL (Domain Specific Language) data from MasterGo design files and the rules you must follow when generating code.' It specifies the exact resource (DSL data and rules) and distinguishes it from sibling tools like getComponentGenerator or getMeta by focusing on raw DSL extraction rather than component generation or metadata.

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

Usage Guidelines4/5

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

The description provides clear context for when to use the tool: 'when you need to analyze the structure of a design, understand component hierarchy, or extract design properties.' It also explains the two input options (fileId/layerId or shortLink). However, it does not explicitly state when NOT to use it or name specific alternatives among the sibling tools.

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

Related 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/mastergo-design/mastergo-magic-mcp'

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