Skip to main content
Glama

create_level

Create a new empty ice puzzle level by specifying dimensions and name for designing sliding block challenges.

Instructions

Create a new empty ice puzzle level

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesLevel name
widthNoGrid width (5-25, default 10)
heightNoGrid height (5-25, default 10)

Implementation Reference

  • Complete tool registration for create_level including name, description, input schema, and handler function.
    {
      name: 'create_level',
      description: 'Create a new empty ice puzzle level. This becomes the current working draft.',
      inputSchema: {
        type: 'object',
        properties: {
          name: { type: 'string', description: 'Level name' },
          width: { type: 'number', description: 'Grid width (5-25, default 10)', minimum: 5, maximum: 25 },
          height: { type: 'number', description: 'Grid height (5-25, default 10)', minimum: 5, maximum: 25 },
        },
        required: ['name'],
      },
      handler: async (args) => {
        const draft = draftStore.createDraft(args.name, args.width, args.height);
        const viz = renderLevel(draft, { showCoords: true });
        return { content: [{ type: 'text', text: `Level "${args.name}" created!\n\n${formatDraftSummary(draft)}\n\n${viz}` }] };
      },
    },
  • Input schema defining the accepted arguments: name (required string), width (optional number 5-25, default 10), height (optional number 5-25, default 10).
    inputSchema: {
      type: 'object',
      properties: {
        name: { type: 'string', description: 'Level name' },
        width: { type: 'number', description: 'Grid width (5-25, default 10)', minimum: 5, maximum: 25 },
        height: { type: 'number', description: 'Grid height (5-25, default 10)', minimum: 5, maximum: 25 },
      },
      required: ['name'],
    },
  • Handler function that creates a new level draft using draftStore.createDraft() and returns a formatted response with level summary and visualization.
    handler: async (args) => {
      const draft = draftStore.createDraft(args.name, args.width, args.height);
      const viz = renderLevel(draft, { showCoords: true });
      return { content: [{ type: 'text', text: `Level "${args.name}" created!\n\n${formatDraftSummary(draft)}\n\n${viz}` }] };
    },
  • The createDraft method in DraftStore that initializes a new DraftState with default positions (bottom-left start, top-right goal), empty obstacles/warps, and resets history.
    createDraft(name: string, width: number = 10, height: number = 10): DraftState {
      this.warpCounter = 1;
      this.undoStack = [];
      this.redoStack = [];
      this.lastSolvableSnapshot = null;
      const draft: DraftState = {
        id: null,
        previewId: null,
        name,
        description: '',
        gridWidth: width,
        gridHeight: height,
        par: 0,
        startPosition: { x: 1, y: height - 2 }, // bottom-left
        goalPosition: { x: width - 2, y: 1 }, // top-right
        obstacles: [],
        warpPairs: [],
        thinIceTiles: [],
        pushableRocks: [],
        pressurePlate: null,
        barrier: null,
        manualSolveMechanicsBaseline: null,
        manualSolveFingerprint: null,
        isDirty: false,
        lastSolverResult: null,
      };
      this.currentDraft = draft;
      return draft;
    }
  • formatDraftSummary helper function used by the handler to display level information including grid size, par, start/goal positions, obstacles, warps, and solver status.
    function formatDraftSummary(draft: DraftState): string {
      const solverInfo = draft.lastSolverResult
        ? formatSolverResult(draft.lastSolverResult)
        : 'Not yet solved';
      return [
        `Name: ${draft.name}`,
        `Grid: ${draft.gridWidth}x${draft.gridHeight}`,
        `Par: ${draft.par > 0 ? draft.par : 'not set'}`,
        `Start: (${draft.startPosition.x}, ${draft.startPosition.y})`,
        `Goal: (${draft.goalPosition.x}, ${draft.goalPosition.y})`,
        `Obstacles: ${draft.obstacles.length}`,
        `Warps: ${draft.warpPairs.length} pairs`,
        `Thin Ice: ${draft.thinIceTiles.length}`,
        `Pushable Rocks: ${draft.pushableRocks.length}`,
        draft.pressurePlate ? `Pressure Plate: (${draft.pressurePlate.x}, ${draft.pressurePlate.y})` : '',
        draft.barrier ? `Barrier: (${draft.barrier.x}, ${draft.barrier.y})` : '',
        `Solver: ${solverInfo}`,
      ].filter(Boolean).join('\n');
    }

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/wmoten/ice-puzzle-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server