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
| Name | Required | Description | Default |
|---|---|---|---|
| gameId | Yes | The game session ID to join |
Implementation Reference
- src/app.ts:89-111 (handler)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) }, ], }; }
- src/app.ts:86-88 (schema)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) }, ], }; } );