Skip to main content
Glama

Load a map

map_load
Destructive

Loads a Garry's Mod map and waits until the new server and client realms are playable, resetting Lua state so subsequent realm tools run against the new map.

Instructions

Loads a map and WAITS until it is playable: client mode = the console map command (singleplayer when maxplayers is 1, listen server otherwise), then it waits until NEW server and client realms are up and ready (gamemode loaded, local player valid) and the loading screen is gone; srcds = changelevel, server realm only. Every Lua state of the previous map is destroyed: its globals, hooks, timers, jobs and debug drawings are gone, and the addons' files are loaded again from disk. Changing maxplayers on a running game disconnects first (client mode only). Result: {map, gamemode, maxplayers, requested_map, duration_s, server_generation, client_generation, warning?, lua_mount?, lua_cache_emptied?}. With a mounted Lua folder (lua_mount) it empties the engine's Lua file cache before loading (lua_cache_emptied), and when the load ends it checks the folder: if its files changed since the realms loaded them (edited during the load) or a realm did not get the folder, warning says so and lua_mount is the status.lua_mount object. Errors: not_found (no maps/.bsp), busy (another map_load/disconnect runs), timeout (with which realms are up), cancelled. If the game crashes during the load, the call through the coordinator answers client_crashed (dump name in details; relaunch with instances_launch). IMPORTANT: when your client runs it as a background MCP task, wait for its result before calling a realm tool: a call made before it ends reaches the OLD map's state. Every lua_exec/lua_job result carries the realm's generation: equal to server_generation/client_generation = the new map's state. Starting a game makes every other running Garry's Mod release its GPU resources for 2-10 s, and a map load ending in that window crashes that game (engine bug, Facepunch garrysmod-issues #7137). So a map_load that goes through the bridge (any session, any target instance) first waits while a game is being started (instances_launch) and for 15 s after the last start. A call that waited carries waited_s and waited_reason (and progress; as a task, in statusMessage). If the wait would exceed timeout_s it fails with error launch_in_progress and sends nothing to the game: retry later, or with a larger timeout_s. When another game was loading a map at that moment (started by anything: console, Lua, a script, another session), the result lists it as other_games_loading; it does not delay the load. A launch, however, waits for loads like that. Not held back by the bridge: a game started by hand, and a map change triggered from Lua or the console while a game is being started (changelevel, map through console_exec): do not do those. Right after a game starts, the other games can be unreachable for 15-18 s (instance_unreachable, timeouts): expected, wait and retry. Example: {"map": "gm_construct"}.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "map": "<map>"
    },
    "name": "map_load"
  }
}

Input Schema

NameRequiredDescriptionDefault
mapYesName without extension, e.g. gm_construct.
gamemodeNoGamemode (e.g. sandbox). Default: unchanged.
instanceNoOptional. Instance identifier (see instances_list). If present and different from the local instance, the call is relayed by the coordinator to that instance.
timeout_sNoMax wait in seconds (default 180).
maxplayersNo1 = singleplayer, >1 = listen server (needed for bots_add). Default: unchanged.

Output Schema

NameRequiredDescriptionDefault
mapNo
nextNo
noteNo
warningNo
gamemodeNo
lua_mountNo
next_callNo
duration_sYes
maxplayersNo
answered_byNo
requested_mapYes
truncated_noteNo
version_warningNo
client_generationNo
lua_cache_emptiedNo
server_generationNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.3.7

TDQS

A4.7/5.0
Behavior5/5

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

Annotations only flag destructiveHint=true and openWorldHint=false; the description goes far beyond by naming exactly what is destroyed (all Lua state, globals, hooks, timers, jobs, debug drawings, reloaded addon files), the disconnect side effect of changing maxplayers, the global engine bug that makes loads wait on game starts, and the full error taxonomy (not_found, busy, timeout, cancelled, client_crashed, launch_in_progress). It is consistent with destructiveHint=true rather than contradicting it.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The opening sentence is exemplary and front-loaded, and most sentences carry non-obvious operational facts. But the body is a dense semicolon-chained block of roughly 350 words that mixes destroy semantics, engine-bug timing, task-mode advice, and return fields, making it hard to scan; some points (other_games_loading, launch blocking) are restated and the result-object dump partly duplicates the output schema.

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

Completeness5/5

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

For a destructive, blocking, coordinator-routed operation this covers everything needed to call it correctly: modes, blocking behavior, destruction, concurrency gates, timing windows, and every failure mode with remediation. An output schema exists, so listing result fields is bonus rather than a gap, and the behavioral picture is otherwise complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the per-parameter baseline is 3, but the description adds real meaning: it explains the maxplayers side effect (changing it on a running game disconnects first), the interaction of timeout_s with waiting (launch_in_progress when the wait would exceed it), and the consequence of `instance` (relayed through the coordinator, subject to bridge delays). It does not restate obvious syntax, so it earns above baseline.

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

Purpose5/5

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

States a specific verb and resource ("Loads a map") and immediately defines the scope: it blocks until the map is playable, with distinct client-mode (`map` command) and srcds (`changelevel`) paths. This is clearly separable from siblings like `console_exec` or `disconnect`, and the first sentence alone lets an agent decide whether this is the right tool.

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

Usage Guidelines5/5

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

Gives explicit when-to-use guidance (map changes), explicit when-not (don't trigger `changelevel`/console `map` while a game is starting), alternative actions for failure states (retry later, larger timeout_s, relaunch via instances_launch), and task-mode sequencing (wait for the result before calling realm tools). It also routes expected transient failures (instance_unreachable after a start) to wait-and-retry behavior.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.