Skip to main content
Glama
Vic563
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'], },

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