gridstack_destroy
Remove a grid instance and optionally delete its DOM elements to clean up dashboard layouts and free system resources when no longer needed.
Instructions
Destroy the grid instance
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| removeDOM | No | Remove DOM elements |
Implementation Reference
- src/tools/index.ts:1034-1041 (handler)The handler function that implements the core logic for the gridstack_destroy tool. It destructures the removeDOM parameter and uses GridStackUtils to generate the JavaScript code `grid.destroy(removeDOM)` for destroying the grid instance.private async destroy(params: DestroyParams): Promise<string> { const { removeDOM = false } = params; return this.utils.generateGridStackCode("destroy", { removeDOM, code: `grid.destroy(${removeDOM});`, }); }
- src/tools/index.ts:460-473 (schema)The schema definition for the gridstack_destroy tool, including inputSchema with the removeDOM boolean parameter (default false). This is part of the tools returned by listTools().{ name: "gridstack_destroy", description: "Destroy the grid instance", inputSchema: { type: "object", properties: { removeDOM: { type: "boolean", description: "Remove DOM elements", default: false, }, }, }, },
- src/tools/index.ts:813-814 (registration)The registration and dispatch point in the callTool switch statement, mapping the tool name to the destroy handler function.case "gridstack_destroy": return this.destroy(args as DestroyParams);