Skip to main content
Glama

ms_reveal_cell

Reveal a cell in Minesweeper by sending a scout to (row, col); if no mines nearby, surrounding cells open automatically. Uses one step.

Instructions

Send a Fluffling scout to a square at (row, col). If it's clear of nearby mines, the surrounding area cascades open automatically. Counts as one step this turn.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
rowYesRow index: 0 = top row, 8 = bottom row
colYesColumn index: 0 = left col, 8 = right col

Implementation Reference

  • Registration of the ms_reveal_cell tool on the MCP server, in the registerMinesweeperTools function.
    );
    
    server.tool(
  • Zod schema for the tool's input: row and col as integers between 0 and 8.
    {
      row: z.number().int().min(0).max(8).describe("Row index: 0 = top row, 8 = bottom row"),
      col: z.number().int().min(0).max(8).describe("Column index: 0 = left col, 8 = right col"),
    },
  • Handler function that executes the ms_reveal_cell logic: validates game state, places mines on first move, reveals cell with BFS cascade, checks for mine hits, win conditions, and turn limits.
    async ({ row, col }) => {
      if (msGame.status === "won" || msGame.status === "lost") {
        return { content: [{ type: "text", text: `The crossing is over (${msGame.status}). Call ms_new_game to try again.` }], isError: true };
      }
      if (msGame.status === "paused") {
        return { content: [{ type: "text", text: `⏸ The Flufflings are resting. Check in with your player then call ms_next_turn to continue.\n\n${renderState(msGame)}` }], isError: true };
      }
      if (msGame.revealed[row][col]) {
        return { content: [{ type: "text", text: `A Fluffling already scouted (row ${row}, col ${col}). Pick somewhere new.\n\n${renderState(msGame)}` }], isError: true };
      }
      if (msGame.flagged[row][col]) {
        return { content: [{ type: "text", text: `There's a warning post at (row ${row}, col ${col})! Remove it with ms_flag_cell before sending a scout.\n\n${renderState(msGame)}` }], isError: true };
      }
    
      // First move: place mines now, guaranteeing this cell is safe
      if (msGame.status === "waiting") {
        placeMines(row, col, msGame);
        msGame.status = "in_progress";
        msGame.turnNumber = 1;
      }
    
      // Hit a mine?
      if (msGame.mines[row][col]) {
        msGame.status = "lost";
        return {
          content: [{
            type: "text",
            text: `💥 Oh no! A Fluffling triggered a mine at (row ${row}, col ${col})! The crossing has failed.\n\n${renderState(msGame)}`,
          }],
        };
      }
    
      // Safe — cascade reveal
      floodReveal(msGame, row, col);
      msGame.movesThisTurn++;
    
      // Win check
      if (checkWin(msGame)) {
        msGame.status = "won";
        return {
          content: [{
            type: "text",
            text: `🎉 The last safe path is cleared at (row ${row}, col ${col})! The Flufflings scamper across the finish line, terrified but alive!\n\n${renderState(msGame)}`,
          }],
        };
      }
    
      applyTurnLimit(msGame);
      return {
        content: [{
          type: "text",
          text: `Scout sent to (row ${row}, col ${col}) — path clear!\n\n${renderState(msGame)}`,
        }],
      };
    }
  • Helper to count adjacent mines for a given cell, used by floodReveal to determine cascade boundaries.
    function countAdjacentMines(mines: boolean[][], row: number, col: number): number {
      let count = 0;
      for (let dr = -1; dr <= 1; dr++) {
        for (let dc = -1; dc <= 1; dc++) {
          if (dr === 0 && dc === 0) continue;
          const r = row + dr, c = col + dc;
          if (r >= 0 && r < ROWS && c >= 0 && c < COLS && mines[r][c]) count++;
        }
      }
      return count;
    }
  • BFS flood-fill helper that reveals all connected empty cells and their numeric borders, called by the ms_reveal_cell handler when a safe cell is clicked.
    function floodReveal(state: MinesweeperState, startRow: number, startCol: number): void {
      // BFS cascade: reveal all connected zero-adj cells and their numeric borders.
      const queue: [number, number][] = [[startRow, startCol]];
      const visited = new Set<string>();
    
      while (queue.length > 0) {
        const [r, c] = queue.shift()!;
        const key = `${r},${c}`;
        if (visited.has(key)) continue;
        visited.add(key);
    
        if (r < 0 || r >= ROWS || c < 0 || c >= COLS) continue;
        if (state.revealed[r][c] || state.flagged[r][c]) continue;
    
        state.revealed[r][c] = true;
        state.revealedCount++;
    
        // Only cascade from cells with zero adjacent mines
        if (countAdjacentMines(state.mines, r, c) === 0) {
          for (let dr = -1; dr <= 1; dr++) {
            for (let dc = -1; dc <= 1; dc++) {
              if (dr === 0 && dc === 0) continue;
              queue.push([r + dr, c + dc]);
            }
          }
        }
      }
    }
Behavior3/5

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

Discloses the step cost and cascade behavior on clear cells, but omits the critical outcome when a mine is hit (likely game over). No annotation support.

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?

Two sentences, front-loaded with action, no redundant information. Highly efficient.

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

Completeness3/5

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

Covers action and step cost but lacks outcome on mine or preconditions (e.g., cell unrevealed). Incomplete for safe autonomous use.

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 coverage is 100% with clear parameter descriptions. The description adds no extra semantic value beyond the schema.

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 tool reveals a cell via a 'Fluffling scout' and describes the cascade effect when safe. It differentiates from sibling tools like ms_flag_cell by focusing on revealing.

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

Usage Guidelines3/5

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

The description implies usage for revealing cells but does not explicitly contrast with alternatives (e.g., flagging). No when-not-to-use guidance.

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/SrmTech-git/MCPArcade'

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