Skip to main content
Glama

execute_command

Execute Minecraft server commands remotely via RCON to manage gameplay, modify world settings, and control server operations.

Instructions

Execute a Minecraft server command via RCON. Send any command without the leading '/'. Examples: 'time set 0', 'weather clear', 'give @a diamond 64', 'tp @a 0 64 0', 'setblock 0 64 0 diamond_block'.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
commandYesMinecraft command to execute (without leading '/')

Implementation Reference

  • The handler logic for 'execute_command' which calls 'manager.rcon.send(command)'.
      async ({ command }) => {
        try {
          const response = await manager.rcon.send(command);
          return {
            content: [
              {
                type: "text",
                text: response || "(Command executed, no response)",
              },
            ],
          };
        } catch (error) {
          return {
            content: [
              {
                type: "text",
                text: `Failed to execute command: ${error instanceof Error ? error.message : String(error)}`,
              },
            ],
            isError: true,
          };
        }
      }
    );
  • The input schema for 'execute_command' using Zod.
    {
      command: z
        .string()
        .describe("Minecraft command to execute (without leading '/')"),
    },
  • The MCP tool registration for 'execute_command'.
    server.tool(
      "execute_command",
      "Execute a Minecraft server command via RCON. Send any command without the leading '/'. Examples: 'time set 0', 'weather clear', 'give @a diamond 64', 'tp @a 0 64 0', 'setblock 0 64 0 diamond_block'.",

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/tamo2918/Minecraft-Server-MCP'

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