add_thin_ice
Add breakable thin ice tiles to puzzle levels that disappear after being crossed, creating temporary pathways and strategic challenges for players.
Instructions
Add thin ice tiles (break after crossing)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| positions | Yes | Positions for thin ice |
Implementation Reference
- src/tools/special-elements.ts:143-188 (handler)Main MCP tool handler for 'add_thin_ice'. Defines tool name, description, input schema, and the async handler function that validates positions, calls draftStore.addThinIce, and returns results with solver visualization.{ name: 'add_thin_ice', description: 'Add thin ice tiles that break after the player crosses them', 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 thin ice' } }, 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.addThinIce(args.positions); const result = autoSolveAndVisualize(); return { content: [{ type: 'text', text: `Added thin ice at ${args.positions.length} position(s)\n\n${result}` }] }; }
- src/tools/special-elements.ts:52-53 (registration)Tool registration: The add_thin_ice tool is exported via getSpecialElementTools() function which returns an array of tool definitions.export function getSpecialElementTools(): ToolDefinition[] { return [
- Input schema definition for add_thin_ice tool. Specifies that it requires a 'positions' array containing objects with 'x' and 'y' number properties.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 thin ice' } }, required: ['positions'] },
- src/core/types.ts:3-6 (schema)Position type definition used by the add_thin_ice tool. Defines the structure with x and y number properties.export interface Position { x: number; y: number; }
- src/store/draft-store.ts:629-644 (handler)Core implementation of addThinIce method. Validates current draft, pushes history, clears existing tiles at positions, deduplicates new positions, and updates the draft with thinIceTiles.addThinIce(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 thinIceTiles = this.dedupePositions([...this.currentDraft!.thinIceTiles, ...incoming]); return this.updateDraft({ thinIceTiles }, { trackHistory: false }); }); }