ArchLang

v0.2.54
io.github.ChanMeng666/archlang-mcp Checked 4 hours ago Published 3 days ago

Floor plans as code: compile, lint and repair ArchLang (.arch) floor plans to SVG, DXF and PDF.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

compile Compile a floor plan to a drawing

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,…

ParameterTypeDescription
accessiblebooleanEmit <title>/<desc>/role/aria accessibility metadata (SVG only).
formatstringsvg (default), txt (zero-dependency ASCII), json (Plan JSON, the shape `plan_json` takes) or png (an image; needs the optional renderer).
levelintegerRender only this storey of a multi-storey plan. An undeclared level is an error, not a guess.
overlaystringDraw an opt-in circulation overlay (SVG only).
plan_jsonobjectPlan JSON (RPLAN shape) as an alternative to `source`; converted to .arch then compiled.
sourcestringArchLang source (a `plan "…" { … }`). Provide this OR plan_json.
widthintegerpng 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.

describe Describe a plan (facts, no render)

Report a plan's facts without rendering, so you can check it against the brief without looking at an image. Returns rooms (`area_m2`, measured on the wall centrelines; `net_area_m2`, the floor no wall stands on, absent when it cannot be computed exactly; bbox, adjacency, use, and the exact shape: `floor_polygon` for a `room polygon`, `floor_circle` for a `room circle`, whose area is exactly πR²), doors (what each connects), windows, circulation (walk distance, bottleneck width, detour), zones, storeys (`levels[i]` carries the same facts per floor) with the shafts that join them and which sto…

ParameterTypeDescription
source *stringArchLang source.

lint Lint architectural soundness

List advisory architectural-soundness warnings (`W_*` codes) as data: unreachable room, windowless bedroom, too-narrow door, blocked doorway, furniture through a wall, circuitous path, and more. `profile` selects a ruleset ("residential-basic", "accessibility-advisory", …).

ParameterTypeDescription
source *stringArchLang source.
profilestringAdvisory ruleset name (default: the built-in ruleset).

validate Validate (parse + resolve + lint)

Check a plan in one pass without returning a drawing (parse, resolve and lint): the gate a plan passes before it ships. `strict:true` makes advisory warnings fail too. Optional `graph` checks the plan's interior-door adjacency against an intended room graph (`{ room: [neighbours] }`); a mismatch fails. Optional `intent` (a brief's expectations, shaped as the `archlang://intent-schema` resource describes) is checked against the plan: a missed gating assertion (room count, existence, area, total area, windows) fails, while adjacency and reachability are advisory and only score. `profile` lints u…

ParameterTypeDescription
source *stringArchLang source.
graphobjectIntended interior-door adjacency: { room: [neighbour rooms] }.
intentobjectA brief's intent JSON (shape: the archlang://intent-schema resource); gating assertions fail.
profilestringAdvisory lint ruleset to report under ("residential-basic", "accessibility-advisory", …); default: the built-in ruleset.
strictbooleanAdvisory warnings fail too.
tastestringTaste profile that ranks `next`'s taste tier (for example "generic"); it never fails the plan.

score Score a plan against a brief (intent meter)

Measure how much of a brief's intent JSON a plan satisfies, without gating. Returns { ok, satisfied, total, score, subscores, violations }, where `score` is satisfied/total in [0,1] (an empty intent scores 1); call it across edits to watch a plan approach the brief. The intent's shape is the `archlang://intent-schema` resource. A malformed intent returns `{ ok:false, intentErrors }` as data, never an exception.

ParameterTypeDescription
brief *objectA brief's intent JSON (shape: the archlang://intent-schema resource) to measure against.
source *stringArchLang source.

repair Repair furniture placement

Correct furniture placement and return the corrected `.arch` source with a change log. It pushes furniture out of walls, doorways and door swings, separates overlapping pieces, moves fixtures that sit in the wrong room, and snaps floating pieces to walls. A piece it may not rewrite is listed in `unresolved` with the reason. It never adds doors or windows (that is a design choice); use `suggest` for those.

ParameterTypeDescription
source *stringArchLang source to correct.

fix Apply machine-applicable diagnostic fixes

Apply the machine-applicable fixes attached to a plan's compile diagnostics and return the edited source. It corrects source-level faults (an opening off its wall becomes the attachment form, an out-of-range position is clamped, …); furniture geometry is `repair`'s job. It runs at most 4 passes and rolls back a pass that raises the error count. `unsafe:true` also applies `maybe-incorrect` fixes. Of several alternative fixes on one diagnostic it applies the one `archlang fix` takes. Returns { ok, passes, applied, skipped, source }.

ParameterTypeDescription
source *stringArchLang source to fix.
unsafebooleanAlso apply `maybe-incorrect` fixes (default: machine-applicable only).

finish Finish the drawing

Complete a plan for export by adding what it lacks; run it once `lint` is clean. Two stages. `furnish` puts furniture, by room use, in each rectangular room that holds none, on every storey (a furnished room is never touched, and one that lacks a piece its use requires is named in `unresolved` with the missing pieces, not filled; placement is `against wall` / `in <room> anchor`, never absolute). `sheet` adds the sheet statements the plan lacks (`paper`, `scale`, `dims auto`, `title`, `schedule rooms`, `legend`), choosing the finest standard scale on the smallest sheet that holds the drawing. I…

ParameterTypeDescription
source *stringArchLang source to finish.
onlystringRun only this stage. Default: `furnish`, then `sheet`.
reissuebooleanAllow `paper` and `scale` to be replaced when the drawing does not fit the authored sheet.

suggest Suggest topology fixes (advisory)

Suggest the doors and windows a plan's room graph needs, as data; nothing is applied. For a room with no path back, a building with no entrance, a bath reachable only through a bedroom, or a windowless bedroom, it returns ready-to-paste `door`/`window` statements with a rationale, for you to choose among and insert. Each names its wall by an authored id or a unique wall category, else by absolute `at (x, y)` coordinates. Door candidates avoid furniture in the door's approach; window candidates do not consider furniture. On a plan of `level` blocks each suggestion also carries `level` (its stor…

ParameterTypeDescription
source *stringArchLang source.

complete Completions at a source offset

List the completion items in scope at a source byte offset: keywords, element names, ids and enum values, the same items an editor's language server offers. For structured or assisted authoring.

ParameterTypeDescription
at *integerSource byte offset to complete at.
source *stringArchLang source.

explain Explain a diagnostic code

Look up an E_/W_ diagnostic code in the catalogue: what it means, why it is raised and how to resolve it, with an example that raises it and, for most codes when the installed core has them, `fixed`, the same example corrected. Returns { ok:true, code, entry: { code, severity, message, cause, fix, example, fixed? } }, the `explain --json` of the CLI; an unknown code returns { ok:false, code }. The code is matched case-insensitively.

ParameterTypeDescription
code *stringA diagnostic code, e.g. E_ROOM_SIZE or W_DOOR_CLEARANCE.