Skip to main content
Glama

gridstack_will_it_fit

Check if a widget fits at specified coordinates in a dashboard grid layout. Verify placement without overlaps before adding widgets to ensure proper positioning.

Instructions

Check if a widget will fit at specified position

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
widgetYes

Implementation Reference

  • Core handler function for the 'gridstack_will_it_fit' tool. Destructures the widget parameters and generates JavaScript code that calls GridStack's built-in 'willItFit' method to check if a widget fits at the specified position without collisions.
    private async willItFit(params: any): Promise<string> { const { widget } = params; return this.utils.generateGridStackCode("willItFit", { widget, code: `const willFit = grid.willItFit(${JSON.stringify( widget, null, 2 )});`, }); }
  • Registration of the 'gridstack_will_it_fit' tool in the listTools() method of GridStackTools class, including detailed input schema for validation.
    { name: "gridstack_will_it_fit", description: "Check if a widget will fit at specified position", inputSchema: { type: "object", required: ["widget"], properties: { widget: { 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" }, id: { oneOf: [{ type: "string" }, { type: "number" }], description: "Widget ID to ignore in collision check", }, }, }, }, }, },
  • Dispatch handler in the callTool method's switch statement that invokes the specific willItFit handler for this tool.
    case "gridstack_will_it_fit": return this.willItFit(args);
  • Input schema definition specifying the required 'widget' object with position (x,y), size (w,h), and optional id for collision checking.
    inputSchema: { type: "object", required: ["widget"], properties: { widget: { 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" }, id: { oneOf: [{ type: "string" }, { type: "number" }], description: "Widget ID to ignore in collision check", }, }, }, }, },
  • Documentation reference to the tool in the API documentation resource.
    - \`gridstack_will_it_fit\` - Check widget fit

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/raghavsharma-simpplr/gridstack-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server