Grid builder
build_gridBuild a column grid from page or container width. Pass width, and optionally columns (default 12), gutter (default 24), margin (default 24). Returns the column width, the x position of every column, the width of every span from 1 to N columns, CSS grid code (fixed pixel and fluid fr versions), and the Figma layout grid settings. Flags fractional column widths and suggests the nearest widths that give whole pixels. For a modular grid, also pass rows and height; optionally rowGutter (defaults to the gutter) and baseline (line height in px). The modular result gives module size, row positions, CSS, and whether module height plus row gutter lands on whole baseline lines, with the module height that would fix it (a convention). Rejects zero, negative, NaN and layouts where the columns do not fit. Sources: Müller-Brockmann, Grid Systems in Graphic Design; Samara, Making and Breaking the Grid; Marcotte, Responsive Web Design. Pure arithmetic, nothing stored.
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": {
"width": "<width>"
},
"name": "build_grid"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| rows | No | Rows for the modular variant (needs `height`). | |
| width | Yes | Page or container width in px. | |
| gutter | No | Gutter in px (default 24, 0 allowed). | |
| height | No | Page height in px for the modular variant. | |
| margin | No | Outer margin on each side in px (default 24, 0 allowed). | |
| columns | No | Number of columns (default 12, max 64). | |
| baseline | No | Baseline unit in px, to check module alignment. | |
| rowGutter | No | Gutter between rows in px (default: the column gutter). |