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);
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure but only states the basic conversion function. It doesn't explain what happens with invalid coordinates, whether the grid must be initialized, error conditions, or the format of the returned cell position. This leaves significant behavioral gaps for a coordinate transformation tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, clear sentence with zero wasted words. It's front-loaded with the core purpose and efficiently communicates the essential function without unnecessary elaboration, making it easy for an agent to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a coordinate conversion tool with no annotations, no output schema, and incomplete parameter documentation (50% schema coverage), the description is inadequate. It doesn't explain the return format, error handling, or dependencies on grid state, leaving the agent with insufficient context to use the tool effectively.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description mentions 'pixel coordinates' which aligns with the 'position' parameter in the schema, but doesn't explain the 'useOffset' parameter or provide additional context beyond what the 50% schema coverage offers. Since schema coverage is exactly 50%, the description doesn't fully compensate for the undocumented parameter, warranting a baseline score.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's function as converting pixel coordinates to grid cell position, which is a specific verb (convert) and resource (pixel coordinates to grid cell). It distinguishes itself from siblings like gridstack_get_grid_items or gridstack_get_cell_height by focusing on coordinate transformation rather than retrieval or measurement.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites like needing an initialized grid or compare it to similar tools like gridstack_get_column or gridstack_get_float, leaving the agent to infer usage context from the tool name alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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