Skip to main content
Glama
fritzprix

Rubik's Cube MCP Server

by fritzprix

joinGame

Connect to an existing Rubik's Cube game session using a session ID to participate in collaborative puzzle solving with real-time 3D visualization.

Instructions

Join an existing Rubik's Cube game session

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
gameIdYesThe game session ID to join

Implementation Reference

  • Executes the joinGame tool logic: retrieves the game session by ID, fetches current cube state, constructs response, and returns formatted content.
    async ({ gameId }: { gameId: string }) => {
      const game = this.games.get(gameId);
      if (!game) {
        throw new Error(`Game session ${gameId} not found`);
      }
    
      const { cube, session } = game;
      const currentState = cube.getState();
    
      const response: CubeResponse = {
        gameId,
        cube: currentState,
        scrambleMoves: session.scrambleMoves,
        nextAction: currentState.solved ? "finish" : "manipulateCube",
      };
    
      return {
        content: [
          { type: "text", text: "Joined game successfully." },
          { type: "text", text: JSON.stringify(response, null, 2) },
        ],
      };
    }
  • Input schema definition using Zod for the joinGame tool, requiring a gameId string parameter.
    {
      gameId: z.string().describe("The game session ID to join"),
    },
  • src/app.ts:83-112 (registration)
    Registers the joinGame MCP tool with name, description, input schema, and handler function on the MCP server.
    this.mcpServer.tool(
      "joinGame",
      "Join an existing Rubik's Cube game session",
      {
        gameId: z.string().describe("The game session ID to join"),
      },
      async ({ gameId }: { gameId: string }) => {
        const game = this.games.get(gameId);
        if (!game) {
          throw new Error(`Game session ${gameId} not found`);
        }
    
        const { cube, session } = game;
        const currentState = cube.getState();
    
        const response: CubeResponse = {
          gameId,
          cube: currentState,
          scrambleMoves: session.scrambleMoves,
          nextAction: currentState.solved ? "finish" : "manipulateCube",
        };
    
        return {
          content: [
            { type: "text", text: "Joined game successfully." },
            { type: "text", text: JSON.stringify(response, null, 2) },
          ],
        };
      }
    );

Tool Description Quality Score

Score is being calculated. Check back soon.

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/fritzprix/rubiks-cube-mcp-server'

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