Skip to main content
Glama

read_visleaf_stats

Reads a compiled BSP's visibility leaf data to report leaf and cluster counts, leaf volume distribution, and the share of leaves outside any cluster, so you can check split quality before shipping a map.

Instructions

Quality of a compiled map's visibility split: LEAFS for the bounding volume and cluster of every leaf, VISIBILITY for the map's real cluster count from its own header. Reports leaf and cluster counts, the distribution of leaf volumes (median and mean), and the fraction of leaves outside any cluster (-1) -- usually solid leaves, which own no visible space. Handles both dleaf_t sizes (version 0 and 1); any other LEAFS version is refused rather than guessed at.

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>"
    },
    "name": "read_visleaf_stats"
  }
}

Input Schema

NameRequiredDescriptionDefault
pathYesPath to the .bsp, absolute or relative to the repo root.

Output Schema

NameRequiredDescriptionDefault
pathYes
volumeYes
leafBytesYesdleaf_t record size this map uses: 32 or 56 bytes.
leafCountYes
leafVersionYes
clusterCountYesFrom VISIBILITY's own header. Null when the lump is empty (vis not run).
visibilityBytesYes
noClusterFractionYes
noClusterLeafCountYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.0.24-alpha

TDQS

A3.9/5.0
Behavior4/5

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

With annotations carrying only a title and no hint flags, the description does real work: it discloses that both dleaf_t sizes (version 0 and 1) are handled and that any other LEAFS version is refused rather than guessed at — a concrete failure mode an agent can plan around. It does not discuss permissions or performance, and the return shape is covered by the output schema.

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?

Two sentences, front-loaded with the purpose and then the specific metrics, with no filler. The density of domain jargon (dleaf_t, LEAFS, VISIBILITY) is justified for the subject but slightly slows first read.

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

Completeness4/5

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

For a one-parameter read tool with an output schema, the definition covers what is measured, how the -1/unclustered leaves should be interpreted, and the unsupported-version failure path. Only minor gaps remain, such as behavior on non-.bsp inputs or empty/absent visibility data.

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?

There is a single parameter with 100% schema description coverage, so the schema already explains that 'path' points at a .bsp. The description reinforces that this operates on a compiled map but adds no path syntax, relative-resolution, or validation detail beyond the schema.

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 names a specific resource (a compiled map's visibility split) and enumerates exactly what is reported: leaf counts, cluster counts, leaf-volume median/mean, and the fraction of leaves outside any cluster. It also distinguishes the two internal sources it reads (LEAFS bounding volume vs. VISIBILITY header cluster count), so an agent can tell this apart from siblings like read_bsp_info or 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 Guidelines3/5

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

It frames the purpose as checking the 'quality' of a visibility split, which implies when the tool is useful, but it gives no explicit when/when-not guidance and names no alternative tool for adjacent questions (e.g., general map stats vs. sightline analysis). Usage is inferable rather than stated.

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