Skip to main content
Glama

gridstack_make_widget

Convert existing DOM elements into interactive grid widgets for building dynamic dashboard layouts with customizable positioning and sizing options.

Instructions

Convert an existing DOM element into a grid widget

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
elYesElement selector to convert
optionsNoWidget options

Implementation Reference

  • The primary handler function for the 'gridstack_make_widget' tool. It destructures the input parameters (el and options), constructs the appropriate GridStack JavaScript code using template literals, and delegates response formatting to the GridStackUtils helper.
    private async makeWidget(params: any): Promise<string> { const { el, options = {} } = params; return this.utils.generateGridStackCode("makeWidget", { element: el, options, code: `grid.makeWidget('${el}', ${JSON.stringify(options, null, 2)});`, }); }
  • Tool registration entry in the listTools() method of GridStackTools class, defining the tool's name, description, and comprehensive input schema for MCP integration.
    { name: "gridstack_make_widget", description: "Convert an existing DOM element into a grid widget", inputSchema: { type: "object", required: ["el"], properties: { el: { type: "string", description: "Element selector to convert", }, options: { type: "object", description: "Widget options", properties: { x: { type: "number" }, y: { type: "number" }, w: { type: "number" }, h: { type: "number" }, autoPosition: { type: "boolean" }, minW: { type: "number" }, maxW: { type: "number" }, minH: { type: "number" }, maxH: { type: "number" }, locked: { type: "boolean" }, noResize: { type: "boolean" }, noMove: { type: "boolean" }, }, }, }, }, },
  • Dispatch handler in the callTool switch statement that routes calls to the specific makeWidget implementation.
    case "gridstack_make_widget": return this.makeWidget(args);
  • Utility function called by all tool handlers, including makeWidget, to standardize the response format with operation details, generated code, descriptions, examples, and notes.
    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); }
  • Description string for the makeWidget operation used in response generation.
    makeWidget: "Convert an existing DOM element into a grid widget",

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