ms_get_state
Check the current board state in the tic-tac-toe game. This action does not consume a turn.
Instructions
Survey the current state of the minefield. Free — does not cost a step.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/games/minesweeper.ts:337-344 (handler)The ms_get_state tool handler — returns the current rendered state of the minefield at no cost (no step consumed). Simply calls renderState(msGame) and returns it as text content.
server.tool( "ms_get_state", "Survey the current state of the minefield. Free — does not cost a step.", {}, async () => ({ content: [{ type: "text", text: renderState(msGame) }], }) ); - src/games/minesweeper.ts:337-344 (registration)Registration of ms_get_state via server.tool() inside registerMinesweeperTools(). No input schema (empty object {}) because the tool just returns state.
server.tool( "ms_get_state", "Survey the current state of the minefield. Free — does not cost a step.", {}, async () => ({ content: [{ type: "text", text: renderState(msGame) }], }) ); - src/games/minesweeper.ts:143-167 (helper)renderState() helper — builds the full text representation of the game state (board + legend + status) used by ms_get_state.
function renderState(state: MinesweeperState): string { const safe = ROWS * COLS - TOTAL_MINES; const cleared = state.revealedCount; const remaining = safe - cleared; const lines: string[] = [renderBoard(state), ``]; lines.push(`Legend: ~ uncharted . safe path 1-8 danger level P warning post ! mine`); lines.push(`Mission: clear all ${safe} safe squares so the Flufflings can cross | ${MOVES_PER_TURN} steps/turn then call ms_next_turn`); lines.push(``); lines.push(`Warning posts: ${state.flagCount}/${TOTAL_MINES} | Uncharted squares: ${remaining + state.flagCount} | Turn: ${state.turnNumber}`); if (state.status === "in_progress") { lines.push(`Steps this turn: ${state.movesThisTurn}/${state.maxMovesThisTurn} (${state.maxMovesThisTurn - state.movesThisTurn} remaining)`); } else if (state.status === "paused") { lines.push(`⏸ The Flufflings are resting (${state.movesThisTurn}/${state.maxMovesThisTurn} steps used). Check in with your player, then call ms_next_turn to continue.`); } else if (state.status === "won") { lines.push(`🎉 The field is clear! Every Fluffling scampers to safety!`); } else if (state.status === "lost") { lines.push(`💥 A Fluffling triggered a mine! The crossing has failed. Mines shown with !`); } else if (state.status === "waiting") { lines.push(`The Flufflings are gathered at the edge, trembling. Send the first scout with ms_reveal_cell — the first step is always safe.`); } return lines.join("\n"); } - src/index.ts:17-20 (registration)Top-level call to registerMinesweeperTools(server) which registers all minesweeper tools including ms_get_state.
registerMinesweeperTools(server); registerBattleshipTools(server); registerOregonTrailTools(server); registerCritterCatchTools(server);