Skip to main content
Glama
Adobe XD MCP

Adobe XD MCP

by srayan-uxd

xd_infer_layout

Proposes auto-layout frames from an exact XD screen export by clustering layers into cards, rows, and columns, deriving spacing/padding, and returning a drift report to compare with original.

Instructions

Phase 2 of a conversion: from the exact export of a screen, propose frames with AUTO-LAYOUT intent. Clusters layers into cards by containment, detects rows/columns and header-style space-between rows, derives item spacing (median gap) and padding (rounded to a grid), marks equal-width cards and full-width text as FILL, keeps illustrations/photos/masked or rotated groups as fixed leaves, puts overlapping decorations in absoluteChildren, turns centred-label rectangles into buttons, and suggests semantic layer names. Leaves reference the exact layers by ref. Returns a drift report (pixelDeltaEstimate, within3px, within5px, elementsAbsolute, elementsAutoLayout) so you know how far the auto-layout version moves things. A heuristic proposal: rebuild it beside the exact copy and compare with xd_render_artboard.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "file": "<file>",
      "artboard": "<artboard>"
    },
    "name": "xd_infer_layout"
  }
}

Input Schema

NameRequiredDescriptionDefault
fileYesAbsolute path to a .xd file
gridNoRound spacing and padding to this grid (px)
nodeIdNoAnalyse only this layer
artboardYesArtboard id or name
maxDriftNoFrames whose auto-layout would move something more than this many px keep exact positions instead (0 = never fall back)
toleranceNoPixels within which items count as the same row or column
mergeLooseNoMerge loose, overlapping vector pieces that were never grouped in XD into one illustration or icon
iconMaxSizeNoA small group up to this many px (no text) is kept as ONE icon
looseMinPartsNoMinimum number of pieces for that merge
illustrationMinPartsNoA group with more vector parts than this is kept as ONE illustration

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.4.0

TDQS

A3.6/5.0
Behavior3/5

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

With no annotations, the description carries the full burden, and it does disclose a lot: the heuristic nature, the drift report fields, and the maxDrift fallback to exact positions. However, it never says whether the tool writes anything to the .xd file or purely returns a proposal, which is a significant ambiguity for a tool that 'proposes frames'. Side effects and idempotency remain unstated.

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

Conciseness3/5

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

The purpose and the drift-report payoff are front-loaded, and most clauses carry real information. However, the middle of the description is a single dense run-on sentence listing seven or eight heuristics in a row, which makes it harder to scan than a short structured list would be.

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 10-parameter tool with no annotations and no output schema, the description compensates well by naming the return payload's fields (pixelDeltaEstimate, within3px, elementsAbsolute, elementsAutoLayout) and by describing the heuristic pipeline. The main remaining gap is the absence of any statement about whether the source file is modified.

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%, so the schema already documents all 10 parameters, which sets the baseline at 3. The description reinforces the meaning of some parameters by describing outcomes (padding rounded to a grid, median-gap spacing, fixed leaves for large illustrations, absoluteChildren for overlapping decorations), but it never maps those behaviors back to specific parameter names such as tolerance or illustrationMinParts.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description uses a specific verb and resource: it proposes auto-layout frames from an exported screen, and it enumerates the concrete inferences it makes (card clustering, row/column detection, FILL marking, absoluteChildren, button detection). This clearly separates it from list/export siblings like xd_export_artboard or xd_find_layers. It does not name the 'Phase 1' export sibling it depends on, which slightly weakens differentiation.

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 positions the tool as 'Phase 2 of a conversion' and tells the agent to rebuild beside the exact copy and compare with xd_render_artboard, which is concrete when-to-use and follow-up guidance. It also warns that the output is 'a heuristic proposal.' It never states when NOT to use the tool, and the Phase 1 dependency is implied rather than named.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.