gridstack_margin
Adjust spacing between grid items in dashboard layouts by setting margin or gap values with CSS units like px, em, or rem.
Instructions
Update grid margin/gap
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| value | Yes | Margin value (px or CSS format) | |
| unit | No | CSS unit (px, em, rem, etc.) | px |
Implementation Reference
- src/tools/index.ts:982-990 (handler)The handler function that implements the core logic for the gridstack_margin tool. It extracts the value and optional unit from parameters and generates the GridStack code using GridStackUtils to call grid.margin().private async margin(params: MarginParams): Promise<string> { const { value, unit = "px" } = params; return this.utils.generateGridStackCode("margin", { value, unit, code: `grid.margin(${typeof value === "string" ? `'${value}'` : value});`, }); }
- src/tools/index.ts:358-376 (schema)The input schema and tool metadata (name, description) for gridstack_margin, defining the expected parameters.{ name: "gridstack_margin", description: "Update grid margin/gap", inputSchema: { type: "object", required: ["value"], properties: { value: { oneOf: [{ type: "number" }, { type: "string" }], description: "Margin value (px or CSS format)", }, unit: { type: "string", description: "CSS unit (px, em, rem, etc.)", default: "px", }, }, }, },
- src/tools/index.ts:798-799 (registration)Registration of the handler in the central callTool switch statement, dispatching calls to the margin method.case "gridstack_margin": return this.margin(args as MarginParams);
- src/types.ts:239-242 (schema)TypeScript type definition for MarginParams used in the handler signature and casting.export interface MarginParams { value: number | string; unit?: string; }