Skip to main content
Glama

gridstack_margin

Adjust spacing between grid items in dashboard layouts by setting margin or gap values with CSS units like px, em, or rem.

Instructions

Update grid margin/gap

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
valueYesMargin value (px or CSS format)
unitNoCSS unit (px, em, rem, etc.)px

Implementation Reference

  • The handler function that implements the core logic for the gridstack_margin tool. It extracts the value and optional unit from parameters and generates the GridStack code using GridStackUtils to call grid.margin().
    private async margin(params: MarginParams): Promise<string> {
      const { value, unit = "px" } = params;
    
      return this.utils.generateGridStackCode("margin", {
        value,
        unit,
        code: `grid.margin(${typeof value === "string" ? `'${value}'` : value});`,
      });
    }
  • The input schema and tool metadata (name, description) for gridstack_margin, defining the expected parameters.
    {
      name: "gridstack_margin",
      description: "Update grid margin/gap",
      inputSchema: {
        type: "object",
        required: ["value"],
        properties: {
          value: {
            oneOf: [{ type: "number" }, { type: "string" }],
            description: "Margin value (px or CSS format)",
          },
          unit: {
            type: "string",
            description: "CSS unit (px, em, rem, etc.)",
            default: "px",
          },
        },
      },
    },
  • Registration of the handler in the central callTool switch statement, dispatching calls to the margin method.
    case "gridstack_margin":
      return this.margin(args as MarginParams);
  • TypeScript type definition for MarginParams used in the handler signature and casting.
    export interface MarginParams {
      value: number | string;
      unit?: string;
    }

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