Skip to main content
Glama

bs_claude_fire

Fire cannons at specified coordinates to attack pirate fleet. Returns hit, miss, or sunk status; sunk ships reveal their cargo.

Instructions

Fire the Navy cannons at the given coordinates on the pirate fleet. Claude chooses the target — reason about it in chat first, then call this. Returns hit/miss/sunk — and if sunk, reveals what the pirate ship was carrying.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
rowYesRow index: 0 = top, 9 = bottom
colYesColumn index: 0 = left, 9 = right

Implementation Reference

  • The handler function for the bs_claude_fire tool. It fires the Navy's cannons at specified coordinates, validates the game is in progress and it's the Navy's turn, checks for duplicate shots, executes the shot via fireShot(), checks for a Navy victory (all pirate ships sunk), and updates game state.
    server.tool(
      "bs_claude_fire",
      "Fire the Navy cannons at the given coordinates on the pirate fleet. Claude chooses the target — reason about it in chat first, then call this. Returns hit/miss/sunk — and if sunk, reveals what the pirate ship was carrying.",
      {
        row: z.number().int().min(0).max(9).describe("Row index: 0 = top, 9 = bottom"),
        col: z.number().int().min(0).max(9).describe("Column index: 0 = left, 9 = right"),
      },
      async ({ row, col }) => {
        if (bsGame.status !== "in_progress") {
          return { content: [{ type: "text", text: `The battle is over (${bsGame.status}). Call bs_new_game to sail again.` }], isError: true };
        }
        if (bsGame.currentTurn !== "navy") {
          return { content: [{ type: "text", text: `It's the pirates' turn, Captain. Call bs_human_fire first.` }], isError: true };
        }
        if (bsGame.navyAttacks[row][col] !== "?") {
          return { content: [{ type: "text", text: `The Navy already fired at (row ${row}, col ${col}). Choose different waters.\n\n${renderState(bsGame)}` }], isError: true };
        }
    
        const { summary } = fireShot(bsGame.navyAttacks, bsGame.pirateGrid, bsGame.pirateShips, row, col);
    
        if (allSunk(bsGame.pirateShips)) {
          bsGame.status = "navy_wins";
          return { content: [{ type: "text", text: `${summary}\n\n${renderState(bsGame)}` }] };
        }
    
        bsGame.currentTurn = "pirate";
        bsGame.roundNumber++;
        return { content: [{ type: "text", text: `${summary}\n\n${renderState(bsGame)}` }] };
      }
    );
  • Input schema for bs_claude_fire — validates row and col as integers between 0-9.
    {
      row: z.number().int().min(0).max(9).describe("Row index: 0 = top, 9 = bottom"),
      col: z.number().int().min(0).max(9).describe("Column index: 0 = left, 9 = right"),
    },
  • Registration of the bs_claude_fire tool via server.tool() within registerBattleshipTools(), which is called from src/index.ts:18.
    server.tool(
      "bs_claude_fire",
      "Fire the Navy cannons at the given coordinates on the pirate fleet. Claude chooses the target — reason about it in chat first, then call this. Returns hit/miss/sunk — and if sunk, reveals what the pirate ship was carrying.",
      {
        row: z.number().int().min(0).max(9).describe("Row index: 0 = top, 9 = bottom"),
        col: z.number().int().min(0).max(9).describe("Column index: 0 = left, 9 = right"),
      },
      async ({ row, col }) => {
        if (bsGame.status !== "in_progress") {
          return { content: [{ type: "text", text: `The battle is over (${bsGame.status}). Call bs_new_game to sail again.` }], isError: true };
        }
        if (bsGame.currentTurn !== "navy") {
          return { content: [{ type: "text", text: `It's the pirates' turn, Captain. Call bs_human_fire first.` }], isError: true };
        }
        if (bsGame.navyAttacks[row][col] !== "?") {
          return { content: [{ type: "text", text: `The Navy already fired at (row ${row}, col ${col}). Choose different waters.\n\n${renderState(bsGame)}` }], isError: true };
        }
    
        const { summary } = fireShot(bsGame.navyAttacks, bsGame.pirateGrid, bsGame.pirateShips, row, col);
    
        if (allSunk(bsGame.pirateShips)) {
          bsGame.status = "navy_wins";
          return { content: [{ type: "text", text: `${summary}\n\n${renderState(bsGame)}` }] };
        }
    
        bsGame.currentTurn = "pirate";
        bsGame.roundNumber++;
        return { content: [{ type: "text", text: `${summary}\n\n${renderState(bsGame)}` }] };
      }
    );
  • Helper function used by the handler to check if all pirate ships have been sunk (Navy victory condition).
    function allSunk(ships: ShipState[]): boolean {
      return ships.every(s => s.sunk);
    }
  • Core game logic helper that processes a shot — checks hit/miss/sunk on the target grid, updates attack grid and ship state, returns a summary string.
    function fireShot(
      attackGrid: AttackCell[][],
      targetGrid: boolean[][],
      targetShips: ShipState[],
      row: number,
      col: number
    ): { result: "miss" | "hit" | "sunk"; ship?: ShipState; summary: string } {
      if (!targetGrid[row][col]) {
        attackGrid[row][col] = "O";
        return { result: "miss", summary: `Cannonball splashes into the water at (row ${row}, col ${col}). Miss!` };
      }
    
      const ship = targetShips.find(s => s.positions.some(([r, c]) => r === row && c === col))!;
      ship.hitCount++;
      attackGrid[row][col] = "X";
    
      if (ship.hitCount === ship.size) {
        ship.sunk = true;
        for (const [r, c] of ship.positions) attackGrid[r][c] = ship.letter;
        return {
          result: "sunk",
          ship,
          summary: `DIRECT HIT at (row ${row}, col ${col})! **${ship.name}** has been sent to the bottom!\n💀 Recovered from the wreck: *${ship.cargo}*`,
        };
      }
    
      return { result: "hit", summary: `Hit! (row ${row}, col ${col}) — ${ship.name} is taking on water!` };
    }
Behavior4/5

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

Without annotations, the description discloses the return values (hit/miss/sunk and cargo on sunk) and implies the action is destructive, but does not mention other side effects like turn consumption.

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 brief with two sentences, front-loading the action and target, and every sentence adds value.

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 simple game tool with no output schema, the description fully explains the return values and behavior, making it complete for its context.

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

Parameters3/5

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

The schema already provides complete descriptions for both parameters (row and col with indices), so the description adds no additional semantic value beyond the schema.

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 the tool fires cannons at coordinates on the pirate fleet, distinguishing it from sibling tools like bs_human_fire which is likely for human input.

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 tells the agent to reason about the target before calling, providing clear usage guidance, but does not explicitly mention when not to use this tool versus 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