play_level
Generate a web player URL to preview and test VibeTide 2D platformer levels using encoded level data for immediate gameplay visualization.
Instructions
Get the URL to play a VibeTide level in the web player.
Args:
encoded_level: An encoded level string for playing
Returns a URL to play the level.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| encoded_level | Yes |
Implementation Reference
- vibe_tide_mcp_server.py:694-727 (handler)The primary handler for the 'play_level' tool. Decorated with @mcp.tool() for automatic registration in FastMCP. Decodes the encoded_level to extract the level name and constructs the play URL using the configured web player base URL. Includes schema definition in the docstring for input (encoded_level: str) and output structure.@mcp.tool() async def play_level(encoded_level: str) -> Dict[str, Any]: """Get the URL to play a VibeTide level in the web player. Args: encoded_level: An encoded level string for playing Returns a URL to play the level. """ try: # Decode level to get name try: level_data = level_encoder.decode(encoded_level) level_name = level_data.get("name", "Unnamed Level") except Exception as e: return {"success": False, "error": f"Invalid encoded level: {str(e)}"} play_url = f"{VIBE_TIDE_CONFIG['web_player_url']}?level={encoded_level}" return { "success": True, "play_url": play_url, "level_name": level_name, "web_player_url": VIBE_TIDE_CONFIG["web_player_url"], "message": f"Ready to play '{level_name}' at: {play_url}", } except Exception as e: logger.error(f"Failed to prepare level for playing: {e}") return { "success": False, "error": f"Failed to prepare level for playing: {str(e)}", }