Skip to main content
Glama
eDramas

MasterGo Magic MCP

by eDramas

mcp__getDsl

Retrieve raw DSL data and code generation rules from MasterGo design files. Analyze component hierarchy and design properties to transform designs into code.

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 must provide a fileId and layerId to identify the specific design element. 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
fileIdYesMasterGo design file ID (format: file/<fileId> in MasterGo URL)
layerIdYesLayer ID of the specific component or element to retrieve (format: ?layer_id=<layerId> / file=<fileId> in MasterGo URL)

Implementation Reference

  • The execute() method is the handler for the mcp__getDsl tool. It calls httpUtil.getDsl(fileId, layerId) and returns the result as JSON text. On failure, it returns an error message.
      async execute({ fileId, layerId }: z.infer<typeof this.schema>) {
        try {
          const dsl = await this.httpUtil.getDsl(fileId, layerId);
          return {
            content: [
              {
                type: "text" as const,
                text: JSON.stringify(dsl),
              },
            ],
          };
        } catch (error) {
          return {
            content: [
              {
                type: "text" as const,
                text: JSON.stringify({ error: "Failed to get DSL" }),
              },
            ],
          };
        }
      }
    }
  • Zod schema defining the two input parameters for the mcp__getDsl tool: fileId (string) and layerId (string).
    schema = z.object({
      fileId: z
        .string()
        .describe(
          "MasterGo design file ID (format: file/<fileId> in MasterGo URL)"
        ),
      layerId: z
        .string()
        .describe(
          "Layer ID of the specific component or element to retrieve (format: ?layer_id=<layerId> / file=<fileId> in MasterGo URL)"
        ),
    });
  • src/index.ts:41-42 (registration)
    Registration of the GetDslTool on the MCP server. A new GetDslTool instance is created with the httpUtil and registered via the BaseTool.register() method.
    new GetDslTool(httpUtil).register(server);
    new GetComponentLinkTool(httpUtil).register(server);
  • The getDsl() method in HttpUtil that actually performs the HTTP GET request to /mcp/dsl endpoint with fileId/layerId params, and enriches the response with componentDocumentLinks (extracted from DSL nodes) and rules.
    public async getDsl(fileId: string, layerId: string): Promise<DslResponse> {
      try {
        const params: any = { fileId, layerId };
    
        const response = await this.httpClient.get("/mcp/dsl", { params });
        const result = {
          dsl: response.data,
          componentDocumentLinks: this.handleDslComponentDocumentLinks(
            response.data
          ),
          rules: [
            "token filed must be generated as a variable (colors, shadows, fonts, etc.) and the token field must be displayed in the comment",
            `
              componentDocumentLinks is a list of frontend component documentation links used in the DSL layer, designed to help you understand how to use the components.
              When it exists and is not empty, you need to use mcp__getComponentLink in a for loop to get the URL content of all components in the list, understand how to use the components, and generate code using the components.
              For example: 
                \`\`\`js  
                  const componentDocumentLinks = [
                    'https://example.com/ant/button.mdx',
                    'https://example.com/ant/button.mdx'
                  ]
                  for (const url of componentDocumentLinks) {
                    const componentLink = await mcp__getComponentLink(url);
                    console.log(componentLink);
                  }
                \`\`\`
            `,
            ...(JSON.parse(process.env.RULES ?? "[]") as string[]),
          ],
        };
        return result;
      } catch (error) {
        throw error;
      }
    }
  • Class definition and name property setting DSL_TOOL_NAME = 'mcp__getDsl' on the GetDslTool class, which extends BaseTool.
    export class GetDslTool extends BaseTool {
      name = DSL_TOOL_NAME;
Behavior3/5

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

With no annotations, the description carries the burden of behavioral disclosure. It states the tool returns DSL data and rules, implying a read-only operation, but does not explicitly confirm no side effects, permissions, or rate limits.

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?

Six sentences, each adding value: purpose, use cases, requirements, return format, additional content, and extensibility. Front-loaded with the main action.

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 no output schema, the description explains the return value (DSL data in JSON, rules) and mentions transformation use. Could briefly mention expected JSON structure or limitations, but overall sufficient.

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 clear descriptions of fileId and layerId. The description only reiterates the requirement to provide both, adding no new meaning beyond the schema.

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 retrieves DSL data from MasterGo design files and the rules for code generation, with specific use cases. It distinguishes from sibling tool getComponentLink by focusing on design structure analysis.

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?

Provides clear context for when to use the tool (analyze structure, hierarchy, properties) but does not explicitly mention when not to use it or compare to the sibling tool.

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

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