Skip to main content
Glama

bs_human_fire

Fire pirate cannons at specified grid coordinates to attack Navy ships. Returns hit, miss, or sunk status; reveals cargo of sunk ships.

Instructions

Fire the pirate cannons at the given coordinates on the Navy's grid. Call this when the human gives their shot. Returns hit/miss/sunk — and if sunk, reveals what that Navy ship was carrying.

Input Schema

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

Implementation Reference

  • The handler for the bs_human_fire tool. Validates game state (in_progress, pirate's turn, not already fired at coordinates), calls fireShot(), checks for victory via allSunk(), and updates the game state.
      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 !== "pirate") {
          return { content: [{ type: "text", text: `The Navy hasn't fired yet this round. Call bs_claude_fire first.` }], isError: true };
        }
        if (bsGame.pirateAttacks[row][col] !== "?") {
          return { content: [{ type: "text", text: `You already fired at (row ${row}, col ${col}). Pick different waters.\n\n${renderState(bsGame)}` }], isError: true };
        }
    
        const { summary } = fireShot(bsGame.pirateAttacks, bsGame.navyGrid, bsGame.navyShips, row, col);
    
        if (allSunk(bsGame.navyShips)) {
          bsGame.status = "pirates_win";
          return { content: [{ type: "text", text: `${summary}\n\n${renderState(bsGame)}` }] };
        }
    
        bsGame.currentTurn = "navy";
        return { content: [{ type: "text", text: `${summary}\n\nThe Navy is lining up their cannons — call bs_claude_fire to return fire.\n\n${renderState(bsGame)}` }] };
      }
    );
  • Input schema for bs_human_fire: row and col are integers 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_human_fire tool on the MCP server via server.tool(), within the registerBattleshipTools function.
    server.tool(
      "bs_human_fire",
      "Fire the pirate cannons at the given coordinates on the Navy's grid. Call this when the human gives their shot. Returns hit/miss/sunk — and if sunk, reveals what that Navy 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 !== "pirate") {
          return { content: [{ type: "text", text: `The Navy hasn't fired yet this round. Call bs_claude_fire first.` }], isError: true };
        }
        if (bsGame.pirateAttacks[row][col] !== "?") {
          return { content: [{ type: "text", text: `You already fired at (row ${row}, col ${col}). Pick different waters.\n\n${renderState(bsGame)}` }], isError: true };
        }
    
        const { summary } = fireShot(bsGame.pirateAttacks, bsGame.navyGrid, bsGame.navyShips, row, col);
    
        if (allSunk(bsGame.navyShips)) {
          bsGame.status = "pirates_win";
          return { content: [{ type: "text", text: `${summary}\n\n${renderState(bsGame)}` }] };
        }
    
        bsGame.currentTurn = "navy";
        return { content: [{ type: "text", text: `${summary}\n\nThe Navy is lining up their cannons — call bs_claude_fire to return fire.\n\n${renderState(bsGame)}` }] };
      }
    );
  • The fireShot() helper function called by the bs_human_fire handler. Checks if the shot hits a ship, marks hits, and returns the result (miss/hit/sunk) with 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!` };
    }
Behavior3/5

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

No annotations are provided, so description carries burden. It discloses return values (hit/miss/sunk, with cargo reveal on sunk) but does not mention state modification or any side effects beyond game logic.

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?

Two sentences front-load action and usage, then return info. No filler or redundant words.

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?

Covers purpose, usage, and return values adequately for a simple game move. Lacks mention of prerequisites (e.g., game must be active) but reasonable given low complexity.

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?

Schema coverage is 100%, with descriptions for row and col already defining range and meaning. Description adds no additional parameter info 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?

Description clearly states the action ('Fire the pirate cannons'), target ('at given coordinates on the Navy's grid'), and differentiates from sibling 'bs_claude_fire' by specifying human's turn.

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?

Explicitly says 'Call this when the human gives their shot', providing clear usage context. Does not exclude other cases, but sibling distinction implies a counterpart for Claude.

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