finish
Complete a Rubik's Cube solving session by providing the game session ID to finalize the puzzle solution process.
Instructions
Complete the Rubik's Cube game session
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| gameId | Yes | The game session ID |
Implementation Reference
- src/app.ts:186-214 (handler)Handler function for the 'finish' MCP tool that completes the Rubik's Cube game session by marking it as completed, checking if solved, generating a congratulatory or failure message, and returning the final cube state with MCP-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 finalState = cube.getState(); session.status = 'completed'; session.lastActivity = Date.now(); const response: CubeResponse = { gameId, cube: finalState, nextAction: null, }; const message = finalState.solved ? `π Congratulations! You solved the cube for game ${gameId}.` : `Game ${gameId} finished. The cube was not solved.` return { content: [ { type: "text", text: message }, { type: "text", text: JSON.stringify(response, null, 2) }, ], }; }
- src/app.ts:183-185 (schema)Input schema for the 'finish' tool defined using Zod, requiring a 'gameId' string parameter.{ gameId: z.string().describe("The game session ID") },
- src/app.ts:180-182 (registration)Registration of the 'finish' MCP tool on the server, providing the tool name and description.this.mcpServer.tool( "finish", "Complete the Rubik's Cube game session",