Skip to main content
Glama

gridstack_add_grid

Create a new dynamic grid layout with customizable widgets and options for building responsive dashboards using GridStack.js functionality.

Instructions

Create a new grid with options and children (static method)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
parentYesParent element selector
optNoGrid options including children

Implementation Reference

  • The handler function that implements the core logic for the 'gridstack_add_grid' tool. It extracts parameters and generates JavaScript code using GridStackUtils to call the static GridStack.addGrid method, creating a new grid instance.
    private async addGrid(params: any): Promise<string> {
      const { parent, opt = {} } = params;
    
      return this.utils.generateGridStackCode("addGrid", {
        parent,
        options: opt,
        code: `const grid = GridStack.addGrid('${parent}', ${JSON.stringify(
          opt,
          null,
          2
        )});`,
      });
    }
  • The input schema and tool definition for 'gridstack_add_grid', defining required parameters like parent selector and optional grid options.
    {
      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",
              },
            },
          },
        },
      },
    },
  • Registration of the tool handler in the central callTool switch statement, dispatching calls to the addGrid method.
    case "gridstack_add_grid":
      return this.addGrid(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. It mentions 'static method' but doesn't explain what that implies (e.g., no instance required, side effects). It fails to cover critical aspects like whether this is a read or write operation, if it modifies the DOM, or what happens on errors.

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

Conciseness4/5

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

The description is a single, efficient sentence that front-loads the main action ('Create a new grid'). However, the phrase 'static method' is ambiguous and could be clarified or omitted for better clarity without losing essential information.

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?

Given the complexity (2 parameters with nested objects, no output schema, and no annotations), the description is inadequate. It doesn't explain the return value, error handling, or how this tool interacts with the DOM or other grid operations, leaving significant gaps for an AI agent to understand its full behavior.

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 ('parent' and 'opt'). The description adds minimal value by hinting at 'options and children', which aligns with the schema but doesn't provide additional syntax or usage details beyond what's in the structured fields.

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 action ('Create a new grid') and mentions key elements ('options and children'), which distinguishes it from siblings like 'gridstack_init' or 'gridstack_load'. However, it doesn't explicitly differentiate from 'gridstack_add_widget' or explain what 'static method' means in this context.

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?

No guidance is provided on when to use this tool versus alternatives like 'gridstack_init' for initialization or 'gridstack_add_widget' for adding individual widgets. The description lacks context about prerequisites or typical scenarios for creating a grid with children.

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