Create model
create_modelCreate a new model from a declarative ModelSpec. The spec carries the JSON schema plus derivations (computed fields), constraints (invariants), and optional effects. Returns the created id. Fails (isError) on an invalid spec. If the requested id is already taken, a numeric postfix (-2, -3, …) is appended so the create still succeeds — always read the returned id, it may differ from the one you sent. When paired with a browser (remote_with_browser mode), ALWAYS include a viewDefinition in the spec so the model is immediately visible/usable in the sandbox — do not omit it and wait to be asked for one afterward. See the valem://guide/view-system resource for the component catalog.
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": {
"spec": "<spec>"
},
"name": "create_model"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| spec | Yes | A full ModelSpec document (id, schema, derivations, constraints, effects, defaultValues, views). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | No | The model id. | |
| version | No | The spec version. | |
| effectCount | No | Number of effects. | |
| constraintCount | No | Number of constraints. | |
| derivationCount | No | Number of derivations. | |
| metaDerivationCount | No | Number of meta-derivations. |