Skip to main content
Glama

bs_get_state

Retrieve the current battle map displaying attack grids and fleet status. This action is free and does not count as a shot.

Instructions

Get the current battle map — both attack grids and fleet status. Free, does not count as a shot.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Registration of the 'bs_get_state' tool via server.tool() with empty schema (no params).
    server.tool(
      "bs_get_state",
      "Get the current battle map — both attack grids and fleet status. Free, does not count as a shot.",
      {},
      async () => ({
        content: [{ type: "text", text: renderState(bsGame) }],
      })
    );
  • Handler function for 'bs_get_state' — returns the rendered state of the battleship game (attack grids and fleet status). No parameters, free action.
      async () => ({
        content: [{ type: "text", text: renderState(bsGame) }],
      })
    );
  • renderState() helper — formats both attack grids and fleet status for both sides, plus current turn info, into a display string.
    function renderState(state: BsState): string {
      const sections: string[] = [];
    
      sections.push(renderAttackGrid(state.pirateAttacks, `⚓ YOUR CANNONS (pirate shots on the Navy fleet)   O=miss  X=hit  letter=sunk ship`));
      sections.push(``);
      sections.push(renderAttackGrid(state.navyAttacks, `💂 NAVY CANNONS (Navy shots on your pirate fleet)   O=miss  X=hit  letter=sunk ship`));
      sections.push(``);
      sections.push(renderFleetStatus(state.navyShips,    `Royal Navy fleet:`));
      sections.push(``);
      sections.push(renderFleetStatus(state.pirateShips,  `Pirate fleet:`));
      sections.push(``);
    
      if (state.status === "in_progress") {
        const turnLine = state.currentTurn === "pirate"
          ? `Round ${state.roundNumber} — ⚓ YOUR TURN, Captain. Call your shot!`
          : `Round ${state.roundNumber} — 💂 The Navy is taking aim...`;
        sections.push(turnLine);
      } else if (state.status === "pirates_win") {
        sections.push(`🏴‍☠️ VICTORY! The Royal Navy fleet lies at the bottom of the sea. The Caribbean belongs to the pirates!`);
      } else if (state.status === "navy_wins") {
        sections.push(`⚓ DEFEAT. The pirate fleet has been destroyed. The King's law returns to these waters.`);
      }
    
      sections.push(`\nShip letters — Navy: S=Sovereign  I=IronDuke  V=Vigilance  P=Persistence  G=Gadfly`);
      sections.push(`Ship letters — Pirates: K=Kraken  M=Devil'sMaw  W=Widow'sWail  B=BoneCollector  N=RustyNail`);
    
      return sections.join("\n");
    }
  • renderAttackGrid() helper — renders a single attack grid (10x10) with row/col labels.
    function renderAttackGrid(grid: AttackCell[][], title: string): string {
      const lines = [title];
      lines.push(`         col  0  1  2  3  4  5  6  7  8  9`);
      for (let r = 0; r < GRID_SIZE; r++) {
        let row = `         row ${r}  `;
        for (let c = 0; c < GRID_SIZE; c++) row += `${grid[r][c]} `;
        lines.push(row.trimEnd());
      }
      return lines.join("\n");
    }
  • renderFleetStatus() helper — renders fleet status bars (hitCount/sunk/cargo) for each ship.
    function renderFleetStatus(ships: ShipState[], label: string): string {
      const lines = [label];
      for (const ship of ships) {
        const bar = "█".repeat(ship.hitCount) + "░".repeat(ship.size - ship.hitCount);
        const status = ship.sunk
          ? `SUNK — cargo lost: ${ship.cargo}`
          : `afloat — cargo: [SEALED HOLD]`;
        lines.push(`  ${ship.letter}  ${ship.name.padEnd(22)} [${bar}] ${status}`);
      }
      return lines.join("\n");
    }
Behavior4/5

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

The description explicitly states the tool is free and does not count as a shot, disclosing its non-destructive, read-only nature beyond the absence of annotations.

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?

The description is a single concise sentence that efficiently conveys purpose and key constraint.

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

Completeness5/5

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

For a parameterless, no-output-schema tool, the description fully covers what it returns (attack grids and fleet status) and its cost implication, making it complete.

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?

With zero parameters and 100% schema coverage, the description need not add parameter details; the baseline 4 applies.

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 it retrieves the current battle map including attack grids and fleet status, distinguishing it from action-oriented sibling tools like bs_claude_fire and bs_human_fire.

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

Usage Guidelines4/5

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

The description implicitly indicates when to use (to view state without cost) but does not explicitly contrast with alternatives.

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