Skip to main content
Glama

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);

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