Skip to main content
Glama

gridstack_load

Load grid layouts from JSON data to restore dashboard configurations, add new widgets, and remove missing ones for dynamic layout management.

Instructions

Load grid layout from JSON

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
layoutYesLayout data (JSON array or string)
addAndRemoveNoAdd new widgets and remove missing ones

Implementation Reference

  • The primary handler function for the 'gridstack_load' tool. It processes the input parameters, formats the layout data, generates the GridStack.js 'grid.load()' code snippet, and uses the utility to format a complete response with description, example, and notes.
    private async load(params: LoadGridParams): Promise<string> {
      const { layout, addAndRemove = true } = params;
    
      const layoutData =
        typeof layout === "string" ? layout : JSON.stringify(layout, null, 2);
      const codeString = `grid.load(${layoutData}, ${addAndRemove});`;
    
      return this.utils.generateGridStackCode("load", {
        layout: layoutData,
        addAndRemove,
        code: codeString,
      });
    }
  • The tool registration entry in listTools(), including the name, description, and complete input JSON schema for validation.
    {
      name: "gridstack_load",
      description: "Load grid layout from JSON",
      inputSchema: {
        type: "object",
        required: ["layout"],
        properties: {
          layout: {
            oneOf: [
              {
                type: "array",
                items: {
                  type: "object",
                  description: "Widget configuration",
                },
              },
              { type: "string" },
            ],
            description: "Layout data (JSON array or string)",
          },
          addAndRemove: {
            type: "boolean",
            description: "Add new widgets and remove missing ones",
            default: true,
          },
        },
      },
    },
  • TypeScript interface defining the expected input parameters, matching the JSON schema, used for type safety in the handler.
    export interface LoadGridParams {
      layout: GridStackWidget[] | string;
      addAndRemove?: boolean;
    }
  • The helper method that formats the final response for all tools, including documentation, parameters, code example, and notes specific to the 'load' operation.
      private formatResponse(result: GridStackCodeResult): string {
        let response = `## GridStack ${result.operation}
    
    ${result.description}
    
    ### Generated Code:
    \`\`\`javascript
    ${result.code}
    \`\`\``;
    
        if (result.parameters && Object.keys(result.parameters).length > 0) {
          response += `
    
    ### Parameters:
    \`\`\`json
    ${JSON.stringify(result.parameters, null, 2)}
    \`\`\``;
        }
    
        if (result.example) {
          response += `
    
    ### Example:
    \`\`\`javascript
    ${result.example}
    \`\`\``;
        }
    
        if (result.notes && result.notes.length > 0) {
          response += `
    
    ### Notes:
    ${result.notes.map((note) => `- ${note}`).join("\n")}`;
        }
    
        return response;
      }
  • Core utility method called by all tool handlers to generate standardized markdown responses with operation-specific descriptions, examples, and notes for 'load'.
    generateGridStackCode(operation: string, params: any): string {
      const result: GridStackCodeResult = {
        operation,
        parameters: params,
        code: params.code || "",
        description: this.getOperationDescription(operation),
        example: this.getOperationExample(operation),
        notes: this.getOperationNotes(operation),
      };
    
      return this.formatResponse(result);
    }
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 states the action but doesn't explain what 'Load' entails—whether it overwrites existing layouts, requires initialization first, or has side effects. This leaves critical behavioral traits unspecified for a mutation 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, efficient sentence with zero wasted words. It's front-loaded and directly conveys the core action, making it easy 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 mutation tool with no annotations and no output schema, the description is insufficient. It doesn't explain the result of loading (e.g., visual updates, error handling) or how it interacts with other grid operations, leaving gaps in understanding the tool's full context.

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 fully documents the parameters. The description adds no additional meaning beyond implying JSON input, which is already covered in the schema. This meets the baseline for high schema coverage without extra value.

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 ('Load') and resource ('grid layout from JSON'), making the purpose immediately understandable. It doesn't explicitly distinguish from siblings like 'gridstack_save' or 'gridstack_init', but the action is specific enough to infer basic differentiation.

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 initial setup or 'gridstack_save' for saving layouts. The description lacks context about prerequisites or typical scenarios for loading layouts.

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