Skip to main content
Glama

Compile a floor plan to a drawing

compile
Read-onlyIdempotent

Convert ArchLang .arch source or Plan JSON into SVG, ASCII, JSON, or PNG floor plans and return diagnostics with fixes so errors can be corrected.

Instructions

Compile ArchLang .arch source (or a Plan-JSON object) to an SVG floor plan, or with format to a plain-text ASCII plan ("txt"), Plan JSON ("json") or an image ("png"). Format "json" returns the plan as an object, with schema naming its JSON Schema; passed back as plan_json it compiles to the same drawing, unless the plan uses a part of the language Plan JSON does not carry (sheet tables, styles, circular rooms, roofs, storeys, place, accessibility metadata). Returns the output plus diagnostics; a diagnostic usually carries a byte span with line/col and an E_/W_ code, and often a fix, sometimes one the fix tool can apply. Errors come back as data, never as exceptions: read diagnostics and correct the source. A multi-storey plan (level <n> { … }) returns the lowest storey in output and every storey in pages[] ({ level, name, output }); pass level to render just one. format "png" returns the usual result as text, then the drawing (the lowest storey, or level) as image content, as wide as width says; it needs the optional renderer @resvg/resvg-js, and without it the call returns ok:false with an error saying how to install it.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "compile"
  }
}

Input Schema

NameRequiredDescriptionDefault
levelNoRender only this storey of a multi-storey plan. An undeclared level is an error, not a guess.
widthNopng only (any other format refuses it): the image width in pixels, clamped to 256-4096, and narrower for a tall plan so neither side exceeds 4096; default 1600.
formatNosvg (default), txt (zero-dependency ASCII), json (Plan JSON, the shape `plan_json` takes) or png (an image; needs the optional renderer).
sourceNoArchLang source (a `plan "…" { … }`). Provide this OR plan_json.
overlayNoDraw an opt-in circulation overlay (SVG only).
plan_jsonNoPlan JSON (RPLAN shape) as an alternative to `source`; converted to .arch then compiled.
accessibleNoEmit <title>/<desc>/role/aria accessibility metadata (SVG only).

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.6/5.0
Behavior5/5

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

Adds substantial behavior beyond the (already favorable) readOnly/idempotent annotations: errors are returned as data never exceptions, diagnostics carry byte spans, line/col, E_/W_ codes and often a fix, multi-storey plans return the lowest storey in `output` and all storeys in `pages[]`, and png requires the optional @resvg/resvg-js renderer with a specific ok:false failure mode. The Plan JSON round-trip limitations are called out explicitly.

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?

Front-loads the core verb, accepted inputs, and output formats before the caveats, and nearly every clause carries information. It is delivered as one dense run-on paragraph with heavy parenthetical nesting, which costs some scannability for an agent parsing it.

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?

With seven optional parameters, nested `plan_json`, and no output schema, the description still covers input alternatives, per-format behavior, return shape (`output`, `pages[]`, `diagnostics`), and the renderer dependency for png. An agent can call and interpret results without further information.

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 baseline is 3; the description still earns extra credit by explaining that `plan_json` compiles to the same drawing and enumerating which language constructs (sheet tables, styles, circular rooms, roofs, storeys, `place`, accessibility metadata) do not survive the JSON round-trip. Most other parameter detail (width clamping, level errors) merely restates 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?

States a specific verb and resource (compile ArchLang `.arch` source or Plan JSON to an SVG/ASCII/JSON/PNG floor plan) and enumerates the output modes precisely. It is clearly distinguishable from siblings like lint, validate, fix, and score, which operate on rather than render the source.

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 concrete routing rules: provide `source` OR `plan_json`, `level` to render a single storey, `width` only for png and refused otherwise, and points to the `fix` tool for applicable fixes. It stops short of explicitly contrasting with `lint`/`validate` (check-only) as the alternative path, so it is strong but not exhaustive.

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