Skip to main content
Glama
fritzprix

Rubik's Cube MCP Server

by fritzprix

startCube

Initialize a Rubik's Cube game session with customizable scramble options for AI agents to solve puzzles using standard notation moves.

Instructions

Initialize a new Rubik's Cube game session

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
scrambleNoWhether to scramble the cube initially
difficultyNoNumber of scramble moves (1-100)

Implementation Reference

  • Executes the startCube tool: creates a new game session with RubiksCube, scrambles if requested, sets up visualization, generates game ID and UI 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) }
        ]
      };
    }
  • Zod input schema for the startCube tool parameters.
    {
      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:28-80 (registration)
    Registers the startCube tool with the MCP server, specifying name, description, input schema, and handler function.
      "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) }
          ]
        };
      }
    );
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool initializes a session but doesn't cover key aspects like whether this creates persistent state, requires authentication, has side effects, or returns session details, which are critical for a mutation tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's purpose without unnecessary words. It's front-loaded and wastes no space, earning full marks for conciseness.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of a game session tool with no annotations and no output schema, the description is incomplete. It fails to explain what the tool returns (e.g., session ID, cube state) or behavioral traits like side effects, leaving significant gaps for an AI agent.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, clearly documenting both parameters. The description doesn't add any meaning beyond the schema, such as explaining how 'scramble' and 'difficulty' interact or default behaviors. Baseline 3 is appropriate since the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Initialize') and resource ('a new Rubik's Cube game session'), making the purpose understandable. However, it doesn't explicitly differentiate from sibling tools like 'joinGame' or 'manipulateCube', which prevents a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'joinGame' or 'manipulateCube'. It lacks context about prerequisites or scenarios for starting a new session, leaving usage unclear.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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