Skip to main content
Glama

edit_level_tile

Modify a specific tile in a VibeTide 2D platformer level by specifying its position and new tile type to customize level design.

Instructions

Edit a single tile in a VibeTide level.

Args:
    encoded_level: An encoded level string from a URL or sharing link
    row: Row index (0-based, from top)
    col: Column index (0-based, from left)
    new_tile_type: New tile type (0-7, see tile legend)

Returns the modified level data with the single tile changed.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
encoded_levelYes
rowYes
colYes
new_tile_typeYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The core handler function for the 'edit_level_tile' MCP tool. It decodes the input encoded level string, validates row, column, and new tile type parameters, modifies the specific tile in the 2D tiles array, re-encodes the level, generates a visualization and play URL, and returns the updated level data. The @mcp.tool() decorator handles both registration and schema definition via the docstring.
    @mcp.tool()
    async def edit_level_tile(
        encoded_level: str, row: int, col: int, new_tile_type: int
    ) -> Dict[str, Any]:
        """Edit a single tile in a VibeTide level.
    
        Args:
            encoded_level: An encoded level string from a URL or sharing link
            row: Row index (0-based, from top)
            col: Column index (0-based, from left)
            new_tile_type: New tile type (0-7, see tile legend)
    
        Returns the modified level data with the single tile changed.
        """
        try:
            # Decode the level first
            try:
                level_data = level_encoder.decode(encoded_level)
            except Exception as e:
                return {
                    "success": False,
                    "error": f"Failed to decode level: {str(e)}",
                }
    
            tiles = level_data["tiles"]
            if not isinstance(tiles, list) or not tiles:
                return {"success": False, "error": "Invalid tiles array"}
    
            height = len(tiles)
            width = len(tiles[0]) if tiles else 0
    
            # Validate coordinates
            if row < 0 or row >= height:
                return {
                    "success": False,
                    "error": f"Invalid row {row} - must be 0-{height-1}",
                }
    
            if col < 0 or col >= width:
                return {
                    "success": False,
                    "error": f"Invalid column {col} - must be 0-{width-1}",
                }
    
            # Validate tile type
            if new_tile_type < 0 or new_tile_type > 7:
                return {
                    "success": False,
                    "error": f"Invalid tile type {new_tile_type} - must be 0-7",
                }
    
            # Make the edit
            old_tile_type = tiles[row][col]
            tiles[row][col] = new_tile_type
    
            # Create new level data
            edited_level = level_data.copy()
            edited_level["tiles"] = tiles
    
            # Generate encoded version
            try:
                encoded_level = level_encoder.encode(edited_level)
                play_url = f"{VIBE_TIDE_CONFIG['web_player_url']}?level={encoded_level}"
            except Exception as e:
                logger.warning(f"Failed to encode edited level: {e}")
                encoded_level = None
                play_url = None
    
            # Generate visualization
            visualization = visualize_level(edited_level)
    
            old_tile_name = TILE_TYPES.get(old_tile_type, {"name": "Unknown"})["name"]
            new_tile_name = TILE_TYPES.get(new_tile_type, {"name": "Unknown"})["name"]
    
            return {
                "success": True,
                "level_data": edited_level,
                "encoded_level": encoded_level,
                "play_url": play_url,
                "visualization": visualization,
                "change_summary": f"Changed tile at ({row}, {col}) from {old_tile_name} to {new_tile_name}",
                "message": f"Successfully edited tile at position ({row}, {col})",
            }
    
        except Exception as e:
            logger.error(f"Failed to edit level tile: {e}")
            return {"success": False, "error": f"Failed to edit level tile: {str(e)}"}
  • The docstring of the handler defines the input schema (parameters: encoded_level (str), row (int), col (int), new_tile_type (int)) and output description for the MCP tool.
    """Edit a single tile in a VibeTide level.
    
    Args:
        encoded_level: An encoded level string from a URL or sharing link
        row: Row index (0-based, from top)
        col: Column index (0-based, from left)
        new_tile_type: New tile type (0-7, see tile legend)
    
    Returns the modified level data with the single tile changed.
    """
  • Global TILE_TYPES dictionary referenced in the handler for tile names and descriptions used in change_summary and validation context.
    TILE_TYPES = {
        0: {"name": "Empty", "symbol": "⬜", "description": "Walkable air space"},
        1: {"name": "Grass", "symbol": "🌱", "description": "Standard ground platform"},
        2: {"name": "Rock", "symbol": "🗿", "description": "Solid stone platform"},
        3: {"name": "Yellow", "symbol": "⭐", "description": "Special yellow platform"},
        4: {"name": "Ice", "symbol": "❄️", "description": "Slippery ice platform"},
        5: {"name": "Red", "symbol": "🔥", "description": "Dangerous red platform"},
        6: {"name": "Spikes", "symbol": "⚠️", "description": "Hazardous spikes"},
        7: {"name": "Water", "symbol": "💧", "description": "Water tiles"},
    }
  • Global instance of LevelEncoder class used by the handler for decoding and encoding level data.
    level_encoder = LevelEncoder()
Behavior3/5

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

With no annotations provided, the description carries full burden. It discloses the tool modifies a level (implied mutation) and returns modified data, but lacks details on permissions, side effects, error conditions, or rate limits. The behavioral disclosure is basic but adequate for the core operation.

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 efficiently structured with a clear purpose statement followed by parameter explanations and return value. Every sentence adds value, with no redundant or unnecessary information. The formatting with Args/Returns sections enhances readability without verbosity.

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

Completeness4/5

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

Given 4 parameters with 0% schema coverage and an output schema present, the description provides good parameter context and states the return purpose. It covers the essential what/how for a tile-editing operation, though could benefit from more behavioral details given the mutation nature and lack of annotations.

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

Parameters4/5

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

Schema description coverage is 0%, so the description must compensate. It provides meaningful context for all 4 parameters: encoded_level source, row/col indexing (0-based), and new_tile_type range/legend reference. This adds substantial value beyond the bare schema, though tile legend details aren't fully explained.

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

Purpose5/5

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

The description clearly states the specific action ('Edit a single tile'), target resource ('in a VibeTide level'), and distinguishes from siblings like edit_entire_level, edit_level_row, and edit_level_metadata by specifying it's for a single tile. The verb+resource combination is precise and unambiguous.

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

Usage Guidelines3/5

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

The description implies usage when modifying individual tiles in a level, but doesn't explicitly state when to use this vs. alternatives like edit_entire_level or edit_level_row. No guidance on prerequisites or exclusions is provided, leaving usage context partially inferred rather than clearly defined.

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/banjtheman/vibe_tide_mcp'

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