ms_new_game
Initialize a new Fluffling minefield game with a 9x9 grid and 10 mines. The first move is safe as mines are placed after.
Instructions
Start a new Fluffling minefield crossing. 9×9 field, 10 hidden mines. The first step is always safe — mines are placed after it. Call ms_reveal_cell to send the first scout.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/games/minesweeper.ts:175-203 (handler)The async handler function for the 'ms_new_game' tool. It resets the game state by calling newMsState(), then returns a welcome message and the initial rendered board (all uncharted terrain). No input parameters required.
async () => { msGame = newMsState(); return { content: [{ type: "text", text: [ `🐾 THE FLUFFLINGS NEED YOUR HELP 🐾`, ``, `A colony of small, round, perpetually worried creatures stands at the edge of a minefield.`, `They need to reach the other side. You are their guide.`, ``, `Chart safe paths, plant warning posts at suspected mines, and get every`, `Fluffling across alive. One wrong step and it's over.`, ``, `Controls:`, ` • ms_reveal_cell — scout a square (first step always safe; cascades through open areas)`, ` • ms_flag_cell — plant a warning post (P) on a suspected mine`, ` • ms_next_turn — the Flufflings rest and check in; resets the step counter`, ` • ms_get_state — survey the field at no cost`, ``, `Clear all 71 safe squares to win. Warning posts are optional.`, ``, `[Show this intro and the field below verbatim to the human.]`, ``, renderState(msGame), ].join("\n"), }], }; } - src/games/minesweeper.ts:171-204 (registration)Tool registration for 'ms_new_game' via server.tool(). Registered with name 'ms_new_game', a description, an empty schema object (no parameters), and the async handler function.
server.tool( "ms_new_game", "Start a new Fluffling minefield crossing. 9×9 field, 10 hidden mines. The first step is always safe — mines are placed after it. Call ms_reveal_cell to send the first scout.", {}, async () => { msGame = newMsState(); return { content: [{ type: "text", text: [ `🐾 THE FLUFFLINGS NEED YOUR HELP 🐾`, ``, `A colony of small, round, perpetually worried creatures stands at the edge of a minefield.`, `They need to reach the other side. You are their guide.`, ``, `Chart safe paths, plant warning posts at suspected mines, and get every`, `Fluffling across alive. One wrong step and it's over.`, ``, `Controls:`, ` • ms_reveal_cell — scout a square (first step always safe; cascades through open areas)`, ` • ms_flag_cell — plant a warning post (P) on a suspected mine`, ` • ms_next_turn — the Flufflings rest and check in; resets the step counter`, ` • ms_get_state — survey the field at no cost`, ``, `Clear all 71 safe squares to win. Warning posts are optional.`, ``, `[Show this intro and the field below verbatim to the human.]`, ``, renderState(msGame), ].join("\n"), }], }; } ); - src/games/minesweeper.ts:29-41 (helper)newMsState() — creates a fresh MinesweeperState with all arrays cleared, status='waiting', and movesThisTurn/maxMovesThisTurn initialized. Called by the ms_new_game handler.
function newMsState(): MinesweeperState { return { mines: Array.from({ length: ROWS }, () => Array(COLS).fill(false)), revealed: Array.from({ length: ROWS }, () => Array(COLS).fill(false)), flagged: Array.from({ length: ROWS }, () => Array(COLS).fill(false)), status: "waiting", flagCount: 0, revealedCount: 0, movesThisTurn: 0, maxMovesThisTurn: MOVES_FIRST_TURN, turnNumber: 0, }; } - src/index.ts:17-20 (registration)Top-level entry point: calls registerMinesweeperTools(server) to register all Minesweeper tools (including ms_new_game) on the MCP server.
registerMinesweeperTools(server); registerBattleshipTools(server); registerOregonTrailTools(server); registerCritterCatchTools(server);