Skip to main content
Glama
fritzprix
by fritzprix

startCube

Initialize a new Rubik's Cube game session with the option to scramble the cube initially. Manage puzzle-solving progress using standard notation moves and real-time 3D visualization.

Instructions

Initialize a new Rubik's Cube game session

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
scrambleNoWhether to scramble the cube initially

Implementation Reference

  • Handler function that implements the startCube tool logic: generates game ID, initializes RubiksCube, scrambles if requested, creates and stores game session, registers visualization, returns cube state and UI game link.
    async ({ scramble = true, difficulty = 20 }: { scramble?: boolean; difficulty?: number }) => { const gameId = `cube_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`; const cube = new RubiksCube(); if (scramble) { cube.scramble(difficulty); } const session: GameSession = { id: gameId, cubeState: cube.getState(), createdAt: Date.now(), lastActivity: Date.now(), status: 'active', scrambleMoves: difficulty }; this.games.set(gameId, { cube, session }); this.visualizationServer.registerSession(session); const currentState = cube.getState(); const response: CubeResponse = { gameId, cube: currentState, scrambleMoves: difficulty, nextAction: currentState.solved ? "finish" : "manipulateCube" }; // MCP UI 리소스 생성 (예: 게임 링크) const gameUrl = `http://localhost:3000/game/${gameId}`; const uiResponse = { type: "resource", resource: { uri: `ui://game-link/${gameId}`, mimeType: "text/html", text: `<a href="${gameUrl}" target="_blank">Click to Play!</a>` } } as const; return { content: [ uiResponse, { type: "text", text: JSON.stringify(response, null, 2) } ] }; }
  • Input schema using Zod for startCube tool parameters: optional scramble (boolean) and difficulty (number 1-100).
    { scramble: z.boolean().optional().describe("Whether to scramble the cube initially"), difficulty: z.number().min(1).max(100).optional().describe("Number of scramble moves (1-100)") },
  • src/app.ts:27-80 (registration)
    MCP tool registration for startCube, specifying name, description, input schema, and handler function.
    this.mcpServer.tool( "startCube", "Initialize a new Rubik's Cube game session", { scramble: z.boolean().optional().describe("Whether to scramble the cube initially"), difficulty: z.number().min(1).max(100).optional().describe("Number of scramble moves (1-100)") }, async ({ scramble = true, difficulty = 20 }: { scramble?: boolean; difficulty?: number }) => { const gameId = `cube_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`; const cube = new RubiksCube(); if (scramble) { cube.scramble(difficulty); } const session: GameSession = { id: gameId, cubeState: cube.getState(), createdAt: Date.now(), lastActivity: Date.now(), status: 'active', scrambleMoves: difficulty }; this.games.set(gameId, { cube, session }); this.visualizationServer.registerSession(session); const currentState = cube.getState(); const response: CubeResponse = { gameId, cube: currentState, scrambleMoves: difficulty, nextAction: currentState.solved ? "finish" : "manipulateCube" }; // MCP UI 리소스 생성 (예: 게임 링크) const gameUrl = `http://localhost:3000/game/${gameId}`; const uiResponse = { type: "resource", resource: { uri: `ui://game-link/${gameId}`, mimeType: "text/html", text: `<a href="${gameUrl}" target="_blank">Click to Play!</a>` } } as const; return { content: [ uiResponse, { type: "text", text: JSON.stringify(response, null, 2) } ] }; } );

Other Tools

Related 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