Skip to main content
Glama

Set a convar

convar_set
Idempotent

Set Garry's Mod convars in menu, client, or server realms, verify the value by reading it back, and retry via engine console when Lua cannot apply it.

Instructions

Sets a convar from a realm (RunConsoleCommand; server realm: game.ConsoleCommand), waits 3 frames and reads it back. When the value did not take from Lua (some convars, e.g. volume_sfx, ignore Lua) it retries through the engine console (client mode). Convars with FCVAR_ARCHIVE are saved into the user's cfg/config.cfg when the game quits and are shared by every game of this folder: they are refused unless persist: true (your MCP client may then ask the user). Result: the convar as convar_get reads it, plus previous and via (lua or engine). Errors: not_found, protected (FCVAR_PROTECTED), archived, set_refused (cheat without sv_cheats, wrong realm, blocked command). Example: {"name": "sv_gravity", "value": 300, "realm": "server"}.

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": {
      "name": "<name>",
      "value": "<value>"
    },
    "name": "convar_set"
  }
}

Input Schema

NameRequiredDescriptionDefault
nameYes
realmNoExecution realm (default: menu in client mode, server on srcds).
valueYesNew value.
persistNoAllow changing an FCVAR_ARCHIVE convar (persisted in config.cfg). Default false.
instanceNoOptional. Instance identifier (see instances_list). If present and different from the local instance, the call is relayed by the coordinator to that instance.

Output Schema

NameRequiredDescriptionDefault
maxNo
minNo
viaNo
helpNo
nameYes
nextNo
noteNo
flagsYes
valueNo
numberNo
defaultNo
warningNo
previousNo
next_callNo
protectedNo
flag_namesYes
answered_byNo
truncated_noteNo
version_warningNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.3.7

TDQS

A4.6/5.0
Behavior5/5

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

Beyond the annotations, it discloses the 3-frame wait-and-read-back cycle, the silent-retry path through the engine console, and the important side effect that archived convars are written into cfg/config.cfg and shared across games in the folder. It also enumerates concrete error outcomes (not_found, protected, archived, set_refused) with their causes, which the annotations do not cover.

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

Conciseness4/5

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

The definition is front-loaded with the core action and consequence, and each subsequent sentence adds distinct information (retry, persistence hazard, return shape, error codes, example). It is dense and slightly run-on, and the parenthetical implementation notes could be trimmed without losing agent-relevant meaning.

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 mutation tool with a persistence side effect, the description covers mechanism, failure modes, required opt-in, and expected result shape; an output schema exists so return-value detail is not needed. Nothing an agent needs in order to call this correctly and anticipate refusals is missing.

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?

With 80% schema coverage the baseline is 3, and the description earns above that by explaining the persist gating rule (archived convars are refused unless persist: true), the underlying realm implementation (RunConsoleCommand vs game.ConsoleCommand), and an end-to-end example. It adds nothing about the instance relay parameter, leaving that to the schema, which keeps it from a 5.

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?

The description opens with a specific verb and resource ("Sets a convar from a realm") and immediately scopes it by realm, persistence rules, and read-back behavior. It also anchors the result to convar_get, so an agent can tell how this tool relates to its closest sibling without opening either schema.

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

Usage Guidelines4/5

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

It gives clear operating context: use persist: true for FCVAR_ARCHIVE convars, expect an engine-console retry when Lua is ignored (e.g. volume_sfx), and pass realm for server-side execution. It never explicitly names a competing tool (console_exec, lua_exec) as the alternative for cases this tool does not cover, so exclusions remain implicit.

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