Skip to main content
Glama

gridstack_on

Add event listeners to monitor changes in dynamic dashboard layouts, including widget drag, resize, add, remove, and enable/disable operations for responsive grid systems.

Instructions

Add event listener

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
eventNameYesEvent name to listen for
callbackYesJavaScript callback function code

Implementation Reference

  • Registration of the 'gridstack_on' tool, including name, description, and detailed input schema for eventName (enum of GridStack events) and callback (JS code string).
    { name: "gridstack_on", description: "Add event listener", inputSchema: { type: "object", required: ["eventName", "callback"], properties: { eventName: { type: "string", enum: [ "added", "change", "disable", "drag", "dragstart", "dragstop", "dropped", "enable", "removed", "resize", "resizestart", "resizestop", ], description: "Event name to listen for", }, callback: { type: "string", description: "JavaScript callback function code", }, }, }, },
  • Dispatch case in callTool method that routes 'gridstack_on' calls to the addEventListener handler.
    case "gridstack_on": return this.addEventListener(args);
  • Core handler implementation that destructures params and generates JavaScript code snippet `grid.on(eventName, callback)` using the GridStackUtils helper, which wraps it for execution.
    private async addEventListener(params: any): Promise<string> { const { eventName, callback } = params; return this.utils.generateGridStackCode("addEventListener", { eventName, callback, code: `grid.on('${eventName}', ${callback});`, });

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