Skip to main content
Glama

gridstack_move_widget

Reposition widgets within GridStack dashboards by specifying new X and Y coordinates to adjust layout organization.

Instructions

Move a widget to a new position

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
elYesWidget selector or ID to move
xNoNew X position
yNoNew Y position

Implementation Reference

  • The primary handler function that implements the core logic for the 'gridstack_move_widget' tool. It destructures the input parameters (el, x, y) and generates the GridStack JavaScript code to move the widget using grid.move() via the utils.generateGridStackCode method.
    private async moveWidget(params: MoveWidgetParams): Promise<string> { const { el, x, y } = params; return this.utils.generateGridStackCode("moveWidget", { element: el, position: { x, y }, code: `grid.move('${String(el)}', ${x}, ${y});`, }); }
  • The input schema definition for the gridstack_move_widget tool, specifying required 'el' parameter and optional 'x' and 'y' positions.
    { name: "gridstack_move_widget", description: "Move a widget to a new position", inputSchema: { type: "object", required: ["el"], properties: { el: { type: "string", description: "Widget selector or ID to move", }, x: { type: "number", description: "New X position", }, y: { type: "number", description: "New Y position", }, }, }, },
  • Registration and dispatching of the gridstack_move_widget tool in the callTool method's switch statement, casting args to MoveWidgetParams and calling the handler.
    case "gridstack_move_widget": return this.moveWidget(args as MoveWidgetParams);
  • TypeScript interface defining the input parameters for the moveWidget handler (el required, x and y optional).
    export interface MoveWidgetParams { el: string | HTMLElement; x?: number; y?: number; }
  • Utility helper method used by the handler to format and generate the standardized response including code, description, example, and notes for the move 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); }

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