gridstack_save
Save dashboard layouts to JSON format for persistence and reuse, with options to include widget content and grid configuration settings.
Instructions
Save grid layout to JSON
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| saveContent | No | Include widget content in save | |
| saveGridOpt | No | Include grid options in save |
Implementation Reference
- src/tools/index.ts:1001-1009 (handler)The main handler function for the 'gridstack_save' tool. It destructures parameters and generates JavaScript code using GridStackUtils to save the current grid layout to JSON, with options to include content and grid options.
private async save(params: SaveGridParams): Promise<string> { const { saveContent = true, saveGridOpt = false } = params; return this.utils.generateGridStackCode("save", { saveContent, saveGridOpt, code: `const layout = grid.save(${saveContent}, ${saveGridOpt});`, }); } - src/tools/index.ts:395-413 (schema)The tool definition object in listTools(), providing the name, description, and inputSchema (JSON schema for validation) for the 'gridstack_save' MCP tool.
{ name: "gridstack_save", description: "Save grid layout to JSON", inputSchema: { type: "object", properties: { saveContent: { type: "boolean", description: "Include widget content in save", default: true, }, saveGridOpt: { type: "boolean", description: "Include grid options in save", default: false, }, }, }, }, - src/tools/index.ts:804-806 (registration)The switch case in callTool() method that registers and routes calls to the specific handler for 'gridstack_save'.
case "gridstack_save": return this.save(args as SaveGridParams);