Skip to main content
Glama

gridstack_get_grid_items

Retrieve all items from a GridStack.js dashboard layout, with an option to filter for only visible widgets to manage dynamic grid content.

Instructions

Get all grid items

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
onlyVisibleNoOnly return visible items

Implementation Reference

  • The primary handler function for the 'gridstack_get_grid_items' tool. It destructures the input parameters and uses GridStackUtils to generate executable JavaScript code that calls GridStack's getGridItems() method, optionally filtering for visible items only.
    private async getGridItems(params: GetGridItemsParams): Promise<string> {
      const { onlyVisible = false } = params;
    
      return this.utils.generateGridStackCode("getGridItems", {
        onlyVisible,
        code: `const items = grid.getGridItems(${onlyVisible});`,
      });
    }
  • Tool registration entry in the listTools() method, defining the tool's name, description, and JSON input schema for MCP tool discovery and validation.
    {
      name: "gridstack_get_grid_items",
      description: "Get all grid items",
      inputSchema: {
        type: "object",
        properties: {
          onlyVisible: {
            type: "boolean",
            description: "Only return visible items",
            default: false,
          },
        },
      },
    },
  • Dispatch registration in the callTool switch statement, casting arguments to the correct type and invoking the handler method.
    case "gridstack_get_grid_items":
      return this.getGridItems(args as GetGridItemsParams);
  • TypeScript type definition for the tool's input parameters, used for type safety in the handler.
    export interface GetGridItemsParams {
      onlyVisible?: boolean;
    }
  • Supporting utility method called by the handler to format the response with generated code, parameters, description, example, and notes specific to the 'getGridItems' operation.
    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, the description carries full burden but only states the action without disclosing behavioral traits like permissions needed, rate limits, or what 'all grid items' entails (e.g., pagination, format). It's minimal and leaves key operational details unclear.

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, front-loaded and appropriately sized for its simple purpose. It earns its place by stating the core action clearly.

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 no annotations, no output schema, and a simple tool with one parameter, the description is incomplete—it doesn't explain what 'grid items' are, the return format, or any constraints. For a retrieval tool, more context is needed to be fully helpful.

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 input schema fully documents the 'onlyVisible' parameter. The description adds no additional meaning beyond what the schema provides, meeting the baseline for high coverage without extra value.

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

Purpose3/5

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

The description 'Get all grid items' clearly states the action (get) and resource (grid items), but it's vague about scope and doesn't distinguish from siblings like 'gridstack_load' or 'gridstack_save' which might also retrieve items. It's adequate but lacks specificity.

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 such as 'gridstack_load' or 'gridstack_save', which might handle grid items differently. The description implies a retrieval operation but offers no context or exclusions.

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