Skip to main content
Glama
Vic563

Minesweeper MCP Server

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'],
    },
Behavior2/5

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

With no annotations provided, the description carries full burden but offers minimal behavioral insight. It states the action but doesn't disclose whether flagging is reversible, if it affects game state (like mine detection), what happens if coordinates are invalid, or any error conditions. For a mutation tool with zero annotation coverage, this leaves significant gaps.

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 extremely concise - a single sentence that directly states the tool's function without any wasted words. It's front-loaded with the core action and resource, making it immediately understandable despite its brevity.

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?

For a mutation tool with no annotations and no output schema, the description is insufficiently complete. It doesn't explain what 'flag or unflag' means in gameplay terms, what the visual/state change represents, whether there are limitations (like flagging revealed cells), or what the expected outcome is. Given the complexity of game state manipulation, more context is needed.

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 all parameters are documented in the schema. The description doesn't add any meaningful parameter semantics beyond what's already in the schema (board ID, x/y coordinates). It doesn't explain coordinate systems, valid ranges beyond the schema's minimum, or how flagging interacts with board state.

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 ('flag or unflag') and resource ('a cell on the Minesweeper board'), making the purpose immediately understandable. However, it doesn't explicitly differentiate from sibling tools like 'reveal_cell' beyond the different verb, missing an opportunity to clarify the distinction between flagging and revealing operations.

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 'reveal_cell' or other board manipulation tools. There's no mention of typical Minesweeper gameplay context, such as using flags to mark suspected mines or unflagging when uncertain.

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