Skip to main content
Glama
Vic563
by Vic563

flag_cell

Mark or clear flags on Minesweeper board cells to identify suspected mine locations and prevent accidental clicks during gameplay.

Instructions

Flag or unflag a cell on the Minesweeper board

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
boardIdYesID of the board
xYesX coordinate (column) of the cell to flag
yYesY coordinate (row) of the cell to flag

Implementation Reference

  • Core handler function that toggles the flag status on the specified cell, with validation for board existence, game state, coordinates, and revealed cells.
    flagCell(boardId: string, x: number, y: number): GameBoard { const board = this.boards.get(boardId); if (!board) { throw new Error(`Board with id ${boardId} not found`); } if (board.gameState !== 'playing') { throw new Error('Game is already finished'); } if (x < 0 || x >= board.width || y < 0 || y >= board.height) { throw new Error('Invalid cell coordinates'); } const cell = board.cells[y][x]; if (cell.isRevealed) { throw new Error('Cannot flag a revealed cell'); } cell.isFlagged = !cell.isFlagged; return board; }
  • MCP server tool handler for 'flag_cell' that extracts arguments, calls the game flagCell method, retrieves the board display, and formats the response.
    case 'flag_cell': { const { boardId, x, y } = args as { boardId: string; x: number; y: number; }; this.game.flagCell(boardId, x, y); const display = this.game.getBoardDisplay(boardId); return { content: [ { type: 'text', text: `Toggled flag at cell (${x}, ${y})\n\n${display}`, }, ], }; }
  • src/index.ts:104-127 (registration)
    Registration of the 'flag_cell' tool in the MCP server's listTools handler, including name, description, and input schema.
    { name: 'flag_cell', description: 'Flag or unflag a cell on the Minesweeper board', inputSchema: { type: 'object', properties: { boardId: { type: 'string', description: 'ID of the board', }, x: { type: 'number', description: 'X coordinate (column) of the cell to flag', minimum: 0, }, y: { type: 'number', description: 'Y coordinate (row) of the cell to flag', minimum: 0, }, }, required: ['boardId', 'x', 'y'], }, },
  • Input schema definition for the 'flag_cell' tool validating boardId, x, and y parameters.
    inputSchema: { type: 'object', properties: { boardId: { type: 'string', description: 'ID of the board', }, x: { type: 'number', description: 'X coordinate (column) of the cell to flag', minimum: 0, }, y: { type: 'number', description: 'Y coordinate (row) of the cell to flag', minimum: 0, }, }, required: ['boardId', 'x', 'y'], },

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