bimtex
For agents

Tool schemas

Bind the complete model and atomic edit contracts instead of asking an agent to remember the wire format.

import { BIMTEX_MODEL_TOOL, BIMTEX_OP_TOOL } from 'bimtex/ai';

BIMTEX_MODEL_TOOL accepts an ordered entity array. The schema carries the same controlled enums and required fields as the validator.

BIMTEX_OP_TOOL accepts one of four operations:

set · move · add · remove

One measured caveat: some providers' function-calling subsets drop oneOf unions in translation, and a model handed the stripped schema fills the array with JSON strings. The shipped drafter therefore declares only the container for its write tool — op as an enum, fields free — and lets the syntax card carry the shape. If your provider honours the full schema, bind it; if entities start arriving as strings, declare less on purpose.

The tool boundary should return compiler diagnostics verbatim. Every message names the entity, the violated rule and a suggested fix so the next model turn has a concrete repair action.

Never accept a drawing as the source of truth. The agent writes entities; the application recompiles all views from those entities.