Skip to main content
Glama

add_pushable_rock

Add pushable rocks to Ice Puzzle levels at specified coordinates to create obstacles and movement challenges for puzzle solving.

Instructions

Add pushable rocks

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
positionsYesPositions for pushable rocks

Implementation Reference

  • The add_pushable_rock tool handler that validates input, checks positions, and calls the store method to add pushable rocks to the draft
    { name: 'add_pushable_rock', description: 'Add pushable rocks that can be pushed one square by the player', inputSchema: { type: 'object', properties: { positions: { type: 'array', items: { type: 'object', properties: { x: { type: 'number' }, y: { type: 'number' } }, required: ['x', 'y'] }, description: 'Array of positions to place pushable rocks' } }, required: ['positions'] }, handler: async (args: { positions: Position[] }) => { const error = checkActiveDraft(); if (error) { return { content: [{ type: 'text', text: error }] }; } const draft = draftStore.getCurrentDraft()!; for (const pos of args.positions) { const validationError = checkPositionValid(pos.x, pos.y, draft.gridWidth, draft.gridHeight); if (validationError) { return { content: [{ type: 'text', text: validationError }] }; } } draftStore.addPushableRock(args.positions); const result = autoSolveAndVisualize(); return { content: [{ type: 'text', text: `Added pushable rock(s) at ${args.positions.length} position(s)\n\n${result}` }] }; }
  • The addPushableRock store method that performs the actual state update - dedupes positions, clears existing items at those positions, and updates the draft with new pushable rocks
    addPushableRock(positions: Position[]): DraftState { if (!this.currentDraft) { throw new Error('No current draft'); } this.pushHistorySnapshot(); return this.runWithHistorySuspended(() => { const incoming = this.dedupePositions(positions); for (const position of incoming) { this.clearPosition(position.x, position.y); } const pushableRocks = this.dedupePositions([...this.currentDraft!.pushableRocks, ...incoming]); return this.updateDraft({ pushableRocks }, { trackHistory: false }); }); }
  • Input schema for add_pushable_rock tool - defines positions array with x, y coordinates
    inputSchema: { type: 'object', properties: { positions: { type: 'array', items: { type: 'object', properties: { x: { type: 'number' }, y: { type: 'number' } }, required: ['x', 'y'] }, description: 'Array of positions to place pushable rocks' } }, required: ['positions'] },
  • Export function that registers all special element tools including add_pushable_rock
    export function getSpecialElementTools(): ToolDefinition[] { return [ {
  • Helper functions used by the handler - checkActiveDraft validates a draft exists, checkPositionValid validates coordinates are within grid bounds
    function checkActiveDraft(): string | null { const draft = draftStore.getCurrentDraft(); if (!draft) { return 'No active draft. Use create_level first.'; } return null; } function checkPositionValid(x: number, y: number, width: number, height: number): string | null { const result = validatePosition(x, y, width, height); if (!result.valid) { return result.error || `Position (${x}, ${y}) is out of bounds for ${width}x${height} grid`; } return null; }

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