forma-dsl-mcp
v0.5.17A stdio MCP server that knows the forma DSL and writes .forma documents that render.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
forma_guide The forma language in brief
The language compressed to what someone writing a document has to hold in their head: the four top-level blocks, how nesting composes geometry, dimensionality, units, the syntax rules that are not guessable, and the mistakes that cost the most time. Read this before writing any forma. Call with no section for all of it.
| Parameter | Type | Description |
|---|---|---|
section | string | One section, instead of the whole guide. |
forma_blocks Block and declaration reference
Every block the language has, with its attributes, defaults, dimensionality and the things that surprise people about it. Call with no arguments for the full list of names and one-line summaries; name the ones you are about to use to get their attribute tables. Covers the declarations (param, local, component, model) and the control-flow constructs too.
| Parameter | Type | Description |
|---|---|---|
group | string | One group, e.g. "2D shapes", "Transforms", "Refinement", "Declarations". |
names | array | The blocks to describe in full, e.g. ["extrude", "difference"]. |
forma_functions Builtin functions and constants
Every function an expression may call, with its arity, and the two named constants. There are no user-defined functions in forma, so this is the complete set.
forma_reference The reference manual
The language's full reference manual, bundled with this server. Pass `query` to search it, or `page` to read one page whole. Reach for this when forma_blocks is not enough - the manual has the worked examples, the caveats and the troubleshooting for every error message the language raises. Call with no arguments to list the pages.
| Parameter | Type | Description |
|---|---|---|
page | string | One page to read, e.g. "reference/conversions.md". |
query | string | Words to search for, e.g. "revolve profile axis". |
forma_examples Worked documents
Complete .forma documents that render, each showing one way of building a real part. Every one is rendered by this package's tests, so none of them teaches a mistake. Read the nearest one before writing something new.
| Parameter | Type | Description |
|---|---|---|
name | string | One example to read in full. |
forma_write Check, then write a .forma file
Builds a .forma document with the real geometry kernel and, if it renders, writes it. The result is the measurement: a table of every part with its bounding box, volume, triangle count and genus, or the error with the line, the column and an excerpt with a caret on it. This is how you find out whether what you wrote is the size you meant, is watertight, and is not silently empty. A document that does not render is refused and nothing is written - pass `force: true` to write it anyway. Refuses to replace an existing file unless `overwrite` is set.
| Parameter | Type | Description |
|---|---|---|
path * | string | Where to write, relative to the first directory the client declared as a root. Must end in .forma. |
source * | string | The document. |
force | boolean | Write even if the document does not render. Default false. |
model | string | Which model to build. Defaults to the first one declared. |
overwrite | boolean | Replace the file if it already exists. Default false. |
params | object | Values for the document's params, by name. Anything not given uses its default. |
forma_read Read a document back
Reads a .forma file the client has given access to and builds it, so you see the source and its current measurements together. Use it before editing something you did not write in this session.
| Parameter | Type | Description |
|---|---|---|
path * | string | The file, relative to the first directory the client declared as a root. |
solve | boolean | Run the geometry kernel. Default true; false parses only, which is faster. |
forma_export_stl Render and write a binary STL
Renders a document and writes one part - or every part unioned - as a binary STL. Lengths are unitless in forma and STL has no unit either; every consumer treats them as millimetres.
| Parameter | Type | Description |
|---|---|---|
out * | string | Where to write, relative to the first directory the client declared as a root. Must end in .stl. |
model | string | Which model to build. Defaults to the first one declared. |
overwrite | boolean | Replace the file if it already exists. Default false. |
params | object | Values for the document's params, by name. Anything not given uses its default. |
part | string | One part by name. Omitted, a single-part model exports that part and a multi-part model exports them unioned. |
path | string | A .forma file the client has given access to, instead of `source`. |
source | string | The .forma document itself. |
forma_preview Render a picture of a document
Builds a .forma document and returns a PNG of it, rendered from one or more views - look at it to check that the parts are where you meant them to be, which the measurements alone cannot tell you. Orthographic, shaded in each part's colour, with outlines and a small X (red) / Y (green) / Z (blue) axis marker in each view; Z is up. Several views are laid out in a grid, in the order given, each framed on its own. Views: iso, front, back, right, left, top, bottom. Writes nothing.
| Parameter | Type | Description |
|---|---|---|
model | string | Which model to build. Defaults to the first one declared. |
params | object | Values for the document's params, by name. Anything not given uses its default. |
path | string | A .forma file the client has given access to, instead of `source`. |
size | integer | Width of the whole image in pixels. Default 640. |
source | string | The .forma document itself. |
views | array | Which views, in reading order. Default ["iso"]; ["iso", "front", "right", "top"] for a sheet. |