Skip to main content
Glama

gridstack_get_cell_from_pixel

Convert pixel coordinates to grid cell positions for dynamic dashboard layouts, enabling precise widget placement in responsive grid systems.

Instructions

Convert pixel coordinates to grid cell position

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
positionYes
useOffsetNoUse offset coordinates

Implementation Reference

  • The handler function that executes the tool logic by generating JavaScript code to call GridStack's getCellFromPixel method.
    private async getCellFromPixel(params: any): Promise<string> { const { position, useOffset = false } = params; return this.utils.generateGridStackCode("getCellFromPixel", { position, useOffset, code: `const cell = grid.getCellFromPixel(${JSON.stringify( position )}, ${useOffset});`, }); }
  • The tool schema definition including name, description, and input validation schema.
    { name: "gridstack_get_cell_from_pixel", description: "Convert pixel coordinates to grid cell position", inputSchema: { type: "object", required: ["position"], properties: { position: { type: "object", required: ["top", "left"], properties: { top: { type: "number", description: "Top pixel position" }, left: { type: "number", description: "Left pixel position" }, }, }, useOffset: { type: "boolean", description: "Use offset coordinates", default: false, }, }, }, },
  • Registration of the tool handler in the central callTool switch statement.
    case "gridstack_get_cell_from_pixel": return this.getCellFromPixel(args);

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