gridstack_add_grid
Create a new grid layout with customizable options and child widgets for building dynamic dashboard interfaces and responsive drag-and-drop systems.
Instructions
Create a new grid with options and children (static method)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| parent | Yes | Parent element selector | |
| opt | No | Grid options including children |
Implementation Reference
- src/tools/index.ts:1157-1169 (handler)The handler function for 'gridstack_add_grid' that destructures params and generates code calling the static GridStack.addGrid method.private async addGrid(params: any): Promise<string> { const { parent, opt = {} } = params; return this.utils.generateGridStackCode("addGrid", { parent, options: opt, code: `const grid = GridStack.addGrid('${parent}', ${JSON.stringify( opt, null, 2 )});`, }); }
- src/tools/index.ts:733-761 (schema)Input schema definition for the gridstack_add_grid tool, specifying required 'parent' and optional 'opt' with children array.{ name: "gridstack_add_grid", description: "Create a new grid with options and children (static method)", inputSchema: { type: "object", required: ["parent"], properties: { parent: { type: "string", description: "Parent element selector", }, opt: { type: "object", description: "Grid options including children", properties: { children: { type: "array", items: { type: "object", description: "Child widget configuration", }, description: "Array of child widgets to load", }, }, }, }, }, },
- src/tools/index.ts:855-857 (registration)Switch case in callTool method that registers and routes 'gridstack_add_grid' to the addGrid handler.case "gridstack_add_grid": return this.addGrid(args);