Skip to main content
Glama
Vic563

Minesweeper MCP Server

by Vic563

list_boards

Retrieve all active Minesweeper game boards to track ongoing games and manage gameplay sessions.

Instructions

List all active Minesweeper boards

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main handler for the 'list_boards' tool within the CallToolRequestSchema switch statement. It calls game.getAllBoards(), formats a descriptive list of active boards including dimensions, mine count, game state, and duration if finished, and returns formatted text content.
    case 'list_boards': {
      const boards = this.game.getAllBoards();
      
      if (boards.length === 0) {
        return {
          content: [
            {
              type: 'text',
              text: 'No active Minesweeper boards found.',
            },
          ],
        };
      }
    
      let message = `Active Minesweeper Boards (${boards.length}):\n\n`;
      for (const board of boards) {
        const duration = board.endTime 
          ? Math.round((board.endTime - board.startTime) / 1000)
          : Math.round((Date.now() - board.startTime) / 1000);
        
        message += `• ${board.id}: ${board.width}x${board.height}, ${board.mineCount} mines, ${board.gameState}`;
        if (board.gameState !== 'playing') {
          message += ` (${duration}s)`;
        }
        message += '\n';
      }
    
      return {
        content: [
          {
            type: 'text',
            text: message,
          },
        ],
      };
    }
  • The tool definition including name, description, and input schema (empty object since no parameters) as part of the tools list returned by ListToolsRequestHandler.
    {
      name: 'list_boards',
      description: 'List all active Minesweeper boards',
      inputSchema: {
        type: 'object',
        properties: {},
      },
    },
  • Supporting method in MinesweeperGame class that retrieves and returns an array of all active GameBoard instances stored in the internal Map.
    getAllBoards(): GameBoard[] {
      return Array.from(this.boards.values());
    }

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