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
| Name | Required | Description | Default |
|---|---|---|---|
| command | Yes | Minecraft command to execute (without leading '/') |
Implementation Reference
- src/tools/command-tools.ts:21-44 (handler)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, }; } } ); - src/tools/command-tools.ts:16-20 (schema)The input schema for 'execute_command' using Zod.
{ command: z .string() .describe("Minecraft command to execute (without leading '/')"), }, - src/tools/command-tools.ts:13-15 (registration)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'.",