Skip to main content
Glama

gridstack_remove_widget

Remove widgets from dynamic dashboards by specifying a selector or ID. Optionally delete from DOM and trigger removal events for responsive grid layouts.

Instructions

Remove a widget from the grid

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
elYesWidget selector or ID to remove
removeDOMNoRemove from DOM as well
triggerEventNoTrigger 'removed' event

Implementation Reference

  • The core handler function that implements the logic for the 'gridstack_remove_widget' tool. It extracts parameters and generates the GridStack.js code to remove the specified widget.
    private async removeWidget(params: RemoveWidgetParams): Promise<string> {
      const { el, removeDOM = true, triggerEvent = true } = params;
    
      return this.utils.generateGridStackCode("removeWidget", {
        element: el,
        removeDOM,
        triggerEvent,
        code: `grid.removeWidget('${String(
          el
        )}', ${removeDOM}, ${triggerEvent});`,
      });
    }
  • Input schema definition for the 'gridstack_remove_widget' tool, defining parameters el, removeDOM, and triggerEvent.
    inputSchema: {
      type: "object",
      required: ["el"],
      properties: {
        el: {
          type: "string",
          description: "Widget selector or ID to remove",
        },
        removeDOM: {
          type: "boolean",
          description: "Remove from DOM as well",
          default: true,
        },
        triggerEvent: {
          type: "boolean",
          description: "Trigger 'removed' event",
          default: true,
        },
      },
    },
  • Registration in the callTool switch statement, dispatching to the removeWidget handler.
    case "gridstack_remove_widget":
      return this.removeWidget(args as RemoveWidgetParams);
  • Tool registration in the listTools() method, including name, description, and schema.
    {
      name: "gridstack_remove_widget",
      description: "Remove a widget from the grid",
      inputSchema: {
        type: "object",
        required: ["el"],
        properties: {
          el: {
            type: "string",
            description: "Widget selector or ID to remove",
          },
          removeDOM: {
            type: "boolean",
            description: "Remove from DOM as well",
            default: true,
          },
          triggerEvent: {
            type: "boolean",
            description: "Trigger 'removed' event",
            default: true,
          },
        },
      },
    },
  • TypeScript interface definition for RemoveWidgetParams used in the handler.
    export interface RemoveWidgetParams {
      el: string | HTMLElement;
      removeDOM?: boolean;
      triggerEvent?: boolean;
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool removes a widget but doesn't clarify permissions needed, whether the removal is reversible, effects on grid layout, or error handling. This is inadequate for a mutation tool with zero annotation coverage, as critical behavioral traits are omitted.

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 that directly states the tool's purpose without unnecessary words. It is front-loaded and wastes no space, making it easy for an agent to parse quickly while conveying the core action.

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 tool's complexity as a mutation operation with no annotations and no output schema, the description is insufficient. It lacks details on behavioral aspects (e.g., side effects, error conditions) and doesn't explain return values or usage context relative to siblings, leaving significant gaps for an agent to operate effectively.

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%, with clear documentation for all three parameters in the input schema. The description adds no additional parameter semantics beyond what's already in the schema, such as examples or edge cases. This meets the baseline score of 3, as the schema adequately covers parameter details without extra description 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 action ('Remove') and target ('a widget from the grid'), providing a specific verb+resource combination. However, it doesn't explicitly differentiate from sibling tools like 'gridstack_remove_all' or 'gridstack_destroy', which also remove widgets or grid elements, leaving some ambiguity about when to choose this specific tool.

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. With siblings like 'gridstack_remove_all' (removes all widgets) and 'gridstack_destroy' (destroys the entire grid), there's no indication of prerequisites, exclusions, or comparative contexts, leaving the agent to infer usage from tool names 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