Skip to main content
Glama

write_portal

Places an areaportal, areaportal window, or occluder brush in a VMF to seal doorways and cull hidden geometry during play for runtime visibility control.

Instructions

Places an areaportal, an areaportal window or an occluder: the two brush entities read_map_geometry has counted since the beginning and nothing has ever placed. They are the runtime half of visibility. An areaportal seals a doorway and the engine opens and closes it as the player moves, culling everything beyond it while it is shut -- the strongest tool Source has and the fussiest, because vbsp refuses the whole map if the brush does not fill its opening exactly. An occluder hides what is behind it per frame on the CPU: it never fails a compile and it costs time whether or not it saves any. The brush is written through the same path as every other, and gets the tool material without which the entity is a solid wall the player walks into.

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": {
      "path": "<path>",
      "classname": "<classname>",
      "mins": "<mins>",
      "maxs": "<maxs>"
    },
    "name": "write_portal"
  }
}

Input Schema

NameRequiredDescriptionDefault
maxsYes
minsYes
pathYesPath to the .vmf, absolute or relative to the repo root.
backupNoCopy the file to <file>.bak before writing. Nothing is copied on a no-op.
dryRunNoCheck and report without writing. Every verification runs either way.
confirmNoRequired (true) to run this tool: it writes or executes.
classnameYesWhat to place. A window fades rather than sealing.
keyvaluesNo
targetnameNo

Output Schema

NameRequiredDescriptionDefault
pathYes
solidIdYes
writtenYes
entityIdYes
nextStepYes
warningsYes
classnameYes
thicknessYes
backupPathYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.0.24-alpha

TDQS

A3.8/5.0
Behavior4/5

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

Annotations carry only a title, so the description bears the full load, and it does disclose meaningful behaviors: vbsp rejects the entire map on a misfit areaportal brush, occluders incur per-frame CPU cost regardless of benefit, and the tool automatically applies the tool material to prevent a solid-wall entity. It omits the overwrite/append semantics of writing the brush, the confirm gate, and backup behavior, leaving some write-safety context to the schema.

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?

Front-loaded correctly with verb and resources, but the narrative framing ("the two brush entities read_map_geometry has counted since the beginning and nothing has ever placed") is atmospheric filler in a tool definition. The middle sentence about areaportal behavior is long and comma-spliced, and no structure separates behavior from caution.

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

Completeness2/5

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

For a 9-parameter write tool with a nested keyvalues object and no behavioral annotations, the description covers domain semantics and failure modes but not the mechanics of the write: bounds parameters, targetname/keyvalues usage, and what happens to existing geometry are all unaddressed. An output schema exists, so return values need no explanation, but the input-side gaps are still significant.

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

Parameters3/5

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

Schema coverage is 56% and the description never explains mins/maxs as the brush bounding extents, nor targetname or keyvalues — the three parameters the schema leaves undocumented. It does add meaning about classname choice beyond the enum description ("A window fades rather than sealing"). Net value over the schema is modest.

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 ("Places") plus the three exact resources it can create (func_areaportal, func_areaportalwindow, func_occluder), and explains how they differ semantically (sealing vs. fading vs. per-frame CPU culling). An agent can immediately tell this apart from geometry-reading siblings like read_map_geometry.

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?

Gives real selection guidance among the three classnames: areaportal is "the strongest tool Source has and the fussiest" and fails the whole compile if the brush does not exactly fill the opening, while occluder "never fails a compile and it costs time whether or not it saves any." It also implies read_map_geometry as the upstream step. No explicit statement of when NOT to use it versus write_vmf_solid or write_vmf, but the variant-level trade-offs are unusually clear.

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