Skip to main content
Glama
Vic563

Minesweeper MCP Server

by Vic563

create_board

Create a custom-sized Minesweeper board by specifying width, height, and number of mines for gameplay.

Instructions

Create a new Minesweeper board with specified dimensions and mine count

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesUnique identifier for the board
widthYesWidth of the board (number of columns)
heightYesHeight of the board (number of rows)
mineCountYesNumber of mines to place on the board

Implementation Reference

  • Handler for the 'create_board' tool call: extracts parameters, creates the board using MinesweeperGame, gets display, and returns formatted success response with legend.
    case 'create_board': {
      const { id, width, height, mineCount } = args as {
        id: string;
        width: number;
        height: number;
        mineCount: number;
      };
    
      const board = this.game.createBoard(id, width, height, mineCount);
      const display = this.game.getBoardDisplay(id);
    
      return {
        content: [
          {
            type: 'text',
            text: `Successfully created Minesweeper board '${id}'!\n\n${display}\n\nLegend:\n. = Hidden cell\nF = Flagged cell\n* = Mine (revealed)\n1-8 = Number of neighboring mines\n(space) = Empty cell with no neighboring mines`,
          },
        ],
      };
    }
  • src/index.ts:49-79 (registration)
    Registration of the 'create_board' tool in the ListTools response, including name, description, and detailed input schema with validation.
    {
      name: 'create_board',
      description: 'Create a new Minesweeper board with specified dimensions and mine count',
      inputSchema: {
        type: 'object',
        properties: {
          id: {
            type: 'string',
            description: 'Unique identifier for the board',
          },
          width: {
            type: 'number',
            description: 'Width of the board (number of columns)',
            minimum: 1,
            maximum: 50,
          },
          height: {
            type: 'number',
            description: 'Height of the board (number of rows)',
            minimum: 1,
            maximum: 50,
          },
          mineCount: {
            type: 'number',
            description: 'Number of mines to place on the board',
            minimum: 0,
          },
        },
        required: ['id', 'width', 'height', 'mineCount'],
      },
    },
  • Core implementation of board creation: validates inputs, initializes grid, randomly places mines using generateMinePositions, computes neighbor mine counts, creates and stores GameBoard.
    createBoard(id: string, width: number, height: number, mineCount: number): GameBoard {
      if (width < 1 || height < 1) {
        throw new Error('Board dimensions must be at least 1x1');
      }
      if (mineCount < 0 || mineCount >= width * height) {
        throw new Error('Mine count must be between 0 and total cells - 1');
      }
    
      const cells: Cell[][] = [];
      
      // Initialize empty board
      for (let y = 0; y < height; y++) {
        cells[y] = [];
        for (let x = 0; x < width; x++) {
          cells[y][x] = {
            isMine: false,
            isRevealed: false,
            isFlagged: false,
            neighborMines: 0,
            x,
            y
          };
        }
      }
    
      // Place mines randomly
      const minePositions = this.generateMinePositions(width, height, mineCount);
      for (const [x, y] of minePositions) {
        cells[y][x].isMine = true;
      }
    
      // Calculate neighbor mine counts
      for (let y = 0; y < height; y++) {
        for (let x = 0; x < width; x++) {
          if (!cells[y][x].isMine) {
            cells[y][x].neighborMines = this.countNeighborMines(cells, x, y, width, height);
          }
        }
      }
    
      const board: GameBoard = {
        id,
        width,
        height,
        mineCount,
        cells,
        gameState: 'playing',
        startTime: Date.now()
      };
    
      this.boards.set(id, board);
      return board;
    }
  • Input schema for 'create_board' tool defining parameters with types, descriptions, constraints (min/max), and required fields.
    inputSchema: {
      type: 'object',
      properties: {
        id: {
          type: 'string',
          description: 'Unique identifier for the board',
        },
        width: {
          type: 'number',
          description: 'Width of the board (number of columns)',
          minimum: 1,
          maximum: 50,
        },
        height: {
          type: 'number',
          description: 'Height of the board (number of rows)',
          minimum: 1,
          maximum: 50,
        },
        mineCount: {
          type: 'number',
          description: 'Number of mines to place on the board',
          minimum: 0,
        },
      },
      required: ['id', 'width', 'height', 'mineCount'],
    },
Behavior2/5

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

No annotations are provided, so the description carries the full burden. It states the tool creates a board but lacks details on behavioral traits such as permissions needed, whether the creation is idempotent, error conditions (e.g., invalid mine count relative to board size), or what happens if a board with the same ID exists. This is a significant gap for a creation tool with zero annotation coverage.

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 any unnecessary words. It is appropriately sized and front-loaded, making it easy to understand quickly.

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 creation tool with no annotations and no output schema, the description is incomplete. It does not explain what the tool returns (e.g., the created board object or success status), error handling, or important behavioral aspects like idempotency or validation rules, leaving gaps for the agent to infer.

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?

Schema description coverage is 100%, so the schema fully documents all four parameters. The description adds minimal value by mentioning 'dimensions and mine count', which aligns with the schema but does not provide additional syntax, format, or constraints beyond what is already specified in the schema descriptions and bounds.

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

Purpose5/5

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

The description clearly states the specific action ('Create a new Minesweeper board') and specifies the resources involved ('with specified dimensions and mine count'). It distinguishes from sibling tools like 'delete_board', 'get_board', and 'list_boards' by focusing on creation rather than deletion, retrieval, or listing.

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. It does not mention prerequisites, constraints, or compare it to sibling tools like 'list_boards' or 'get_board' for context. Usage is implied only by the action of creation.

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/Vic563/mindsweeper-mcp'

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