gridstack_is_area_empty
Check if a specified grid area is empty by providing coordinates and dimensions to verify available space for widget placement.
Instructions
Check if an area is empty
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| x | Yes | X position | |
| y | Yes | Y position | |
| w | Yes | Width | |
| h | Yes | Height |
Implementation Reference
- src/tools/index.ts:1074-1081 (handler)The handler function that implements the core logic of the "gridstack_is_area_empty" tool. It destructures the input parameters (x, y, w, h) and uses GridStackUtils.generateGridStackCode to produce JavaScript code calling GridStack's grid.isAreaEmpty method, which checks if the specified grid area is empty.private async isAreaEmpty(params: any): Promise<string> { const { x, y, w, h } = params; return this.utils.generateGridStackCode("isAreaEmpty", { area: { x, y, w, h }, code: `const isEmpty = grid.isAreaEmpty(${x}, ${y}, ${w}, ${h});`, }); }
- src/tools/index.ts:549-558 (schema)The input schema for the tool, specifying required numeric parameters x, y, w, h with descriptions for the area to check.inputSchema: { type: "object", required: ["x", "y", "w", "h"], properties: { x: { type: "number", description: "X position" }, y: { type: "number", description: "Y position" }, w: { type: "number", description: "Width" }, h: { type: "number", description: "Height" }, }, },
- src/tools/index.ts:546-559 (registration)Tool registration entry in the listTools() array, including name, description, and input schema.{ name: "gridstack_is_area_empty", description: "Check if an area is empty", inputSchema: { type: "object", required: ["x", "y", "w", "h"], properties: { x: { type: "number", description: "X position" }, y: { type: "number", description: "Y position" }, w: { type: "number", description: "Width" }, h: { type: "number", description: "Height" }, }, }, },
- src/tools/index.ts:825-826 (registration)Switch case in callTool method that registers and dispatches calls to the isAreaEmpty handler.case "gridstack_is_area_empty": return this.isAreaEmpty(args);