Skip to main content
Glama

add_warp_pair

Create a warp portal pair connecting two positions in Ice Puzzle levels to enable teleportation between specified coordinates for puzzle design.

Instructions

Add a warp portal pair connecting two positions

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
x1YesFirst warp X
y1YesFirst warp Y
x2YesSecond warp X
y2YesSecond warp Y

Implementation Reference

  • The MCP tool handler for 'add_warp_pair' that validates inputs, checks for conflicts with start/goal positions, calls draftStore.addWarpPair(), and returns an ASCII visualization of the updated level.
    handler: async (args: { x1: number; y1: number; x2: number; y2: number }) => {
      const error = checkActiveDraft();
      if (error) {
        return { content: [{ type: 'text', text: error }] };
      }
    
      const draft = draftStore.getCurrentDraft()!;
    
      // Validate both positions
      const error1 = checkPositionValid(args.x1, args.y1, draft.gridWidth, draft.gridHeight);
      if (error1) {
        return { content: [{ type: 'text', text: error1 }] };
      }
    
      const error2 = checkPositionValid(args.x2, args.y2, draft.gridWidth, draft.gridHeight);
      if (error2) {
        return { content: [{ type: 'text', text: error2 }] };
      }
    
      // Check not on start/goal
      if ((args.x1 === draft.startPosition.x && args.y1 === draft.startPosition.y) ||
          (args.x2 === draft.startPosition.x && args.y2 === draft.startPosition.y)) {
        return { content: [{ type: 'text', text: 'Cannot place warp on start position' }] };
      }
    
      if ((args.x1 === draft.goalPosition.x && args.y1 === draft.goalPosition.y) ||
          (args.x2 === draft.goalPosition.x && args.y2 === draft.goalPosition.y)) {
        return { content: [{ type: 'text', text: 'Cannot place warp on goal position' }] };
      }
    
      // Check not same position
      if (args.x1 === args.x2 && args.y1 === args.y2) {
        return { content: [{ type: 'text', text: 'Warp positions must be different' }] };
      }
    
      draftStore.addWarpPair(args.x1, args.y1, args.x2, args.y2);
      const warpId = `warp_${Date.now()}`;
      const result = autoSolveAndVisualize();
    
      return {
        content: [{
          type: 'text',
          text: `Added warp pair ${warpId}: (${args.x1},${args.y1}) ↔ (${args.x2},${args.y2})\n\n${result}`
        }]
      };
    }
  • The core implementation method that creates a warp pair. It clears any existing elements at both positions, generates a unique warp ID, creates the WarpPair object, and updates the draft state with history tracking.
    addWarpPair(x1: number, y1: number, x2: number, y2: number): DraftState {
      if (!this.currentDraft) {
        throw new Error('No current draft');
      }
    
      this.pushHistorySnapshot();
      return this.runWithHistorySuspended(() => {
        this.clearPosition(x1, y1);
        this.clearPosition(x2, y2);
    
        const id = `warp_${this.warpCounter++}`;
        const warpPair: WarpPair = {
          id,
          positions: [
            { x: x1, y: y1 },
            { x: x2, y: y2 },
          ],
        };
    
        const warpPairs = [...this.currentDraft!.warpPairs, warpPair];
        return this.updateDraft({ warpPairs }, { trackHistory: false });
      });
    }
  • The tool registration block that defines the 'add_warp_pair' tool name, description, and input schema with four required numeric parameters (x1, y1, x2, y2).
    {
      name: 'add_warp_pair',
      description: 'Create a warp pair that teleports the player between two positions',
      inputSchema: {
        type: 'object',
        properties: {
          x1: { type: 'number', description: 'X coordinate of first warp' },
          y1: { type: 'number', description: 'Y coordinate of first warp' },
          x2: { type: 'number', description: 'X coordinate of second warp' },
          y2: { type: 'number', description: 'Y coordinate of second warp' }
        },
        required: ['x1', 'y1', 'x2', 'y2']
      },
  • The TypeScript type definition for WarpPair that defines the structure of a warp pair with an ID and array of positions.
    export interface WarpPair {
      id: string;
      positions: Position[];
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. 'Add' implies a mutation/write operation, but the description doesn't specify permissions needed, whether this affects game state immediately, what happens if positions conflict with existing elements, or any side effects. For a mutation tool with zero annotation coverage, this is insufficient.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that communicates the core functionality without any wasted words. It's appropriately sized for a simple tool and front-loads the essential information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a mutation tool with no annotations and no output schema, the description is inadequate. It doesn't explain what happens after adding the warp pair, whether there's confirmation or error handling, coordinate system details, or how this integrates with other level editing operations. The context signals show this is a complex server with many sibling tools, making the lack of contextual guidance more problematic.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all four parameters (x1, y1, x2, y2) as coordinate pairs. The description adds minimal value beyond the schema by implying these represent 'two positions' but doesn't explain coordinate systems, units, or relationships between the pairs beyond what's in the schema descriptions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Add a warp portal pair') and the resource ('connecting two positions'), making the purpose immediately understandable. It doesn't distinguish from sibling tools like 'remove_warp' or other placement tools, but the verb+resource combination is specific enough for basic understanding.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'place_tile' or 'remove_warp'. There's no mention of prerequisites, constraints, or typical scenarios for adding warp pairs versus other level editing operations.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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