Skip to main content
Glama

gridstack_make_widget

Convert existing DOM elements into interactive grid widgets for dashboard layouts. Specify element selector and positioning options to integrate components into responsive drag-and-drop grid systems.

Instructions

Convert an existing DOM element into a grid widget

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
elYesElement selector to convert
optionsNoWidget options

Implementation Reference

  • Handler function that implements the gridstack_make_widget tool logic by generating the appropriate GridStack.js code snippet.
    private async makeWidget(params: any): Promise<string> {
      const { el, options = {} } = params;
    
      return this.utils.generateGridStackCode("makeWidget", {
        element: el,
        options,
        code: `grid.makeWidget('${el}', ${JSON.stringify(options, null, 2)});`,
      });
    }
  • Input schema definition and description for the gridstack_make_widget tool.
    {
      name: "gridstack_make_widget",
      description: "Convert an existing DOM element into a grid widget",
      inputSchema: {
        type: "object",
        required: ["el"],
        properties: {
          el: {
            type: "string",
            description: "Element selector to convert",
          },
          options: {
            type: "object",
            description: "Widget options",
            properties: {
              x: { type: "number" },
              y: { type: "number" },
              w: { type: "number" },
              h: { type: "number" },
              autoPosition: { type: "boolean" },
              minW: { type: "number" },
              maxW: { type: "number" },
              minH: { type: "number" },
              maxH: { type: "number" },
              locked: { type: "boolean" },
              noResize: { type: "boolean" },
              noMove: { type: "boolean" },
            },
          },
        },
      },
    },
  • The tool is registered in the listTools() method's return array.
      // Advanced Features
      {
        name: "gridstack_make_widget",
        description: "Convert an existing DOM element into a grid widget",
        inputSchema: {
          type: "object",
          required: ["el"],
          properties: {
            el: {
              type: "string",
              description: "Element selector to convert",
            },
            options: {
              type: "object",
              description: "Widget options",
              properties: {
                x: { type: "number" },
                y: { type: "number" },
                w: { type: "number" },
                h: { type: "number" },
                autoPosition: { type: "boolean" },
                minW: { type: "number" },
                maxW: { type: "number" },
                minH: { type: "number" },
                maxH: { type: "number" },
                locked: { type: "boolean" },
                noResize: { type: "boolean" },
                noMove: { type: "boolean" },
              },
            },
          },
        },
      },
    
      {
        name: "gridstack_remove_all",
        description: "Remove all widgets from the grid",
        inputSchema: {
          type: "object",
          properties: {
            removeDOM: {
              type: "boolean",
              description: "Remove DOM elements",
              default: true,
            },
          },
        },
      },
    
      {
        name: "gridstack_get_margin",
        description: "Get current margin values",
        inputSchema: {
          type: "object",
          properties: {},
        },
      },
    
      {
        name: "gridstack_get_column",
        description: "Get current number of columns",
        inputSchema: {
          type: "object",
          properties: {},
        },
      },
    
      {
        name: "gridstack_get_float",
        description: "Get current float state",
        inputSchema: {
          type: "object",
          properties: {},
        },
      },
    
      {
        name: "gridstack_add_grid",
        description:
          "Create a new grid with options and children (static method)",
        inputSchema: {
          type: "object",
          required: ["parent"],
          properties: {
            parent: {
              type: "string",
              description: "Parent element selector",
            },
            opt: {
              type: "object",
              description: "Grid options including children",
              properties: {
                children: {
                  type: "array",
                  items: {
                    type: "object",
                    description: "Child widget configuration",
                  },
                  description: "Array of child widgets to load",
                },
              },
            },
          },
        },
      },
    ];
  • Dispatch registration in the callTool switch statement routing to the handler.
    case "gridstack_make_widget":
      return this.makeWidget(args);
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It states the action ('convert') but doesn't explain what this transformation entails (e.g., whether it modifies the DOM element's properties, adds interactivity, or integrates it into a grid layout). It lacks details on side effects, error conditions, or what 'grid widget' means functionally.

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, efficient sentence with zero waste. It's front-loaded with the core action and resource, making it easy to parse quickly without unnecessary elaboration.

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 mutation tool (converting DOM elements) with no annotations and no output schema, the description is incomplete. It doesn't cover what happens after conversion (e.g., how the widget behaves, return values, or error handling), leaving significant gaps for an agent to understand the tool's full impact.

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?

Schema description coverage is 100%, so the schema already documents both parameters ('el' as element selector and 'options' as widget options with sub-properties). The description adds no additional meaning beyond the schema, such as explaining what 'convert' implies for these parameters or providing examples. Baseline 3 is appropriate when schema does the heavy lifting.

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 verb ('convert') and resource ('existing DOM element into a grid widget'), making the purpose understandable. It distinguishes this from siblings like 'gridstack_add_widget' (which likely creates new widgets) and 'gridstack_update_widget' (which modifies existing widgets), though it doesn't explicitly name these alternatives.

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 like 'gridstack_add_widget' or 'gridstack_update_widget'. It doesn't mention prerequisites (e.g., needing an existing DOM element) or exclusions, leaving the agent to infer usage from context 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