comsol_python
Run custom Python inside a live COMSOL Multiphysics session to access the Java API, create physics, modify models, or execute operations not covered by standard tools.
Instructions
在当前 COMSOL 会话里执行 Python 代码(COMSOL Java API 逃生舱)。可用变量:model(mph Model)、java(model.java,com.comsol.model.Model)、client、mph、np、json。最后一行若是表达式会作为返回值。示例:java.modelNode('comp1').physics().create('ht','HeatTransfer','geom1')
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": {
"code": "<code>"
},
"name": "comsol_python"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |