Skip to main content
Glama

ttt_get_state

Retrieve the current Tic-Tac-Toe game state, including board, status, player names, and legal moves.

Instructions

Get the current Tic-Tac-Toe board, status, player names, and legal moves.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Registration of the 'ttt_get_state' tool via server.tool(), with description and empty schema.
    server.tool(
      "ttt_get_state",
      "Get the current Tic-Tac-Toe board, status, player names, and legal moves.",
      {},
      async () => ({
        content: [{ type: "text", text: renderState(game) }],
      })
    );
  • Handler function that returns the rendered state of the current game by calling renderState(game).
    async () => ({
      content: [{ type: "text", text: renderState(game) }],
    })
  • The renderState() helper function that formats the board, status, player names, and legal moves into a text response.
    function renderState(g: GameState): string {
      const cell = (c: Cell) => (c === null ? " " : c);
      const lines = [
        `         col 0   col 1   col 2`,
        `row 0      ${cell(g.board[0][0])}   |   ${cell(g.board[0][1])}   |   ${cell(g.board[0][2])}`,
        `          -----+-------+-----`,
        `row 1      ${cell(g.board[1][0])}   |   ${cell(g.board[1][1])}   |   ${cell(g.board[1][2])}`,
        `          -----+-------+-----`,
        `row 2      ${cell(g.board[2][0])}   |   ${cell(g.board[2][1])}   |   ${cell(g.board[2][2])}`,
        ``,
        `Players:  X = ${g.playerX}  |  O = ${g.playerO}`,
        `Status:   ${g.status}`,
      ];
    
      if (g.status === "in_progress") {
        const currentName = g.currentPlayer === "X" ? g.playerX : g.playerO;
        lines.push(`Next move: ${g.currentPlayer} (${currentName})`);
        const legal = getLegalMoves(g.board)
          .map(([r, c]) => `(row ${r}, col ${c})`)
          .join("  ");
        lines.push(`Legal moves: ${legal}`);
      } else if (g.status === "x_wins" || g.status === "o_wins") {
        const winnerName = g.status === "x_wins" ? g.playerX : g.playerO;
        const winnerMark = g.status === "x_wins" ? "X" : "O";
        lines.push(`Winner: ${winnerMark} (${winnerName})`);
        if (g.winningLine) {
          const wl = g.winningLine.map(([r, c]) => `(row ${r}, col ${c})`).join(", ");
          lines.push(`Winning line: ${wl}`);
        }
      } else if (g.status === "draw") {
        lines.push("Result: It's a draw!");
      }
    
      lines.push(`\n[Show the board above verbatim to the human player — they need the row/col labels to know where to move.]`);
    
      return lines.join("\n");
    }
  • src/index.ts:16-16 (registration)
    Top-level registration call that passes the server to registerTicTacToeTools(), which registers ttt_get_state.
    registerTicTacToeTools(server);
Behavior2/5

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

No annotations provided, and the description does not disclose behavioral traits such as whether the tool is read-only, side effects, or safety considerations. It only lists return values without addressing potential mutations or permissions.

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?

Single sentence, no extraneous information, concise and directly to the point.

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

Completeness4/5

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

Given no output schema, the description lists the key return components (board, status, player names, legal moves) which is fairly complete for a simple state tool. Minor omission of data types or format but acceptable.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Input schema has zero parameters, so description need not add parameter info. Baseline for 0 params is 4; description does not detract.

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?

Description clearly states verb 'get' and resource 'current Tic-Tac-Toe board' along with specific fields (status, player names, legal moves). It effectively distinguishes from sibling tools like ttt_make_move and ttt_new_game.

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?

No explicit guidance on when to use versus alternatives. Usage is implied as a state retrieval tool, but there is no mention of exclusions or specific contexts.

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