Skip to main content
Glama
leo4life2

Minecraft MCP Server

by leo4life2

leaveGame

Disconnect bots from Minecraft gameplay by specifying a username or removing all connected bots at once. Simplify bot management in Minecraft MCP Server environments.

Instructions

Disconnect a bot from the game

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
disconnectAllNoIf true, disconnect all bots and close all connections
usernameNoThe username of the bot to disconnect

Implementation Reference

  • Executes the leaveGame tool: disconnects bot(s) by username or all using BotManager.removeBot() or disconnectAll(). Returns success/error messages.
    if (name === "leaveGame") {
        try {
            const { username, disconnectAll } = args as { username?: string; disconnectAll?: boolean };
    
            if (disconnectAll) {
                const count = botManager.getBotCount();
                botManager.disconnectAll();
                return {
                    content: [{
                        type: "text",
                        text: `Disconnected all ${count} bot(s) from the game.`
                    }]
                };
            }
    
            if (!username) {
                throw new Error("Either 'username' or 'disconnectAll' must be specified");
            }
    
            const bot = botManager.getBotByUsername(username);
            if (!bot) {
                throw new Error(`No bot found with username '${username}'`);
            }
    
            botManager.removeBot(username);
    
            return {
                content: [{
                    type: "text",
                    text: `Bot '${username}' has been disconnected from the game.`
                }]
            };
        } catch (error) {
            return {
                content: [{
                    type: "text",
                    text: `Failed to leave game: ${error instanceof Error ? error.message : String(error)}`
                }],
                isError: true
            };
        }
    }
  • Input schema definition for the leaveGame tool, including username and optional disconnectAll parameters.
    {
        name: "leaveGame",
        description: "Disconnect a bot from the game",
        inputSchema: {
            type: "object",
            properties: {
                username: {
                    type: "string",
                    description: "The username of the bot to disconnect"
                },
                disconnectAll: {
                    type: "boolean",
                    description: "If true, disconnect all bots and close all connections"
                }
            }
        }
    }
  • Registers the leaveGame tool (along with joinGame) in the ListToolsRequest handler by including it in the static tools array.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
        const tools = [
            {
                name: "joinGame",
                description: "Spawn a bot into the Minecraft game",
                inputSchema: {
                    type: "object",
                    properties: {
                        username: {
                            type: "string",
                            description: "The username for the bot"
                        },
                        host: {
                            type: "string",
                            description: "Minecraft server host (defaults to 'localhost' or command line option)"
                        },
                        port: {
                            type: "number",
                            description: "Minecraft server port (defaults to 25565 or command line option)"
                        }
                    },
                    required: ["username"]
                }
            },
            {
                name: "leaveGame",
                description: "Disconnect a bot from the game",
                inputSchema: {
                    type: "object",
                    properties: {
                        username: {
                            type: "string",
                            description: "The username of the bot to disconnect"
                        },
                        disconnectAll: {
                            type: "boolean",
                            description: "If true, disconnect all bots and close all connections"
                        }
                    }
                }
            }
        ];
    
        // Add all registered skills as tools
        const skillTools = skillRegistry.getAllSkills().map(skill => ({
            name: skill.name,
            description: skill.description,
            inputSchema: skill.inputSchema
        }));
    
        return { tools: [...tools, ...skillTools] };
    });
Behavior2/5

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

With no annotations, the description carries full burden but only states the action without behavioral details. It doesn't disclose effects (e.g., if disconnection is permanent, requires permissions, or affects game state), rate limits, or error conditions, leaving significant gaps for a mutation tool.

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, clear sentence with no wasted words. It's front-loaded and efficiently conveys the core purpose without unnecessary elaboration, making it easy to parse quickly.

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

Completeness2/5

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

For a mutation tool with no annotations and no output schema, the description is incomplete. It lacks details on behavioral traits, return values, or error handling, which are critical for an agent to use this tool correctly in a game context with siblings like 'joinGame'.

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 description coverage is 100%, so parameters are fully documented in the schema. The description adds no extra meaning beyond implying disconnection, aligning with the baseline score when the schema handles parameter documentation effectively.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Disconnect a bot from the game' clearly states the action (disconnect) and target (a bot from the game). It distinguishes from siblings like 'joinGame' but doesn't specify if it's for the current bot or others, making it slightly less specific than a perfect 5.

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

Usage Guidelines2/5

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

No guidance is provided on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., must be in a game), exclusions, or related tools like 'runAway' or 'sleepInNearbyBed' that might serve similar purposes in different 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

Related 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/leo4life2/minecraft-mcp-http'

If you have feedback or need assistance with the MCP directory API, please join our Discord server