mat_add
Add a material from a COMSOL material library to a model component, assign it to domains, and create an editable copy or live library link with optional property overrides.
Instructions
Add (copy) a material from a COMSOL material library to a component.
Reproduces the GUI "Add Material from Library" workflow: creates a
LibraryLink material, loads the library values with reload() and
by default unlinks it into an ordinary editable material with real
library expressions (including temperature-dependent functions).
Args:
name: exact library material name, e.g. "Copper", "Silicon",
"Water, liquid" (see mat_library_search / mat_library_list).
A full path such as "comsol_basic_material_lib.copper" also works.
library: library id or label to disambiguate ("Built-in", "Fluids",
"Optical", ...). Recommended when a name exists in several
libraries (e.g. "Air").
component: component tag (default "comp1"); pass "" or "global" to
create a global material under model definitions.
selection: domain numbers to assign the material to (3D: domains,
2D: domains). Omit to leave the material unassigned.
named: named selection tag to assign instead of selection.
all_domains: true = assign all domains.
unlink: true (default) = editable copy; false = keep it as a live
library link (read-only, updates with the library).
label: custom display name (default: the library material name).
tag: custom material tag (default auto mat1, mat2, ...).
properties: optional property overrides applied to the Basic group,
e.g. {"density": "8000[kg/m^3]"}.
model: model name/tag (None = current model).
Returns:
{"tag", "label", "material_path", "library", "match_type",
"alternatives", "properties" (key values), "selection"}.
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": {
"name": "<name>"
},
"name": "mat_add"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| tag | No | ||
| name | Yes | ||
| label | No | ||
| model | No | ||
| named | No | ||
| unlink | No | ||
| library | No | ||
| component | No | comp1 | |
| selection | No | ||
| properties | No | ||
| all_domains | No |