Skip to main content
Glama

set_gamemode

Change a player's game mode on a Minecraft server using RCON commands. Specify target player and desired mode (survival, creative, adventure, or spectator) for server administration.

Instructions

Change a player's game mode.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
targetYesPlayer selector (e.g., '@a', 'PlayerName')
gamemodeYesGame mode

Implementation Reference

  • The handler function for the 'set_gamemode' tool, which sends a command to the RCON manager.
    async ({ target, gamemode }) => {
      try {
        const response = await manager.rcon.send(
          `gamemode ${gamemode} ${target}`
        );
        return { content: [{ type: "text", text: response }] };
      } catch (error) {
        return {
          content: [
            {
              type: "text",
              text: `Failed: ${error instanceof Error ? error.message : String(error)}`,
            },
  • Input schema for the 'set_gamemode' tool.
    {
      target: z.string().describe("Player selector (e.g., '@a', 'PlayerName')"),
      gamemode: z
        .enum(["survival", "creative", "adventure", "spectator"])
        .describe("Game mode"),
    },
  • Registration of the 'set_gamemode' tool using the server.tool method.
    server.tool(
      "set_gamemode",
      "Change a player's game mode.",
      {
        target: z.string().describe("Player selector (e.g., '@a', 'PlayerName')"),
        gamemode: z
          .enum(["survival", "creative", "adventure", "spectator"])
          .describe("Game mode"),
      },

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