Skip to content

Fix multi-game MCP tool mirroring confusion with game-prefixed naming strategy#8

Merged
pardeike merged 2 commits intomainfrom
copilot/fix-2adb08e6-7e47-4208-8f16-5bd513a2e98f
Sep 13, 2025
Merged

Fix multi-game MCP tool mirroring confusion with game-prefixed naming strategy#8
pardeike merged 2 commits intomainfrom
copilot/fix-2adb08e6-7e47-4208-8f16-5bd513a2e98f

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Sep 13, 2025

Problem

When multiple games with GABP-compliant mods are running simultaneously, GABS faces a critical tool naming conflict issue that confuses AI agents:

// Before: Ambiguous and conflicting tool names
inventory/get       // Which game's inventory? Minecraft or RimWorld?
player/teleport     // Which game's teleport? Last registered wins!
world/place_block   // Available in multiple games, causes conflicts

This creates several problems:

  1. Tool name conflicts - Multiple games registering the same tool names
  2. AI confusion - No way for AI to specify which game a tool should target
  3. Unpredictable behavior - Last registered tool overwrites previous ones
  4. Poor user experience - AI can't tell users which game it's controlling

Solution

Implemented game-prefixed tool naming strategy that automatically namespaces all GABP tools with their source game ID:

// After: Crystal clear and conflict-free tool names
minecraft.inventory/get     // Obviously Minecraft's inventory system
rimworld.inventory/get      // Obviously RimWorld's colonist inventory
minecraft.player/teleport   // Minecraft teleportation mechanics
rimworld.player/teleport    // RimWorld colonist movement system

Key Changes

1. Enhanced Mirror Module (internal/mirror/mirror.go)

  • Modified to accept gameId parameter for tool namespacing
  • Automatically prefixes all GABP tools with {gameId}.{originalToolName}
  • Updates tool descriptions to include game context
  • Maintains original GABP tool names when forwarding calls to game mods

2. New games.tools MCP Command (internal/mcp/stdio_server.go)

  • Added discovery tool for AI agents to explore available game-specific tools
  • Supports filtering by specific game ID or listing all games
  • Shows game status (running/stopped) alongside tool availability
  • Includes helpful explanatory text about the prefixing strategy

3. Comprehensive Documentation (AGENTS.md)

  • Added detailed "Multi-Game Tool Management" section
  • Explains the challenge, solution, and AI usage patterns
  • Provides practical examples for common multi-game scenarios
  • Documents best practices for error handling and tool discovery

4. Extensive Test Coverage (internal/mcp/multi_game_mirroring_test.go)

  • Tests demonstrate the problem and validate the solution
  • Covers tool registration, discovery, and execution scenarios
  • Validates the new games.tools command functionality
  • Ensures no regressions in existing game management features

Benefits for AI Agents

  1. Crystal Clear Intent - minecraft.inventory/get vs rimworld.inventory/get eliminates all ambiguity
  2. Parallel Game Control - AI can manage multiple games simultaneously without conflicts
  3. Better Error Messages - AI knows exactly which game failed and can inform users
  4. Scalable Architecture - Adding more games won't create new tool conflicts
  5. Enhanced User Experience - AI can explicitly tell users which game it's interacting with

Usage Examples

Tool Discovery

// See what games and tools are available
const games = await mcpClient.callTool("games.list", {});
const allTools = await mcpClient.callTool("games.tools", {});
const minecraftTools = await mcpClient.callTool("games.tools", {gameId: "minecraft"});

Explicit Game Targeting

// No more guessing which game - AI can be explicit
const mcInventory = await mcpClient.callTool("minecraft.inventory/get", {playerId: "steve"});
const rwInventory = await mcpClient.callTool("rimworld.inventory/get", {playerId: "colonist1"});

Multi-Game Coordination

// AI can coordinate actions across multiple games
await Promise.all([
  mcpClient.callTool("minecraft.player/teleport", {playerId: "steve", x: 100, y: 64, z: 200}),
  mcpClient.callTool("rimworld.player/teleport", {playerId: "colonist1", x: 50, y: 25})
]);

This change transforms GABS from supporting single-game scenarios to being truly multi-game capable, making it much easier for AI agents to understand and control multiple games simultaneously without confusion or conflicts.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Co-authored-by: pardeike <853584+pardeike@users.noreply.github.com>
Copilot AI changed the title [WIP] Can you check how the mirroring of game mcp commands works in case you have multiple games? Will the AI figure this out nicely or does the whole proxying mcp commands to games can become confusing? If so, what strategies can we apply to make this more ... Fix multi-game MCP tool mirroring confusion with game-prefixed naming strategy Sep 13, 2025
Copilot AI requested a review from pardeike September 13, 2025 19:22
@pardeike pardeike marked this pull request as ready for review September 13, 2025 19:22
@pardeike pardeike merged commit 4ac2a82 into main Sep 13, 2025
1 check passed
@pardeike pardeike deleted the copilot/fix-2adb08e6-7e47-4208-8f16-5bd513a2e98f branch September 13, 2025 19:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants