Skip to main content
Glama
COMSOL Multiphysics MCP Server

COMSOL Multiphysics MCP Server

by zixuanguo89

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault
COMSOL_MCP_CORESNoNumber of solver cores. Default is 0, meaning all available cores.
COMSOL_MCP_CONFIGNoPath to a JSON settings file. Default is empty.
COMSOL_MCP_FFMPEGNoPath to ffmpeg for MP4 animation. Auto-detected by default.
COMSOL_MCP_VERSIONNoCOMSOL version to use, for example 6.4. Defaults to the latest installed version.
COMSOL_MCP_WORKDIRNoWorkspace root directory. Default is <cwd>\comsol_workspace.
COMSOL_MCP_DOC_ROOTNoRoot directory of offline COMSOL HTML documentation used by docs_search(scope="help"). Auto-detected by default.
COMSOL_MCP_LOG_FILENoLog file path. Default is <workdir>\logs\...
COMSOL_MCP_AUTOSTARTNoWhether to automatically start COMSOL on the first COMSOL tool call. Default is 1.
COMSOL_MCP_LOG_LEVELNoLog level. Default is INFO.
COMSOL_MCP_TOOL_DENYNoComma-separated denylist of tool names or prefixes, for example java_eval. Default is empty.
COMSOL_MCP_ALLOW_EVALNoSet to 0 or false to disable the java_eval tool. Default is 1.
COMSOL_MCP_KEEP_ALIVENoWhether to keep COMSOL running after the MCP server exits. Default is 1.
COMSOL_MCP_MODEL_ROOTNoSaved model directory. Defaults to a subdirectory of the workspace.
COMSOL_MCP_TOOL_ALLOWNoComma-separated allowlist of tool names or prefixes. Default is empty.
COMSOL_MCP_COMSOL_ROOTNoCOMSOL installation root directory, for example C:\Program Files\COMSOL\COMSOL64. Auto-detected by default.
COMSOL_MCP_SERVER_PORTNoCOMSOL server port. Default is 0, meaning a random port.
COMSOL_MCP_CONNECT_HOSTNoHost to connect to. Default is localhost.
COMSOL_MCP_SESSION_MODENoSession mode: client-server or stand-alone. Default is client-server.
COMSOL_MCP_TOOL_PROFILENoTool exposure profile: full (all 274 tools), minimal (166 core tools), or custom. Default is full.
COMSOL_MCP_ARTIFACT_ROOTNoArtifact output directory. Defaults to a subdirectory of the workspace.
COMSOL_MCP_SOLVE_TIMEOUTNoTimeout for synchronous solves in seconds. Default is 0, meaning no timeout.
COMSOL_MCP_START_TIMEOUTNoNumber of seconds to wait for COMSOL startup. Default is 180.
COMSOL_MCP_MAX_OUTPUT_ITEMSNoMaximum number of items returned in lists. Default is 400.

Instructions

Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.

COMSOL Multiphysics MCP (273 tools, COMSOL 6.x)

This server drives the locally installed COMSOL Multiphysics through its Java client API: full model building (geometry, materials, physics, multiphysics, mesh), solving (all study types), results evaluation, plotting, simulation animations (GIF/MP4), data/file/report export, plus the official COMSOL example model library (2,081 models) and a curated knowledge base.

Typical workflow

  1. session_start (once per session; session_status to check) then model_create(dimension=3) (2 for 2D, 1 for 1D).

  2. parameter_set(...) early; build geometry with geom_primitive, geom_boolean, geom_transform, geom_extrude, geom_build. Find entity numbers for boundary conditions with geom_entity_info (entity_dim: 3=domains, 2=boundaries, 1=edges) and geom_selection_actions.

  3. Materials: mat_library_search -> mat_add, or mat_create for manual properties; assign with mat_assign.

  4. Physics: phys_add(type="HeatTransfer"), then phys_add_bc (friendly aliases such as temperature/heat_flux/inlet/outlet/fixed/ground) or phys_add_feature + phys_set_property / phys_set_selection. Couplings: multiphysics_add.

  5. Mesh: mesh_create_sequence -> mesh_auto_size / mesh_set_size -> mesh_build -> mesh_stats.

  6. Study: study_stationary / study_transient / study_eigenfrequency / study_frequency / study_parametric (create + solve), or fine-grained study_create + study_add_step + study_solve. Long solves: study_solve_async then job_status / study_solve_wait.

  7. Results: result_eval_point, result_integrate, result_average, result_minmax, result_eval_global, result_export_data, result_eval_all_solutions; datasets via dataset_create.

  8. Visuals: plot_quick(expr="T") for a one-call rendered PNG; plot_group_create + plot_add_feature + plot_export_image for full control; visual_view_image shows an exported image inline.

  9. Animation (flagship): anim_quick(expr="T", formats=["gif","mp4"]) or anim_create(plotgroup=...); native COMSOL animation via anim_export; visual_view_animation shows sampled frames inline.

  10. Export/report: export_model_file, export_model_java, export_mesh, export_geometry, report_create + report_add_section + report_generate (HTML/DOCX). Save with model_save.

Rules of thumb

  • Always check session_status; call session_start if disconnected. One COMSOL server accepts one client only — never share a COMSOL server between MCP clients.

  • Discover valid type strings with catalog_* tools (932 physics interfaces, 7,343 physics features, 97 geometry features, 51 mesh features, 81 study steps): catalog_physics_interfaces, catalog_physics_features, catalog_geometry_features, catalog_mesh_features, catalog_study_features, catalog_types.

  • Unsure about a node's property names? tree_properties / tree_info first, then tree_set_property; tree_children browses anything in the model tree.

  • Need domain guidance? docs_workflow(goal=...), docs_get(name=...), docs_search(query=...); need a real example project? library_search -> library_describe -> library_load/library_run.

  • Entity dimensions: 3=domains, 2=boundaries/faces, 1=edges, 0=points (3D); in 2D: 2=domains, 1=boundaries, 0=points.

  • Expressions carry units: "400[K]", "1e4[W/m^2]", "0.1[m]".

  • Every export returns an absolute path under the workspace artifact_root.

  • Ultimate escape hatch: java_eval(code=...) executes Python against the live Java API objects (model, jm, client, jcast/jset/jget, tree).

Capabilities

Features and capabilities supported by this server

Protocol revision2025-11-25

CapabilityDetails
tools
{
  "listChanged": false
}
prompts
{
  "listChanged": false
}
resources
{
  "subscribe": false,
  "listChanged": false
}

Tools

Functions exposed to the LLM to take actions

NameDescription
anim_exportA

Export a COMSOL-native animation of a plot group (movie or image sequence).

Creates result().export().create(tag, "Animation"), applies the COMSOL 6.4 Animation properties, runs it, and validates the output (GIF frame count with Pillow, video frame count with imageio).

Args: plotgroup: plot group tag to animate, e.g. "pg1" (see anim_list / plot_list). format: movie container: "gif" (no external deps, default), "avi" or "webm". output: output path. Movie: e.g. "C:/out/heat.gif". For kind="imageseq" pass the frame base path, e.g. "C:/out/frame" -> frame1.png, frame2.png, ... Omit to auto-generate under the artifact workspace. kind: "movie" (default) or "imageseq" (numbered PNG frames). fps: frames per second for movies (positive int, default 10). maxframes: number of frames (>= 2, default 25). Fewer stored solutions produce fewer frames; COMSOL samples the available range evenly. width: frame width in px (default 640, used when size="manual"). height: frame height in px (default 480). size: "manual" (default) | "current" | "hd". sweeptype: "solutions" (default) | "parameter" | "globalparameter" | "dde" | "streamline". solnumtype: parametric sweep selection: "all" (default) | "level1" | "level2" | "level3" | "inner" | "outer". solnum: explicit 1-based solution numbers to animate, e.g. [1,3,5]. looplevel: explicit loop-level solution indices, e.g. [1,2,3,4]. framesel: "all" | "number" (COMSOL default "number" = use maxframes). background: "current" | "color" | "fromtheme" | "transparent". reverse: true = play the animation backwards (time reversal). image_options: "on"/"off" — enable optional image components (title/legend/axes/logo). show_legend: plot legend on/off when image_options="on". show_title: plot title on/off when image_options="on". extra_properties: raw COMSOL Animation export properties to override, e.g. {"repeat": "forever", "resolution": "150"}. tag: explicit export feature tag (auto "anim1", "anim2", ...). model: model name/tag (None = current model).

Returns: JSON with path, size, format, frame count, dimensions, fps, duration and valid flag; for image sequences also frame_paths.

anim_export_framesA

Export a numbered PNG image sequence from a COMSOL plot group (native imageseq).

This is COMSOL's own frame exporter: it writes <base>1.png, <base>2.png, ... and is the fastest way to dump every animation frame to disk (later compose them with media_frames_to_gif / media_frames_to_mp4, or use anim_create which does both steps automatically).

Args: plotgroup: plot group tag to export, e.g. "pg1". directory: directory for the frames (default: artifact workspace). base: frame base name/path, e.g. "C:/out/frame" -> frame1.png, ...; the actual COMSOL naming is discovered automatically. maxframes: maximum number of frames to write (>= 2, default 25). width: frame width in px (default 640). height: frame height in px (default 480). solnumtype: "all" | "level1" | "level2" | "level3" | "inner" | "outer". solnum: explicit 1-based solution numbers, e.g. [1,2,3,4]. sweeptype: "solutions" (default) | "parameter" | "globalparameter". tag: explicit Animation export feature tag. model: model name/tag (None = current model).

Returns: JSON with directory, frame_paths, frame count, base path and validity.

anim_createA

Render a simulation animation from an existing plot group (custom pipeline).

Recommended default for building animations: exports one PNG per transient time step (plot-group property t) or per solution (property solnum) with a fixed colour range, then composes the frames into a GIF and/or MP4. Works for transient heat/flow/structural studies and for parametric sweeps, eigenfrequency and frequency-domain solution sets.

Args: plotgroup: plot group tag with the quantity to animate, e.g. "pg1". formats: ["gif"] (default), ["gif","mp4"] or ["mp4"]. MP4 requires imageio + imageio-ffmpeg (media_tools_status reports availability). fps: animation speed, frames per second (default 10). width: frame width in px (default 640). height: frame height in px (default 480). mode: "auto" (default; detects transient vs parametric from the dataset), "time" (transient time steps), "solutions" (1-based solution index), "static" (single frame). times: explicit time values for transient frames, e.g. [0,1,2,5,10] (interpolated times are supported by COMSOL). solnums: explicit 1-based solution indices, e.g. [1,2,3,4]. max_frames: cap the number of frames (evenly spaced selection). range_mode: "common" (default; one colour range for all frames, no flicker), "auto" (per-frame COMSOL range) or "manual" (use color_range). color_range: [min, max] data range for range_mode="manual", e.g. [293.15, 400.0] for a temperature animation. colortable: COMSOL colour table name, e.g. "ThermalLight" or "Rainbow". title: optional title text burned into every frame (Pillow overlay). loop: GIF loop count (0 = loop forever, default). output: explicit output file path (only when one format is requested), e.g. "C:/out/heat.gif". output_directory: directory for generated GIF/MP4 files. frames_directory: directory for intermediate PNG frames. keep_frames: keep intermediate PNG frames on disk (default false). model: model name/tag (None = current model).

Returns: JSON with frame count/directory/frames, mode used, colour range and the generated "gif"/"mp4" objects (path, size, frame count, duration, valid), plus "preview" (first frame PNG) and "primary" (best artifact path).

anim_quickA

One-call animation: plot an expression over time/solutions and write GIF/MP4.

Creates a plot group + plot feature for expression, renders every transient time step (or every parametric solution), locks the colour range and composes a GIF (+MP4 if requested) — the fastest path from a solved model to a real animation file.

Args: expression: COMSOL expression to plot, e.g. "T", "ht.T", "u", "sqrt(u^2+v^2)". plot_type: "surface2d" (default for 2D models) | "surface3d" | "volume" | "slice" | "contour2d" | "isosurface" | "arrow2d" | "arrow3d" | "streamline" | "line" | "global" | "point". dataset: dataset tag, e.g. "dset1" (None = COMSOL default dataset). formats: ["gif"] (default) | ["gif","mp4"] | ["mp4"] (mp4 needs imageio-ffmpeg). fps: frames per second (default 10). width: frame width px (default 640). height: frame height px (default 480). mode: "auto" (default) | "time" | "solutions" | "static". times: explicit transient times, e.g. [0,2,4,6,8,10]. solnums: explicit 1-based solution indices. max_frames: cap number of frames. range_mode: "common" (default) | "auto" | "manual". color_range: [min, max] data range for range_mode="manual". colortable: COMSOL colour table, e.g. "ThermalLight". title: title text burned into each frame. output: explicit output path for a single-format run. output_directory: directory for generated GIF/MP4 files. frames_directory: directory for intermediate PNG frames. model: model name/tag (None = current model).

Returns: JSON with plotgroup, expression, frame count, colour range and the generated gif/mp4 artifact objects (path, size, frames, duration, valid).

anim_listA

List animation export features and plot groups that can be animated.

Use this first to discover: (a) existing COMSOL Animation export features and their settings/output files, (b) every plot group with its dataset, solution, frame mode ("time"/"solutions"/"static") and frame count, and (c) whether GIF/MP4 tooling is available.

Args: model: model name/tag (None = current model).

anim_removeA

Remove a COMSOL Animation export feature from the results tree.

Args: tag: animation export feature tag, e.g. "anim1" (see anim_list). model: model name/tag (None = current model).

anim_add_titleA

Add a title bar/overlay to every frame of an existing GIF or video.

Args: source: input animation path (.gif, .mp4, .avi, .webm). title: title text (\n creates multiple lines). output: output path (.gif or .mp4); defaults to beside the input with a "_titled" suffix; format follows the output suffix. position: "top" (default) | "bottom" | "overlay-top" | "overlay-bottom". font_size: title font size in px (default 18). fps: output frame rate (default: detected from the source, else 10).

anim_resizeA

Resize an animation (GIF/video) — proportional or exact dimensions.

Args: source: input animation path. output: output path (.gif or .mp4); defaults beside the input with a "_resized" suffix. width: target width in px (height follows the aspect ratio when only width is given). height: target height in px (width follows the aspect ratio when only height is given). fps: output frame rate (default: detected from the source, else 10).

anim_combineB

Concatenate several animations (or frame sets) into one GIF/MP4.

Args: inputs: list of animation paths (.gif/.mp4) or frame directories, played in the given order. output: output path (.gif or .mp4); default auto-generated .gif. fps: output frame rate (default: detected from the first input, else 10). max_width: downscale all frames to at most this width.

anim_previewA

Extract a preview image of an animation (first frame and/or contact sheet).

Args: source: animation path (.gif/.mp4) or frames directory. output: output PNG path (auto-generated when omitted). contact_sheet: true = also build a grid montage of up to max_frames frames (useful to visually QA the animation). columns: contact sheet column count (default 4). max_frames: maximum frames in the contact sheet (default 24).

anim_extract_framesB

Extract frames from a GIF/video into numbered PNG files.

Args: source: animation path (.gif, .mp4, .avi, .webm). directory: output directory (default: artifact workspace). prefix: file prefix, e.g. "frame" -> frame0001.png. max_frames: maximum number of frames to extract.

anim_convertA

Convert an animation between formats (e.g. GIF -> MP4 or MP4 -> GIF).

Args: source: input animation path. output: output path; suffix decides the container (.gif or .mp4). fps: output frame rate (default: detected from the source, else 10). max_frames: use at most this many frames.

media_frames_to_gifA

Compose PNG/JPG image frames into an animated GIF (Pillow; no COMSOL needed).

Args: frames: list of image paths, or a one-element list containing a frames directory, e.g. ["C:/out/frames"] (files are sorted naturally). output: output .gif path (auto-generated when omitted). fps: frames per second (default 10; converted to GIF frame duration). loop: 0 = loop forever (default), n = repeat n times. optimize: optimise the GIF palette/file size. title: optional title text drawn on every frame. title_position: "top" (default) | "bottom" | "overlay-top" | "overlay-bottom". title_font_size: title font size px (default 18). max_width: downscale frames wider than this. max_frames: keep at most this many frames (evenly spaced). hold_last_s: extra seconds to show the last frame.

media_frames_to_mp4A

Compose PNG/JPG image frames into an H.264 MP4 (imageio + imageio-ffmpeg).

Requires imageio and imageio-ffmpeg (check media_tools_status). Frames are padded to even dimensions automatically (H.264 requirement).

Args: frames: list of image paths or a one-element frames directory list. output: output .mp4 path (auto-generated when omitted). fps: frames per second (default 10). quality: imageio-ffmpeg quality 0..10 (8 = good, default). title: optional title text drawn on every frame. title_position: "top" (default) | "bottom" | "overlay-top" | "overlay-bottom". max_width: downscale frames wider than this. max_frames: keep at most this many frames (evenly spaced). hold_last_s: extra seconds to show the last frame.

media_infoA

Probe an animation or image: frame count, duration, fps, dimensions, size.

Args: path: media file path (.gif, .mp4/.avi/.webm/.mov or .png/.jpg/.bmp).

media_tools_statusA

Report media tooling availability: Pillow, imageio, imageio-ffmpeg, ffmpeg.

Use before requesting MP4 output; GIF output only needs Pillow.

export_typesB

List file-export formats supported by COMSOL 6.4 (mesh, geometry, model).

vtu is NOT accepted by COMSOL 6.4's clientapi MeshExport in live testing; use nativeascii/stlbin/nastran/3mf instead.

export_listC

List result export features and available mesh/geometry export tools.

Args: model: model name/tag (None = current model).

export_meshA

Export a mesh to a file (STL, Nastran, 3MF, PLY, COMSOL native).

Uses COMSOL's mesh export tool: sets type, optional stlformat and selection, then calls mesh.export(path). The file is validated on disk (existence and byte size).

Args: tag: mesh tag (default "mesh1"; see export_list for tags). type: stl/stlbin (default), stlascii, nastran, 3mf, plybin, plyascii, nativebin (.mphbin), nativeascii (.mphtxt), sectionwise. vtu is not supported by COMSOL 6.4 clientapi. path: output file path (auto under artifact root when omitted). component: component tag owning the mesh; when omitted the model-level mesh(tag) accessor is tried first, then each component. selection: optional entity numbers to export (e.g. domain numbers). Omit for the whole mesh. stl_format: optional "binary"/"text" STL flavour. model: model name/tag (None = current model).

Example: export_mesh("mesh1", type="stl", path="C:/out/mesh.stl")

export_geometryA

Export a finalized geometry to STL, STEP, IGES, Parasolid, ACIS or native.

Uses COMSOL's geometry export tool: setType(...) then geom.export(path). The file is validated on disk.

Args: type: stl/stlbin (default), stlascii, step, iges, parasolidbin (.x_b), parasolidascii (.x_t), acisbin (.sab), acisascii (.sat), nativebin (.mphbin), nativeascii (.mphtxt). tag: geometry sequence tag (default "geom1"). path: output file path (auto under artifact root when omitted). component: component owning the geometry (default "comp1"). selection: optional geometry object numbers to export; omit for all. model: model name/tag (None = current model).

Notes: STEP/IGES/Parasolid/ACIS need the CAD Import Module or a CAD LiveLink license; STL and native formats work with the base installation. STL exports the boundary surface of the geometry.

Example: export_geometry("step", path="C:/out/part.step") export_geometry("stl", path="C:/out/part.stl")

export_model_fileA

Save the model as a COMSOL .mph file and report the written size.

Args: path: output .mph path (auto under <model_root>/exports/ when omitted). model: model name/tag (None = current model).

Returns: {"path","size","exists","format":"mph"}.

export_model_javaA

Export the model as a COMSOL Java model file (.java source).

Verified live in COMSOL 6.4: model.java.save(path, "java") writes a compilable Java class that rebuilds the model (a few KB; does not contain the solution data). Use export_model_file for a full .mph.

Args: path: output .java path (auto under artifact root when omitted). model: model name/tag (None = current model).

Returns: {"path","size","exists","format":"java"}.

export_plotA

Create (optionally run) a result Plot export feature.

The Plot export writes a plot group's raw data file. Available properties are returned so agents can discover the exact ones for their COMSOL version; property names can be passed via properties.

Args: tag: export feature tag. plotgroup: plot group tag to export (e.g. "pg1"). path: output file path; when given it is set with the first accepted filename property (filename / plotfilename). properties: extra properties for the export feature. run: run the export immediately (default True). model: model name/tag (None = current model).

Returns: {"tag", "type", "properties", "ran", "path", "size", "exists"}.

export_touchstoneA

Create (optionally run) a Touchstone (S-parameter) export feature.

Touchstone export is only meaningful for RF models with S-parameters (ElectromagneticWaves/Electrical Circuit terminals). Creating the feature works on any model; running it requires such a model.

Args: tag: export feature tag. path: output Touchstone path; tried with the filename properties of the feature (filename / touchstonefilename). plotgroup: optional plot group tag to bind. properties: extra properties, e.g. {"touchstoneversion": "1.0"}, {"referenceimpedance": "50[ohm]"}, {"smatrix": "..."}. run: run the export immediately (default True). model: model name/tag (None = current model).

Returns: {"tag", "type", "properties", "ran", "path", "size", "exists"}.

export_removeB

Remove a result export feature (Image/Plot/Touchstone/...).

Args: tag: result export feature tag. model: model name/tag (None = current model).

report_listB

List report features (Report/Presentation/Template) in the model.

Args: model: model name/tag (None = current model).

report_createA

Create a report feature and configure its output template/format.

COMSOL 6.4 facts discovered live: the template property accepts only "default" or "custom" (the old brief/intermediate/ complete names are NOT valid), and a Report supports only format = html or docx (PDF is not available through the clientapi). Add content with report_add_section / report_add_content, then write the file with report_generate.

Args: tag: report tag (default "rpt1"). report_type: Report (default) | Presentation | Template. template: "default" (default) or "custom" (with an imported template file). Ignored for Presentation/Template nodes. format: html (default) | docx for Report; Presentation uses pptx. Can be overridden in report_generate. title: optional title; creates a TitlePage content node carrying it. model: model name/tag (None = current model).

Returns: {"tag", "label", "type", "format", "template", "title_node"}.

report_add_sectionA

Add a top-level report section node (Section/TitlePage/TableOfContents).

Args: report: report tag (see report_list). section_type: Section (default, a content container) | TitlePage | TitleSlide | SectionSlide | TableOfContents. heading: section heading / page title. tag: node tag (auto e.g. sec1 when omitted). model: model name/tag (None = current model).

Returns: {"tag", "label", "type", "report"}.

report_add_contentA

Add a content node (plot, mesh, table, text, ...) inside a Section.

Content nodes reference existing model nodes through their noderef property (verified live: PlotGroup, Mesh, Geometry, Physics, Study, Parameter, Table, DerivedValues all accept noderef).

Args: report: report tag. section: target section tag (see report_add_section). content_type: PlotGroup (e.g. insert a rendered plot) | Table | DerivedValues | Mesh | Geometry | Physics | Study | Parameter | Graphics | Heading | Text | StringDataField | DataSet | Material | Model | Variables | Functions. tag: content node tag (auto when omitted). noderef: tag of the referenced node inside the model, e.g. "pg1" for a PlotGroup, "mesh1" for Mesh, "geom1" for Geometry, "ht" for Physics, "std1" for Study. text: text content for Text nodes (sets the text property). properties: extra properties to set on the content node (e.g. {"caption": "Temperature", "imagetype": "png"}). model: model name/tag (None = current model).

Returns: {"tag", "label", "type", "report", "section", "noderef"}.

report_generateA

Write the report to an HTML or DOCX file and verify it on disk.

A report with no content sections produces NO file (COMSOL returns without writing); add at least one Section with report_add_section / report_add_content first. HTML reports also create a sibling <stem>_files/ directory with the embedded PNGs.

Args: report: report tag (see report_list). path: output file path; extension chooses the format unless format is given. Defaults to <artifact_root>/<model>/<timestamp>_reports/<tag>.html. format: html | docx (Report nodes; Presentation uses pptx). model: model name/tag (None = current model).

Returns: {"path","size","format","exists","assets_dir","assets"}.

geom_listA

List the geometry sequences of all components with their settings.

Args: model: model name/tag (None = current model). Returns per-geometry dimension, axisymmetry, length unit, feature count, entity counts (if built) and bounding box.

geom_createA

Create a new geometry sequence for a component.

Args: geometry: tag of the new geometry (must be unique in the model), e.g. "geom2". component: component tag (None = first component, usually "comp1"). dimension: 3 (3D), 2 (2D), 1 (1D), or "2Daxi" for axisymmetric 2D. axisymmetric: mark a 2D geometry as axisymmetric (same as dimension="2Daxi"). model: model name/tag (None = current model).

geom_buildB

Build a geometry sequence (all features or up to one feature).

Args: geometry: geometry sequence tag (default "geom1"). upto: build only features up to and including this feature tag (None = all). model: model name/tag (None = current model). Returns entity counts, bounding box, object names and any build problems.

geom_run_featureA

Build the geometry up to and including one feature.

The returned counts reflect the current build state; call geom_build afterwards to build (and finalize) the whole sequence.

Args: tag: feature tag to run up to (e.g. "blk1", "dif1"). geometry: geometry sequence tag (default "geom1"). model: model name/tag (None = current model).

geom_validateA

Check a geometry sequence for problems (optionally rebuild first).

Args: geometry: geometry sequence tag (default "geom1"). build: run the sequence first to collect build errors (slower but thorough). model: model name/tag (None = current model).

geom_statsB

Summarize a geometry: space dimension, entity counts, bbox, objects.

Args: geometry: geometry sequence tag (default "geom1"). model: model name/tag (None = current model). Entity dimensions: 3 = domains, 2 = boundaries (faces), 1 = edges, 0 = points.

geom_bboxA

Return the bounding box of the geometry (or of selected objects).

Args: geometry: geometry sequence tag (default "geom1"). objects: object names to include (None = whole geometry). model: model name/tag (None = current model).

geom_entity_infoA

Enumerate geometry entities with bbox, center and measure (area/volume/length).

Use this to choose entity numbers for boundary conditions, e.g. find the top faces of a block (filter_bbox with zmin=zmax=0.02).

Args: entity_dim: 3 = domains, 2 = boundaries/faces, 1 = edges, 0 = points (in 2D use 2 = domains, 1 = boundaries, 0 = points). filter_bbox: optional [xmin,xmax,ymin,ymax(,zmin,zmax)] with null for unbounded sides, e.g. [null,null,null,null,0.019,0.021]. condition: how to compare an entity bbox with filter_bbox: "inside" (default), "intersects", or "center". tol: tolerance for the bbox comparison (in geometry length units). limit: maximum number of entities returned (default 100, max 500). geometry: geometry sequence tag (default "geom1"). model: model name/tag (None = current model).

geom_addA

Create any geometry feature (type from the geometry catalog).

Args: feature_type: COMSOL geometry feature type, e.g. "Block", "Cylinder", "Difference", "Array", "BoxSelection", "Fillet3D", "Import". Invalid types return suggestions from the catalog. tag: feature tag (None = generated from the catalog tag prefix). label: optional display label. properties: dict of feature properties, e.g. {"size": ["0.1","0.05","0.02"]}. build: build the sequence after creating the feature (default true). geometry: geometry sequence tag (default "geom1"). component: component tag (None = auto). model: model name/tag (None = current model).

geom_primitiveA

Create a primitive geometry object with ergonomic aliases.

Args: kind: Block | Cylinder | Sphere | Cone | Torus | Pyramid | Hexahedron | Tetrahedron | Ellipsoid | Helix | Point | LineSegment | Polygon | Rectangle | Square | Circle | Ellipse | Interval (aliases: box, ball, rect, disk, line...). size: size expressions; Block [l,w,h], Rectangle [w,h], Square/Interval scalar. Units follow the geometry length unit, e.g. ["0.1","0.05","0.02"]. pos: position [x,y] or [x,y,z] (base point; see base property). r: radius (Cylinder/Sphere/Cone/Circle/Torus major radius). h: height (Cylinder/Cone). axis: axis direction vector (3 values) or "x"/"y"/"z". rot: rotation angle in degrees (about pos / z-axis). rmin: minor radius (Torus/Helix). rmaj: major radius (Torus/Helix; overrides r for those kinds). semiaxes: Ellipsoid semi-axes [a,b,c] (overrides r). turns: Helix number of turns. points: Hexahedron 3x8 / Tetrahedron 3x4 coordinate matrix (rows x,y,z) or LineSegment endpoints [[x1,y1(,z1)],[x2,y2(,z2)]]. connames: LineSegment coordinate overrides {"coord1": [...], "coord2": [...]}. properties: extra/override COMSOL properties, e.g. {"base": "center"}. tag: feature tag (None = automatic, e.g. blk1). label: display label. build: build after creation (default true). geometry: geometry sequence tag (default "geom1"). component: component tag (None = auto). model: model name/tag (None = current model).

geom_booleanB

Combine geometric objects with a Boolean operation.

Args: operation: Union | Intersection | Difference | Compose | Partition (case-insensitive; "difference" removes subtract from input). input: object names to combine, e.g. ["blk1","cyl1"] or ["blk1"]. subtract: objects to subtract (Difference only), e.g. ["cyl1"]. formula: set formula for Compose, e.g. "blk1+cyl1-blk2". keep: keep input objects (Union/Intersection/Compose). intbnd: keep interior boundaries ("on"/"off", bool accepted). properties: extra properties, e.g. {"keepadd": "on"}. tag: feature tag (None = automatic, e.g. dif1). label: display label. build: build after creation (default true). geometry: geometry sequence tag (default "geom1"). component: component tag (None = auto). model: model name/tag (None = current model).

geom_transformA

Move, copy, rotate, scale, mirror, array or rigidly transform objects.

Args: operation: Move | Copy | Rotate | Scale | Mirror | Array | RigidTransform. objects: object names to transform (e.g. ["blk1"]). displ: translation vector for Move/Copy/Array, e.g. ["0.1","0","0"]. pos: center point for Rotate/Scale/Mirror, e.g. ["0.05","0.025","0"]. axis: axis/normal vector for Rotate/Mirror, e.g. ["0","0","1"] or "z". rot: rotation angle in degrees (Rotate/RigidTransform). factor: scale factor (Scale), scalar or [sx,sy,sz]. size: array size (Array): integer (linear) or [n1,n2,n3] (rectangular/3D). properties: extra COMSOL properties (e.g. {"keep": "on"}). tag: feature tag (None = automatic, e.g. mov1). label: display label. build: build after creation (default true). geometry: geometry sequence tag (default "geom1"). component: component tag (None = auto). model: model name/tag (None = current model).

geom_extrudeA

Extrude 2D work-plane objects (or planar faces) into 3D.

Args: distance: extrusion distance expression/humber, e.g. 0.2 or "0.2". A list creates several layers, e.g. [0.1, "0.2"]. input_objects: work-plane tags/objects to extrude (None = objects of the last preceding work plane). scale: scale factor of the extrusion top (optional). twist: twist angle in degrees (optional). properties: extra COMSOL properties for the Extrude feature. tag: feature tag (None = automatic, e.g. ext1). label: display label. build: build after creation (default true). geometry: geometry sequence tag (default "geom1"). component: component tag (None = auto). model: model name/tag (None = current model).

geom_revolveB

Revolve 2D work-plane objects into 3D.

Args: angle: revolution angle in degrees (360 = full revolution). input_objects: work-plane tags/objects to revolve (None = last work plane). pos: point on the axis in the work-plane local system, e.g. [0, 0]. axis: axis direction in the work-plane local system, e.g. [0, 1]. properties: extra COMSOL properties (e.g. {"axistype": "2d"}). tag: feature tag (None = automatic, e.g. rev1). label: display label. build: build after creation (default true). geometry: geometry sequence tag (default "geom1"). component: component tag (None = auto). model: model name/tag (None = current model).

geom_sweepA

Sweep faces/edges/points along a spine curve.

Args: entities: entities to sweep as {"object": [entity numbers]}, e.g. {"blk1": [3]}; or a flat list with a single object in the geometry. entity_dim: dimension of the entities to sweep (default 2 = faces). spine: spine edges as {"object": [edge numbers]}, e.g. {"ls1": [1]}. properties: extra COMSOL properties (e.g. {"keep": "on"}). tag: feature tag (None = automatic, e.g. swe1). label: display label. build: build after creation (default true). geometry: geometry sequence tag (default "geom1"). component: component tag (None = auto). model: model name/tag (None = current model).

geom_loftB

Loft between a list of profile faces/edges/points.

Args: profiles: geometry object names used as loft profiles, in order, e.g. ["wp1", "wp2"] or named-selection tags. properties: extra COMSOL properties (e.g. {"unite": "on"}). tag: feature tag (None = automatic, e.g. loft1). label: display label. build: build after creation (default true). geometry: geometry sequence tag (default "geom1"). component: component tag (None = auto). model: model name/tag (None = current model).

geom_thickenA

Thicken surfaces/boundaries into a solid shell (3D) or 2D thicken.

In 3D the COMSOL Thicken feature operates on whole SURFACE objects (e.g. a primitive created with properties={"type": "surface"}) and turns them into solid shells; in 2D Thicken2D operates on boundary edges.

Args: objects: surface object names to thicken (3D), e.g. ["blk1"] (None = all current objects). In 2D these are ignored. entities: boundaries to thicken as {"object": [edge numbers]} (2D only). entity_dim: entity dimension for the 2D selection (default 1 = boundaries). thickness: total thickness (symmetric offset), e.g. 0.002. offset: "symmetric" (default) or "asymmetric". upthick: upward thickness for asymmetric offset. downthick: downward thickness for asymmetric offset. keep: keep input objects. properties: extra COMSOL properties. tag: feature tag (None = automatic, e.g. thi1). label: display label. build: build after creation (default true). geometry: geometry sequence tag (default "geom1"). component: component tag (None = auto). model: model name/tag (None = current model).

geom_midsurfaceB

Extract the midsurface of thin solid objects (3D).

Args: objects: solid object names to extract the midsurface from (None = all current objects). properties: extra COMSOL properties (e.g. {"keep": "on"}). tag: feature tag (None = automatic, e.g. mid1). label: display label. build: build after creation (default true). geometry: geometry sequence tag (default "geom1"). component: component tag (None = auto). model: model name/tag (None = current model).

geom_workplaneB

Create a work plane (and optionally 2D features inside it).

Args: quickplane: coordinate plane of a quick work plane: xy | yz | zx | yx | zy | xz. quickx/quicky/quickz: offset coordinate of the plane (depends on quickplane). planetype: advanced work plane definition type (None = "quick"). features: 2D features created inside the work plane, each a dict like {"type": "Rectangle", "size": ["1","0.5"], "pos": ["0","0"]}. Supported keys: type, tag, label, properties (+ the primitive aliases size/pos/r/rot/semiaxes). properties: extra WorkPlane properties. tag: feature tag (None = automatic, e.g. wp1). label: display label. build: build the sequence after creating/building the plane (default true). geometry: geometry sequence tag (default "geom1"). component: component tag (None = auto). model: model name/tag (None = current model).

geom_filletA

Round corners/edges with a fillet (2D vertices or 3D edges).

Args: entities: vertices to fillet in 2D as {"object": [vertex numbers]}, or edges in 3D as {"object": [edge numbers]}. A flat list is accepted when the geometry has exactly one object. objects: object names (needed for a flat entity list with several objects). radius: fillet radius in geometry length units, e.g. 0.1. properties: extra COMSOL properties. tag: feature tag (None = automatic, e.g. fil1). label: display label. build: build after creation (default true). geometry: geometry sequence tag (default "geom1"). component: component tag (None = auto). model: model name/tag (None = current model).

geom_chamferA

Bevel corners/edges with a chamfer (2D vertices or 3D edges).

Args: entities: vertices to chamfer in 2D as {"object": [vertex numbers]}, or edges in 3D as {"object": [edge numbers]}. objects: object names (for a flat entity list). distance: chamfer distance in length units (2D "dist"; 3D uses the COMSOL Chamfer3D radius-like property with the same value). properties: extra COMSOL properties (may override distance). tag: feature tag (None = automatic, e.g. cha1). label: display label. build: build after creation (default true). geometry: geometry sequence tag (default "geom1"). component: component tag (None = auto). model: model name/tag (None = current model).

geom_importB

Import a CAD or mesh file into the geometry sequence (STEP/IGES/DXF/STL...).

Args: filename: absolute path to the file (STL, STEP, IGES, DXF, mphbin, ...). tag: feature tag (None = automatic, e.g. imp1). label: display label. properties: extra Import properties, e.g. {"importtype": "full3d", "type": "cad", "repairgeom": "on"} (COMSOL auto-detects most formats). build: build after importing (default true). geometry: geometry sequence tag (default "geom1"). component: component tag (None = auto). model: model name/tag (None = current model).

geom_exportB

Export geometry objects to a CAD/mesh file (STL, STEP, IGES, DXF, ACIS...).

Args: export_type: stl | stlascii | step | iges | dxf | acisbin | acisascii | parasolidbin | parasolidascii | nativebin | nativeascii. (VTK/3MF are not supported by COMSOL geometry export.) path: output file path; when omitted the file goes to the artifact workspace with an automatic name. objects: geometry object names to export (None = current objects). geometry: geometry sequence tag (default "geom1"). model: model name/tag (None = current model). Returns the absolute file path, size and confirmed existence.

geom_selection_actionsA

Create a geometry-sequence selection feature and return matched entity numbers.

The returned numbers are GLOBAL entity numbers of the finalized geometry (the same numbering physics boundary conditions use), so they can be passed straight to physics/material/feature selections.

Args: selection_type: BoxSelection | BallSelection | CylinderSelection | DiskSelection | ExplicitSelection | AdjacentSelection | UnionSelection | IntersectionSelection | DifferenceSelection | ComplementSelection | LogicalExpressionSelection. tag: selection feature tag (None = automatic, e.g. boxsel1). entity_dim: entity dimension to select: 3=domains, 2=boundaries, 1=edges, 0=points, -1=whole objects (default 2). entities: explicit entities for ExplicitSelection as {"object": [ids]}. xmin/xmax/ymin/ymax/zmin/zmax: box limits (BoxSelection); null = unbounded. condition: intersects | inside | somevertex | allvertices. pos: position for BallSelection ([x,y,z]) or CylinderSelection/DiskSelection (Disk: [x,y]; Cylinder: 3D base point). r: radius (Ball/Cylinder/Disk) or cylinder outer radius. axis: axis for CylinderSelection, e.g. ["0","0","1"] or "z". input/add/subtract: tags of preceding selection features used by the set-operation selections (Union/Intersection/Difference/Complement/ Adjacent/LogicalExpression). expression: logical expression for LogicalExpressionSelection, e.g. "sel1&!sel2" (use input tags). cumulative: also create a cumulative selection with this tag and let the new feature contribute to it. properties: extra selection feature properties (e.g. {"selshow": "off"}). label: display label. build: build the geometry after creating the selection (default true). geometry: geometry sequence tag (default "geom1"). component: component tag (None = auto). model: model name/tag (None = current model).

geom_delete_featureA

Delete a feature from a geometry sequence.

Args: tag: feature tag to delete (e.g. "cyl1"; the automatic "fin" cannot be deleted). geometry: geometry sequence tag (default "geom1"). model: model name/tag (None = current model).

geom_reorder_featureB

Move a feature to a new position in the geometry build order.

Args: tag: feature tag to move. index: target 0-based position among user features (0 = first). geometry: geometry sequence tag (default "geom1"). model: model name/tag (None = current model).

geom_get_propertiesB

Return all properties of a geometry feature (with value types).

Args: tag: feature tag (e.g. "blk1"). include_allowed: include allowed values (validates enums such as "on"/"off"). geometry: geometry sequence tag (default "geom1"). model: model name/tag (None = current model).

geom_set_propertiesA

Set properties on a geometry feature (expressions may include units).

Args: tag: feature tag (e.g. "blk1"). properties: dict of property name -> value, e.g. {"size": ["0.2","0.1","0.05"]} or {"r": "0.01"}. Invalid names return the available properties. build: rebuild the geometry after setting (default false). geometry: geometry sequence tag (default "geom1"). model: model name/tag (None = current model).

geom_rename_featureB

Change a feature's display label and/or its tag.

Args: tag: current feature tag. label: new display label (None = keep). new_tag: new programmatic tag (None = keep). Referenced selections may need updating afterwards. geometry: geometry sequence tag (default "geom1"). model: model name/tag (None = current model).

geom_measureA

Measure volume/area/length/bbox of selected entities on the finalized geometry.

Args: entity_dim: 3 = domains (volume), 2 = boundaries/faces (area), 1 = edges (length), 0 = points (coordinates). In 2D: 2 = domains (area), 1 = boundaries (length), 0 = points. entities: 1-based global entity numbers (None = all entities of that dimension). geometry: geometry sequence tag (default "geom1"). model: model name/tag (None = current model). Returns the primary metric (volume/area/length), bbox, vertex coords and the selected entity list.

java_evalA

Execute Python code against the live COMSOL Java API (escape hatch).

    The code runs inside the COMSOL worker thread. Assign to ``result`` to
    return a value. Example:
        code='''m = model.java

g = m.geom("geom1") g.run() result = {"domains": g.getNDomains(), "boundaries": g.getNBoundaries()}''' -> {"domains": 1, "boundaries": 6}

    Args:
        code: Python source. Names available: model, jm, client, mph, jcast,
              jset, jget, jprops, tree, jsonify, np.
        model: model name/tag for ``model`` (None = current model).
        timeout_s: advisory timeout for the tool call.
docs_listA

List the curated COMSOL guides bundled with this server.

Use this first when you need COMSOL domain knowledge (modelling workflow, geometry/physics/materials/mesh/study/results/plot/animation guides, API quirks, units, troubleshooting). Then call docs_get(name=...) to read one.

docs_getA

Return one curated COMSOL guide as Markdown text.

Available guides: getting_started, workflow_overview, geometry_guide, physics_guide, materials_guide, meshing_guide, study_solver_guide, results_guide, plotting_guide, animation_guide, troubleshooting, api_cheatsheet, units_and_expressions.

Args: name: guide name or alias (e.g. "geometry", "mesh", "study", "results", "animation", "api", "units"). Call docs_list for the full list.

docs_searchA

Search the knowledge base: curated guides and/or the installed COMSOL docs.

Args: query: free-text query, e.g. "heat flux boundary", "jacobian", "animation gif", "solid.mises", "selection empty". scope: "guides" (default, 13 curated guides), "help" (search the offline COMSOL 6.4 HTML documentation installed on this machine; manual, programming reference and API javadoc), or "all" (both). limit: maximum results (1-50, default 10).

docs_workflowA

Recommend an ordered MCP tool sequence and guides for a modelling goal.

Curated workflows exist for steady/transient heat transfer, structural mechanics, fluid flow, acoustics, electromagnetics, wave optics, particle tracing, parametric sweeps, animations and starting from an installed example model.

Args: goal: free text, e.g. "steady heat transfer", "stress analysis of a bracket", "laminar flow in a channel", "animate temperature", "parametric sweep". Omit to list all available workflows.

library_listA

Browse installed COMSOL example models grouped by module.

Args: module: module folder filter, substring/case-insensitive, e.g. "Heat_Transfer_Module", "ACDC", "Structural". dimension: "3D"/"3", "2D"/"2", "1D"/"1", or "unknown". category: category sub-folder filter, e.g. "Tutorials", "Verification", "Applications", "Phase_Change". limit: models returned per page (1-500, default 50). offset: page offset for paging through large result sets.

library_searchA

Search the installed COMSOL model library (keyword + physics/study filters).

Results are scored against title, physics interfaces, study steps, module and category. Use the returned id with library_describe/library_load.

Args: query: keywords matched against model title/physics/studies/path, e.g. "heat transfer", "conjugate heat transfer pipe", "eigenfrequency tuning fork", "brownian particle". physics: physics interface filter, e.g. "HeatTransfer", "SolidMechanics", "LaminarFlow", "Electrostatics" (substring, case-insensitive). study_type: study step filter: "Stationary", "Transient", "Frequency", "Eigenfrequency", "Parametric", "RayTracing", ... quick_only: only models expected to run in < 60 s (or < 10 MB when the stored run time is unknown). Default True; set False to include heavy models. module: optional module folder filter (e.g. "Heat_Transfer_Module"). dimension: optional "1D"/"2D"/"3D" filter. limit: maximum results (1-500, default 50).

library_describeA

Full metadata for one library model: physics, studies, documentation, cost.

Args: id_or_path: library id from library_search/library_list (e.g. "Heat_Transfer_Module/Tutorials,_Conduction/heat_conduction_in_slab"), a unique model stem, or an absolute path to any .mph file.

library_categoriesB

Module and category counts for the installed COMSOL model library.

library_statsB

Statistics of the installed model library: model counts, dimensions, study types.

library_loadA

Load an installed COMSOL example model (.mph) into the running session.

The original file is opened read-only; use model_save / library_run to write a copy into the workspace. Models with companion .mphbin data must be loaded from their installed path (this tool always does that).

Args: id_or_path: model id (from library_search) or absolute .mph path. name: optional name for the loaded model (default: file stem).

library_runA

Load a library model, solve it, and save a solved copy to the workspace.

Synchronous and blocking (all COMSOL work is serialised) -- intended for small models: check time_s in library_search/library_describe and prefer quick_only=true models for interactive use. Heavy models can take minutes.

Args: id_or_path: model id (from library_search) or absolute .mph path. study: optional study tag/name to solve (e.g. "std1"); default = all studies. save_path: target .mph path; default = workspace artifact root <artifact_root>/<model>/<timestamp>_library_run/<model>_solved.mph. name: optional model name in the COMSOL session (default: file stem).

mat_library_listA

List material libraries, or the materials of one library.

The catalog is built offline from the COMSOL installation (3141 materials in 19 libraries for COMSOL 6.4) and needs no running COMSOL session.

Args: library: library id or label, e.g. "comsol_basic_material_lib" or "Built-in" / "Fluids" / "AC/DC" / "Optical". Omit to list libraries. category: optional category filter (e.g. "Gases", "Liquids", "Rare earth permanent magnets") when listing materials. query: optional name/tag substring filter. limit: maximum number of materials to return (default 100, max 1000). offset: pagination offset. Returns: {"libraries": [...]} when no library is given, otherwise {"library": ..., "total": N, "materials": [{name, path, category, ...}]}.

mat_library_searchA

Search COMSOL material libraries by name/tag/category.

Args: query: search text, e.g. "copper", "ndfeb", "water", "glass". library: restrict to one library id/label (e.g. "Built-in", "Optical"). category: restrict to a category (e.g. "Liquids", "Gases"). property: only materials that define this property, e.g. "thermalconductivity" or "dynamicviscosity". limit: maximum number of results (default 30). Example: mat_library_search(query="water", library="Fluids", property="dynamicviscosity")

mat_library_categoriesA

List material-library categories (GUI folders) with material counts.

Args: library: restrict to one library id/label; omit to list all libraries. limit: maximum number of category rows returned. Example: mat_library_categories(library="Fluids") -> Gases (12), Liquids (13)

mat_library_infoA

Show full offline catalog data for one library material.

Returns the exact library path (<library>.<tag>) used by :func:mat_add, all property groups with their expressions, and the material functions involved (e.g. k(T)), plus alternatives when the name exists in several libraries.

Args: name: material display name ("Copper"), tag ("copper") or full path ("comsol_basic_material_lib.copper"). library: optional library id/label to disambiguate (e.g. "Fluids").

mat_addA

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"}.

mat_createA

Create a manual material with explicit properties (no library needed).

Args: name: material display name, e.g. "My alloy" (becomes the label). properties: Basic-group properties (def group), values are COMSOL expressions with units, e.g. {"thermalconductivity": "400[W/(mK)]", "density": "8960[kg/m^3]", "heatcapacity": "385[J/(kgK)]"}. Anisotropic tensors can be given as lists of 9 values. groups: extra property groups, e.g. {"Enu": {"E": "200[GPa]", "nu": "0.3"}}; group tags use COMSOL's built-in types ("Enu" = Young's modulus and Poisson's ratio, "linzRes", "idealGas", ...). material_type: "Common" (default, works for all physics) | "Solid" | "Fluid" | "PorousMedia" | "Multiphase" | "Switch" | "External" | "LayeredMaterial" | ... component: component tag (default "comp1"); "" or "global" = global. selection: domain numbers to assign the material to. named: named selection tag to assign instead of selection. all_domains: true = assign all domains. tag: material tag (default auto mat1, ...). label: custom label (default: name). model: model name/tag (None = current model). Example: mat_create(name="Steel custom", properties={"density": "7850[kg/m^3]", "thermalconductivity": "44.5[W/(mK)]", "heatcapacity": "475[J/(kgK)]"}, selection=[1])

mat_listA

List the materials of a component (and optionally global materials).

Args: component: component tag (default "comp1"); "" or "global" lists only global materials. include_global: also list global-definition materials. model: model name/tag (None = current model).

mat_propertiesA

Read all property groups and property values of a material.

For library materials the library link is refreshed (reload()) first so the real library values are shown.

Args: tag: material tag, e.g. "mat1" (see mat_list). component: component tag (default "comp1"); "" or "global" for global materials. group: read only this property group tag ("def", "Enu", ...). include_descriptions: include COMSOL's per-property descriptions (localized to the COMSOL installation language). model: model name/tag (None = current model). Example: mat_properties(tag="mat1", group="def") -> properties.thermalconductivity = "400[W/(m*K)]", density = "8960[kg/m^3]"

mat_set_propertyA

Set one material property (a COMSOL expression with units).

Args: tag: material tag, e.g. "mat1". property: property name, e.g. "thermalconductivity", "density", "heatcapacity", "youngsmodulus". Use mat_properties first to see valid names for the material. value: expression string ("400[W/(m*K)]"), number, or list of expressions for anisotropic/array properties (9 values for a 3x3 tensor). group: property group tag (default "def" = Basic). index: optional index for setting one element of an array property. component: component tag (default "comp1"); "" or "global". model: model name/tag (None = current model). Example: mat_set_property(tag="mat1", property="density", value="8000[kg/m^3]")

mat_assignB

Assign a material to domains (explicit numbers, named selection or all).

In COMSOL, materials are assigned to domains (3 in 3D, 2 in 2D).

Args: tag: material tag, e.g. "mat1". entities: domain entity numbers, e.g. [1, 2]. named: named selection tag (created with selection tools). all_domains: true = assign every domain. component: component tag (default "comp1"); "" or "global". model: model name/tag (None = current model).

mat_get_selectionB

Read the domain selection of a material.

Args: tag: material tag, e.g. "mat1". component: component tag (default "comp1"); "" or "global". model: model name/tag (None = current model).

mat_removeB

Remove a material from a component (or from global definitions).

Args: tag: material tag, e.g. "mat1". component: component tag (default "comp1"); "" or "global". model: model name/tag (None = current model).

mat_renameA

Rename a material's display label and/or change its tag.

Args: tag: current material tag, e.g. "mat1". label: new display name shown in COMSOL (e.g. "Copper (annealed)"). new_tag: new material tag, e.g. "copper" (references in tree paths change; selections are kept). component: component tag (default "comp1"); "" or "global". model: model name/tag (None = current model).

mat_import_xmlA

Import materials from a COMSOL material XML file (.xml) into the model.

The XML file may contain one or more <material> definitions in COMSOL's Model XML format (the same format as comsol_optical_lib.xml). When tags is omitted every material tag found in the file is imported.

Args: path: absolute path to the material XML file. tags: material tags inside the XML file to import (None = all). component: component tag (default "comp1"); "" or "global". model: model name/tag (None = current model).

mesh_listA

List mesh sequences with their geometry, features and element counts.

Args: component: restrict to one component tag (None = all components). model: model name/tag (None = current model).

mesh_create_sequenceA

Create a mesh sequence on a geometry.

Args: geometry: geometry tag to mesh, e.g. "geom1" (None = first geometry of the first component). tag: mesh sequence tag (None = auto "mesh1", "mesh2", ...). component: component tag (None = first component containing a geometry). auto_size: predefined mesh size 1 (extremely fine) ... 9 (extremely coarse). automatic: true = COMSOL automatic mesh (default), false = user-controlled. model: model name/tag (None = current model). Example: mesh_create_sequence(geometry="geom1", auto_size=5)

mesh_featuresA

List the features (and child features) of a mesh sequence.

Includes each feature's type, tag, label, selection and current properties (build metadata omitted).

Args: mesh: mesh sequence tag (None = first mesh sequence in the model). component: component tag (None = auto-detect from the mesh tag). model: model name/tag (None = current model).

mesh_add_featureA

Create a mesh feature of any COMSOL type (generic escape hatch).

Valid types come from catalog_mesh_features (e.g. FreeTet, FreeTri, Map, Sweep, BndLayer, Size, SizeExpression, Distribution, Refine, Import, CopyFace, CornerRefinement, Vertex, ...).

Args: feature_type: COMSOL mesh feature type, e.g. "FreeTet". mesh: mesh sequence tag (None = first). tag: feature tag (None = auto from the type, e.g. "ftet1"). properties: feature properties, e.g. {"method": "delaunay"}. Property names must match COMSOL's; use mesh_features to read the available names of existing features. selection: geometric entity numbers to select. named: named selection tag to select instead. all_entities: select all entities of entity_dim. entity_dim: selection dimension (3=domains, 2=boundaries, 1=edges, 0=points). Default depends on the feature type (FreeTet=domains, FreeTri/Map=boundaries in 3D, BndLayerProp=boundaries). parent: parent feature tag for child features (e.g. BndLayerProp under a BndLayer, CornerProp under CornerRefinement). component: component tag (None = auto-detect). model: model name/tag (None = current model).

mesh_set_propertyA

Set properties on an existing mesh feature (e.g. FreeTet method, BL layers).

Args: mesh: mesh sequence tag (None = first). feature: mesh feature tag, e.g. "ftet1" (None = the last feature). property: one property name, e.g. "method", "blnlayers". value: value for property. properties: alternatively a dict of several properties. component: component tag (None = auto-detect). model: model name/tag (None = current model). Example: mesh_set_property(feature="ftet1", properties={"method": "delaunay"})

mesh_auto_sizeB

Use a COMSOL predefined mesh size (1 = extremely fine ... 9 = extremely coarse).

Args: size: predefined size level 1..9 (default 5 = normal). mesh: mesh sequence tag (None = first). component: component tag (None = auto-detect). model: model name/tag (None = current model).

mesh_set_sizeA

Set explicit mesh size properties (hmax, hmin, growth rate, ...).

When user_controlled=True (default) the sequence is switched to a user-controlled mesh (automatic(false)), which is required for manual sizes to take effect. Without selection the global size feature is edited; with a selection a localized Size feature is created.

Args: hmax: maximum element size, e.g. "0.05" (model length unit) or "5[mm]". hmin: minimum element size. hgrad: maximum element growth rate (e.g. "1.5"). hcurve: curvature factor (e.g. "0.6"). hnarrow: resolution of narrow regions (e.g. "0.5"). hauto: predefined size level 1..9 (sets automatic sizing). mesh: mesh sequence tag (None = first). feature: existing size feature tag to edit (None = global "size"). selection: domain/boundary numbers for a localized size feature. named: named selection tag for the size feature. all_entities: apply the localized size to all entities. entity_dim: selection dimension for the localized size (default geom dim). user_controlled: switch the sequence to a user-controlled mesh (default true). component: component tag (None = auto-detect). model: model name/tag (None = current model). Example: mesh_set_size(hmax="0.02", hmin="0.002", hgrad="1.3")

mesh_free_tetA

Create (or configure) a FreeTet feature and select domains to mesh.

Args: properties: FreeTet properties, e.g. {"method": "delaunay"} or {"optlevel": "high"}. Known names: method, smoothcontrol, smoothmaxiter, smoothmaxdepth, optlevel, numlayer, xscale/yscale/zscale, ... selection: domain numbers to mesh (default all domains). named: named selection of domains instead of selection. all_domains: mesh all domains (default true; ignored when selection/named given). mesh: mesh sequence tag (None = first). component: component tag (None = auto-detect). model: model name/tag (None = current model).

mesh_free_triB

Create (or configure) a FreeTri feature (2D domains, or 3D boundaries).

Args: properties: FreeTri properties, e.g. {"method": "delaunay", "smoothmaxiter": "4"}. selection: entity numbers to mesh (2D: domains; 3D: boundaries). named: named selection instead of selection. all_entities: select all entities of the chosen dimension (default true). entity_dim: selection dimension (2D geometry: 2 = domains; 3D geometry: 2 = boundaries). Default is handled per dimension. mesh: mesh sequence tag (None = first). component: component tag (None = auto-detect). model: model name/tag (None = current model).

mesh_mappedA

Create a mapped mesh feature (quadrilateral/hexahedral surfaces).

In 2D the mapped mesh covers domains (quad elements); in 3D it maps boundary faces. The mapped region needs a compatible shape (4 edges); COMSOL reports a clear error otherwise.

Args: properties: Map properties, e.g. {"interpmethod": "auto"}. selection: domain/face numbers to map. named: named selection instead of selection. all_entities: select all domains/faces of the chosen dimension (default true). entity_dim: selection dimension (default 2: domains in 2D geometry, boundaries in 3D geometry). mesh: mesh sequence tag (None = first). component: component tag (None = auto-detect). model: model name/tag (None = current model).

mesh_sweepA

Create a swept mesh feature (hexahedral/prism elements along a sweep path).

Args: properties: Sweep properties, e.g. {"element": "hex", "sweeppath": "auto"} (element: "hex" | "hexdominant" | "prism"; default hexdominant). domains: domain numbers to sweep (default all domains). named: named selection of domains instead of domains. source_faces: source boundary numbers (optional; COMSOL picks the source automatically from the domain topology by default). target_faces: target boundary numbers (optional). all_domains: sweep all domains (default true; ignored when domains/named given). mesh: mesh sequence tag (None = first). component: component tag (None = auto-detect). model: model name/tag (None = current model). Example: mesh_sweep(domains=[1], source_faces=[1], properties={"element": "hex"})

mesh_boundary_layersA

Add boundary layers (prism elements) on selected boundaries.

Creates a BndLayer feature (selecting domains) with a BndLayerProp child (selecting faces). COMSOL only generates the layers when the child has a face selection, so this tool always assigns one (all faces by default).

Args: layers: number of boundary layers (default 3). stretching: stretching factor between consecutive layers (default 1.2). thickness: first-layer thickness or total thickness, e.g. "0.01" or "1[mm]"; omit to keep COMSOL's automatic thickness. thickness_type: "first" (default, thickness = first layer height) or "total" (thickness = total boundary-layer thickness). domains: domain numbers that receive boundary layers (default all). boundaries: face numbers that get layers (default all faces). named: named selection for the domains. all_domains: apply to all domains (default true). all_boundaries: apply to all boundaries (default true). properties: extra BndLayer/BndLayerProp properties, e.g. {"sharpcorners": "split", "method": "latest"}. mesh: mesh sequence tag (None = first). component: component tag (None = auto-detect). model: model name/tag (None = current model). Example: mesh_boundary_layers(layers=4, stretching=1.3, thickness="0.005", boundaries=[1, 2, 3])

mesh_runA

Build the mesh sequence (shortcut for the COMSOL "Build All").

Args: mesh: mesh sequence tag (None = first). feature: optional feature tag; when given it is validated and the whole sequence is built (COMSOL builds all features in order). component: component tag (None = auto-detect). model: model name/tag (None = current model). Returns: {"ran", "n_elem", "n_elem_by_type", "n_vertex", "min_quality", "mean_quality", "is_complete", ...}

mesh_buildB

Build (or rebuild) the mesh — alias of mesh_run.

Args: mesh: mesh sequence tag (None = first). feature: optional feature tag to validate before building. component: component tag (None = auto-detect). model: model name/tag (None = current model).

mesh_statsB

Mesh statistics: element/vertex counts, quality, type flags, volume.

Args: mesh: mesh sequence tag (None = first). component: component tag (None = auto-detect). model: model name/tag (None = current model). Returns: {"n_elem", "n_elem_by_type", "n_vertex", "min_quality", "mean_quality", "has_second_order_elements", "is_complete", ...} plus mesh problems. Note: the clientapi has no max-quality getter.

mesh_qualityB

Mesh quality: min/mean quality and a quality-distribution histogram.

Args: mesh: mesh sequence tag (None = first). bins: number of histogram bins (default 10). mesh_type: element type to analyse ("tet", "tri", "quad", "hex", "prism"); None = all element types present. component: component tag (None = auto-detect). model: model name/tag (None = current model).

mesh_element_countsA

Element counts per geometric entity (domains for tets, boundaries for tris).

Useful to verify which domains/boundaries are meshed and whether a simple geometry was meshed as expected.

Args: mesh: mesh sequence tag (None = first). types: element types to count ("tet", "tri", "quad", "hex", "prism", "edg", "vtx"); None = all present types. max_entities: cap on reported entities per type (default 200). component: component tag (None = auto-detect). model: model name/tag (None = current model).

mesh_exportA

Export the built mesh to a file (STL, NASTRAN, 3MF, PLY, native, ...).

Args: path: target file path (absolute, or relative to the artifact root). When omitted a timestamped file under <artifact_root>/mesh/ is created. The correct extension is appended when missing. format: "stl" (default, binary STL) | "stlbin" | "stlascii" | "nastran" | "3mf" | "ply" | "native" | "sectionwise". COMSOL 6.4 has no VTU mesh export. stl_format: for STL exports: "binary" (default) or "text". mesh: mesh sequence tag (None = first). component: component tag (None = auto-detect). model: model name/tag (None = current model). Returns: {"path": "", "size": , "export_type": ...}.

mesh_importA

Import a mesh into a mesh sequence (COMSOL Import mesh feature).

COMSOL imports meshes from another mesh sequence, a geometry or a result dataset. The source is configured through feature properties — e.g. source="sequence" plus properties={"sequence": "mesh1"}, or source="dataset" plus properties={"dataset": "dset1"}.

Args: mesh: target mesh sequence tag (None = first). source: source kind ("sequence", "geom", "dataset"); optional. properties: extra Import properties (sequence, geom, dataset, ...). tag: feature tag (default auto "imp1"). selection: domain/entity numbers for the import feature. named: named selection instead of selection. all_entities: select all entities of entity_dim. entity_dim: selection dimension (default: geometry dimension). component: component tag (None = auto-detect). model: model name/tag (None = current model).

mesh_clearB

Clear the built mesh data (keep the sequence and its features).

Args: mesh: mesh sequence tag (None = first). component: component tag (None = auto-detect). model: model name/tag (None = current model).

mesh_removeC

Remove an entire mesh sequence from its component.

Args: mesh: mesh sequence tag, e.g. "mesh1". component: component tag (None = auto-detect). model: model name/tag (None = current model).

mesh_remove_featureB

Remove one mesh feature (and its child features) from a sequence.

Args: mesh: mesh sequence tag (None = first). feature: feature tag to remove, e.g. "ftet1". component: component tag (None = auto-detect). model: model name/tag (None = current model).

model_createB

Create a new empty COMSOL model with a component and a geometry sequence.

Args: name: model name (None = automatic "Model N"). dimension: geometry dimension: 3 (3D), 2 (2D), 1 (1D), or 2 with dimension=2 plus axisymmetric handled by physics setup. component: component tag (default comp1). geometry: geometry sequence tag (default geom1).

model_loadB

Load a .mph model file into COMSOL.

Args: path: absolute path to the .mph file. name: optional name to register the model under.

model_saveA

Save a model to an .mph file.

Args: model: model name/tag (None = current model). path: target file path. When omitted, saves into the workspace model root. versioned: add a timestamp suffix (keeps previous versions). tag: custom suffix instead of the timestamp.

model_listA

List all models currently loaded in COMSOL and mark the current one.

model_set_currentB

Select the current model (used by tools that omit the model argument).

model_describeB

Describe a model: components, physics, materials, meshes, studies, results.

model_cloneC

Clone a model under a new name (saved/loaded through a temporary file).

model_renameC

Rename a loaded model.

model_snapshotB

Save an internal snapshot of a model (used before risky changes).

Snapshots live in the scratch directory and can be reloaded with model_load.

model_removeB

Remove a model from COMSOL memory (does not delete files on disk).

model_problemsC

List model problems/warnings reported by COMSOL (physics, mesh, solver).

model_parameters_dumpB

Return all model parameters as {name: expression} plus evaluated values.

model_open_guiA

Open a model in the COMSOL Desktop GUI (interactive inspection/editing).

Saves the current in-memory state first (unless path is given), then launches comsol.exe -open <file> detached. Useful for a human to inspect what the AI built, or to continue interactively.

parameter_setB

Define or update global model parameters.

Args: values: mapping of parameter name to expression/number, e.g. {"L": "0.1[m]", "T0": "293.15[K]", "n": 10}. descriptions: optional mapping of parameter name to description text.

parameter_getC

Get a global parameter expression (or its evaluated numeric value).

parameter_listC

List all global parameters as a name鈫抏xpression mapping.

parameter_descriptionsC

Return the description text of every parameter.

parameter_removeC

Remove one or more global parameters.

function_createB

Create a global function (analytic, interpolation, step, ramp, ...).

Args: name: function name (used as the function tag; callable as name(t)). function_type: COMSOL function type, e.g. Analytic, Interpolation, Piecewise, Step, Ramp, GaussianPulse, Random, Wave, Rectangle. expression: analytic expression, e.g. "sin(2pif0*t)". args: argument list, e.g. "t" (default "t"). filename: data file for Interpolation / External functions. properties: any additional feature properties to set.

function_listC

List global functions with their types and expressions.

function_removeC

Remove a global function by tag/name.

variable_setC

Define a global variable expression (name = expression).

variable_listC

List global variables.

variable_removeC

Remove a global variable.

selection_createC

Create a named selection on a component (usable by any physics feature).

Args: name: selection tag. entity_dim: 3 = domains, 2 = boundaries/faces, 1 = edges, 0 = points. geometry: geometry sequence tag to attach to. kind: Explicit | Box | Ball | Cylinder | Disk | Adjacent | Union | Intersection | Difference | Complement | LogicalExpression. entities: explicit entity numbers (for Explicit selections). properties: extra properties, e.g. {"xmin": "-1", "xmax": "1", "zmin": "0"} for Box selections, or {"condition": "inside"}.

selection_listC

List named selections of every component.

selection_getC

Show the entities contained in a named selection.

selection_removeC

Remove a named selection.

phys_listB

List every physics interface in the model.

Returns, per interface: component, tag, label, type (e.g. "HeatTransfer"), target geometry tag, space dimension, feature count and active state.

Args: model: model name/tag (None = current model).

phys_addA

Add a physics interface to a component (e.g. HeatTransfer, SolidMechanics).

The interface type is validated against the COMSOL 6.4 catalog; an unknown type returns close matches. The target geometry's space dimension is checked as well (e.g. LaminarFlow needs 2D/3D).

Args: type: catalog interface type, e.g. "HeatTransfer", "SolidMechanics", "LaminarFlow", "Electrostatics", "PressureAcoustics", "ElectromagneticWavesFrequencyDomain", "DilutedSpecies". Tag prefixes ("ht") and descriptions are accepted too. tag: interface tag (None = catalog default prefix + number, e.g. "ht"). label: optional display label (e.g. "Heat Transfer in Solids"). geom: target geometry tag (None = first geometry of the component). component: component tag (None = first component). extra_dims: optional extra-dimension tags for reduced models. model: model name/tag (None = current model).

phys_infoA

Show one physics interface: type, label, geometry, dimension, features, dependent-variable fields, interface-level property groups and BC aliases.

Args: interface: interface tag, label or type (e.g. "ht"). model: model name/tag (None = current model).

phys_removeA

Remove a physics interface (and all its features) from the model.

Args: interface: interface tag, label or type (e.g. "ht"). model: model name/tag (None = current model).

phys_renameB

Rename a physics interface (display label and/or programmatic tag).

Args: interface: current interface tag or label. new_label: new display label shown in the COMSOL GUI (optional). new_tag: new programmatic tag (optional; must be unique). model: model name/tag (None = current model).

phys_featuresB

Return the nested feature tree of a physics interface.

Every node has tag, label, COMSOL type, active state, entity dimension, selected entities / named selection. Sub-features (e.g. "Plasticity" under the Linear Elastic Model) appear as nested children.

Args: interface: interface tag/label/type (e.g. "ht"). include_properties: also return every property value (can be large). model: model name/tag (None = current model).

phys_list_featuresA

Return a flat list of all physics features (including sub-features).

Nested features carry a parent tag. Useful to quickly find feature tags for phys_set_property / phys_set_selection.

Args: interface: interface tag/label/type (e.g. "ht"). include_properties: also return property values for every feature. model: model name/tag (None = current model).

phys_add_featureA

Create a physics feature (boundary condition, domain setting, ...).

feature_type must be a COMSOL type valid for the interface (verified against the catalog and, ultimately, COMSOL). Use parent to create a sub-feature inside an existing feature (e.g. Plasticity under the Linear Elastic Model).

Args: interface: interface tag/label/type (e.g. "ht"). feature_type: COMSOL feature type, e.g. "TemperatureBoundary", "HeatFluxBoundary", "HeatSource", "Fixed", "InletBoundary". tag: new feature tag (None = auto "prefixN"). label: optional display label. entity_dim: entity dimension (3=domains, 2=boundaries, 1=edges, 0=points in 3D; None = domain dimension of the geometry). selection: entity list (e.g. [1,2,3]), "all", or a named-selection tag. named_selection: named selection tag to assign instead of entities. all_entities: select all entities of the feature's dimension. properties: property dict, e.g. {"T0": "400[K]"}. parent: parent feature tag (or nested path "lemm1/pl1") for sub-features. model: model name/tag (None = current model).

phys_add_bcA

Create a boundary/domain condition through a friendly alias.

Aliases map to the real COMSOL feature type and property names, and pre-set any required switches (e.g. convection sets HeatFluxType=ConvectiveHeatFlux, radiation sets epsilon_rad_mat=userdef). If bc is not a known alias it may still be a raw COMSOL feature type valid for that interface.

Verified aliases by interface type: HeatTransfer: temperature(T0), heat_flux(q0_input), convection(h,Text), radiation(epsilon_rad,Tamb), heat_source(Q0), initial(Tinit), insulation; SolidMechanics: fixed, prescribed_displacement(Direction+U0 vector), roller, initial(u), and three load types: boundary_load with F/load = per-area traction [N/m^2] (ForceArea + forceReferenceArea), total_force/force = total force [N] (TotalForce + force), pressure/p = normal pressure [Pa] (FollowerPressure + pressure); pressure_load(p) = normal pressure shortcut; body_load with F/load = per-volume force [N/m^3] (ForceVolume + forceReferenceVolume) or total_force/force = total force [N]; note: on a COMSOL BoundaryLoad/BodyLoad the property "F" is only the DERIVED resultant force - it does not apply a load, so these aliases write the real input properties instead; LaminarFlow: inlet(U0in), outlet(p0), wall, symmetry, volume_force(F), initial; Electrostatics: ground, electric_potential(V0), surface_charge(rhoqs), space_charge(rhoq), zero_charge, initial(V); ConductiveMedia (electric currents): terminal(TerminalType,V0,I0), ground, electric_potential(V0), normal_current_density(nJ), initial(V2); PressureAcoustics: sound_hard, sound_soft, normal_velocity(nvel), impedance(Zn), pressure(p0), initial(p2); ElectromagneticWavesFrequencyDomain: pec, pmc, port(PortName,Pin), scattering(IncidentField), initial(E); DilutedSpecies: concentration(c0), inflow(c0), outflow, no_flux, reactions(R_c), initial(initc).

Args: interface: interface tag/label/type (e.g. "ht"). bc: alias name (e.g. "temperature") or a raw COMSOL feature type. selection: entity list, "all", or a named-selection tag. named_selection: named selection tag to assign. all_entities: select all entities of the condition's dimension. properties: property values using real COMSOL names or documented aliases, e.g. {"T0": "400[K]"} or {"T": "400[K]"}. tag: new feature tag (None = auto). label: optional display label. entity_dim: override the entity dimension (3=domains, 2=boundaries). model: model name/tag (None = current model).

phys_set_propertyA

Set one property on a physics feature (e.g. T0 of a temperature BC).

Invalid property names return the available properties and close matches. Expressions use COMSOL unit syntax: "400[K]", "1e4[W/m^2]".

Args: interface: interface tag/label/type (e.g. "ht"). feature: feature tag or label (e.g. "temp1"). name: COMSOL property name (e.g. "T0", "q0_input", "h", "V0"). value: property value (string with units, number, bool or list). model: model name/tag (None = current model).

phys_propertiesB

Return all properties of a physics feature (values bounded).

Args: interface: interface tag/label/type (e.g. "ht"). feature: feature tag/label (e.g. "temp1"); nested paths use "a/b". model: model name/tag (None = current model).

phys_set_selectionA

Assign entities (or a named selection / all entities) to a feature.

Args: interface: interface tag/label/type (e.g. "ht"). feature: feature tag/label (e.g. "temp1"). entities: entity numbers [1,2,3], "all", or a named-selection tag. named: named selection tag (alternative to entities). all_entities: select every entity of the feature's dimension. model: model name/tag (None = current model).

phys_get_selectionB

Show the entity dimension and selected entities of a physics feature.

Args: interface: interface tag/label/type (e.g. "ht"). feature: feature tag/label (e.g. "temp1"). model: model name/tag (None = current model).

phys_remove_featureA

Remove a physics feature (COMSOL default/required features cannot be removed).

Args: interface: interface tag/label/type (e.g. "ht"). feature: feature tag/label (e.g. "temp1"). model: model name/tag (None = current model).

phys_toggle_featureA

Enable/disable a physics feature (None = flip its current state).

Args: interface: interface tag/label/type (e.g. "ht"). feature: feature tag/label (e.g. "temp1"). active: True=enable, False=disable, None=toggle. model: model name/tag (None = current model).

phys_interface_propertiesA

List interface-level property groups and their properties.

These are the settings shown directly on the physics-interface node in COMSOL (e.g. "EquationForm" / advanced settings, "PhysicalModelProperty" / physical model, "ShapeProperty" / shape functions), not feature properties.

Args: interface: interface tag/label/type (e.g. "ht"). include_values: include current values (values are truncated). model: model name/tag (None = current model).

phys_set_interface_propertyA

Set one interface-level property (inside a Physics.prop() group).

Args: interface: interface tag/label/type (e.g. "ht"). name: property name, e.g. "form" (EquationForm) or "Tref" (PhysicalModelProperty). value: new value, e.g. "Automatic" or "300[K]". group: property group tag/label; when omitted the property is searched across all groups and must be unambiguous. model: model name/tag (None = current model).

phys_feature_typesA

List the feature types COMSOL allows inside a physics interface.

Uses the shipped COMSOL 6.4 catalog (no COMSOL connection needed), with tag prefix and description for each type.

Args: interface: interface type, tag prefix or description (e.g. "HeatTransfer" or "ht"). dimension: restrict to a space dimension: 3, "2D", "2daxi", "S3D", ... (None = union over all dimensions). query: optional case-insensitive substring filter on type/description. limit: maximum number of feature types returned (default 500).

phys_interfaces_catalogA

Search the catalog of physics interface types available in COMSOL 6.4.

Args: dimension: restrict to a space dimension: 3, "2D", "2daxi", ... or None. query: case-insensitive substring filter on type/description (e.g. "heat", "flow", "acoustic"). limit: maximum number of interfaces returned (default 200).

multiphysics_listB

List multiphysics couplings (e.g. ThermalExpansion, NonIsothermalFlow).

Args: model: model name/tag (None = current model).

multiphysics_addA

Add a multiphysics coupling between existing physics interfaces.

Common types (live-verified): ThermalExpansion (heat+solid), NonIsothermalFlow (heat+flow), ElectromagneticHeating (heat+EM waves), AcousticStructureBoundary (acoustics+structure), FluidStructureInteractionBC (flow+structure). The coupling type is attempted on COMSOL; unknown types return close matches.

Args: type: coupling type, e.g. "ThermalExpansion", "NonIsothermalFlow". tag: coupling tag (None = conventional prefix + number, e.g. "te1"). label: optional display label. geom: geometry tag the coupling operates on (None = first geometry). entity_dim: entity dimension for boundary couplings (2 in 3D, 1 in 2D); None tries the 3-argument form first. component: component tag (None = first component). model: model name/tag (None = current model).

multiphysics_removeB

Remove a multiphysics coupling.

Args: coupling: coupling tag or label (e.g. "te1"). model: model name/tag (None = current model).

multiphysics_get_featuresB

List multiphysics couplings with their sub-features.

Args: coupling: coupling tag/label (None = all couplings). include_properties: include each coupling's property values. model: model name/tag (None = current model).

multiphysics_add_featureB

Create a sub-feature inside a multiphysics coupling.

Args: coupling: coupling tag/label (e.g. "te1"). feature_type: COMSOL sub-feature type valid for that coupling. tag: sub-feature tag (None = auto). label: optional display label. entity_dim: entity dimension (None = COMSOL default). model: model name/tag (None = current model).

multiphysics_propertiesB

Return all properties of a multiphysics coupling (values bounded).

Args: coupling: coupling tag/label (e.g. "te1"). model: model name/tag (None = current model).

multiphysics_set_propertyB

Set one property on a multiphysics coupling.

Args: coupling: coupling tag/label (e.g. "te1"). name: property name (e.g. "InputType", "Heat_physics", "Solid_physics"). value: new value, e.g. "SecantCoefficient" or "ht". model: model name/tag (None = current model).

plot_typesA

List valid plot group types, plot feature types and quick-plot aliases.

Use this before plot_group_create / plot_add_feature to pick valid type strings for COMSOL 6.4. Attribute features (Deform, Height, Filter, Transparency) must be added with parent=<plot feature tag>.

plot_listB

List the plot groups (result features) in a model.

Args: model: model name/tag (None = current model).

plot_featuresA

List the plot features (and their attributes) of one plot group.

Args: plotgroup: plot group tag, e.g. "pg1" (see plot_list). model: model name/tag (None = current model).

plot_group_createA

Create an empty plot group at the results root.

Args: plotgroup_type: PlotGroup3D (default) | PlotGroup2D | PlotGroup1D | PolarGroup | SmithGroup. tag: plot group tag (auto pg1, pg2... when omitted). dataset: dataset tag the group renders, e.g. "dset1" (default solution), "cpl1" (cut plane), "cln1" (cut line). When omitted COMSOL uses the default solution dataset. title: plot title shown in the image / report. properties: extra plot-group properties, e.g. {"showlegends": "off", "title": "..."}. model: model name/tag (None = current model).

Example: plot_group_create("PlotGroup3D", tag="pgT", dataset="dset1", title="Temperature (K)")

plot_add_featureA

Add a plot feature (or an attribute) to a plot group.

Args: plotgroup: target plot group tag (see plot_list). feature_type: COMSOL plot type, e.g. Surface, Volume, Slice, Isosurface, Contour, ArrowSurface, ArrowVolume, ArrowLine, Streamline, Line, Point, Mesh, LineGraph, PointGraph, Global. Attributes Deform/Height/Filter/Transparency require parent. See plot_types. tag: feature tag (auto e.g. surf1 when omitted). parent: plot feature tag when adding an attribute (e.g. "surf1"), or a nested path for deeper nodes ("surf1/def1"). expr: expression to plot. Scalar e.g. "T", "ht.T", or vector components comma-separated "ht.dfluxx,ht.dfluxy,ht.dfluxz". Arbitrary COMSOL expressions incl. units might work, e.g. "T-293.15[K]". properties: extras such as colortable ("Rainbow", "ThermalLight"), colorlegend (on/off), unit, rangecoloractive/rangecolormin/rangecolormax, smooth, title. Values may be strings or numbers. label: display label for the feature. model: model name/tag (None = current model).

Example: plot_add_feature("pgT", "Surface", expr="T", properties={"colortable": "ThermalLight"})

plot_set_propertiesA

Set properties on a plot group or on one of its plot features.

Invalid property names return the complete list of available properties read live from the node (use plot_properties to inspect first).

Args: plotgroup: plot group tag. properties: mapping of COMSOL property -> value, e.g. {"colortable": "Rainbow", "colorlegend": "on"} on a feature, or {"title": "My plot", "showlegends": "off"} on a group. feature: plot feature tag (or nested "surf1/def1"). When omitted the properties are set on the plot group itself. model: model name/tag (None = current model).

Example: plot_set_properties("pg1", {"showlegends": "off", "title": "T [K]"}) plot_set_properties("pg1", {"colortable": "ThermalLight"}, feature="surf1")

plot_propertiesA

Read all properties of a plot group or plot feature (JSON).

Args: plotgroup: plot group tag. feature: plot feature tag or nested path; omit for the group itself. model: model name/tag (None = current model).

plot_removeA

Remove a plot group entirely, or one plot feature/attribute.

Args: plotgroup: plot group tag. feature: feature tag or nested path to remove; omit to remove the whole plot group. model: model name/tag (None = current model).

plot_attach_datasetA

Point an existing plot group at another dataset.

Useful to re-render the same plot for a cut plane (cpl1), cut line (cln1), mesh dataset or a different solution.

Args: plotgroup: plot group tag. dataset: dataset tag, e.g. "dset1", "cpl1", "cln1". model: model name/tag (None = current model).

plot_runB

Render a plot group (or a single plot feature) and report timing.

Rendering is needed before exporting images (though plot_export_image also triggers rendering automatically when COMSOL requires it).

Args: plotgroup: plot group tag. feature: optional plot feature tag to render alone. model: model name/tag (None = current model).

plot_export_imageA

Render plot group(s) and export image file(s), validated with Pillow.

Exports COMSOL's Image feature with the exact clientapi properties: plotgroup, imagetype, <type>filename (pngfilename / jpegfilename / bmpfilename / epsfilename / gltffilename), width/height (px when unit="px"), unit, resolution (dpi), optional size preset, background, antialias.

Args: plotgroup: single plot group tag to export (e.g. "pg1"). path: output file path. For a single plot group a .png/.jpg path is used as-is; when omitted a unique path under <artifact_root>/<model>/<timestamp>_plots/ is generated. For multiple plot groups this is treated as a directory. width: image width in px (default 1200). height: image height in px (default 900). unit: px (default) | mm | in. dpi: optional COMSOL resolution property (e.g. 150). imagetype: png (default) | jpeg | bmp | eps | gltf. eps only works for 1D plot groups; gltf is 3D-only and may not be produced in headless COMSOL 6.4. size: optional COMSOL size preset manualprint/manualweb/ current/presentation; leave empty to honour width/height. background: current | color | transparent. antialias: on | off. plotgroups: export several plot groups in one call (list of tags); alternatively omit both plotgroup and plotgroups to export every plot group in the model. model: model name/tag (None = current model).

Returns: For one group: {"path","size","width","height","format","valid", "plotgroup", ...} measured on the written file. For several: {"images": [ ... ], "count", "directory"}.

plot_quickA

One-call plot: create group + feature, render, export a validated image.

Args: expr: COMSOL expression to plot, e.g. "T", "ht.T", "u,v,w" (vector components comma-separated for arrows / streamlines). plot_type: surface (3D, default) | volume | slice | isosurface | contour | arrow_surface | arrow_volume | arrow_line | streamline | line | point | global | surface2d | contour2d | arrow2d. dataset: dataset tag (e.g. "dset1", "cpl1", "cln1"); COMSOL default solution dataset when omitted. title: plot title. colortable: color table, e.g. "Rainbow", "ThermalLight", "GrayScale", "Wave". width: image width px (default 1200). height: image height px (default 900). imagetype: png (default) | jpeg | bmp. path: output image path (auto under artifact root when omitted). plotgroup: reuse this plot group tag instead of creating a new one. model: model name/tag (None = current model).

Returns: {"ok", "plotgroup", "feature", "plot_type", "path", "size", "width", "height", "format", "valid"}.

Example: plot_quick("T", plot_type="surface", colortable="ThermalLight", title="Temperature")

plot_export_plot_dataA

Export the raw rendered data vectors of a plot feature to CSV.

COMSOL returns the data it renders per feature: for a LineGraph the y-values (data type "Height"), for a 3D Surface the expression values ("Color"). The CSV has one column per data vector (header = data type name). This complements result_export_data (Data export feature, owned by the results tools).

Args: plotgroup: plot group tag to read data from. feature: plot feature tag (defaults to the first feature). path: output CSV path (auto under artifact root when omitted). max_points: cap values written per column. model: model name/tag (None = current model).

Returns: {"path","size","rows","columns","headers","feature","data_types"}.

dataset_listB

List all result datasets (tag, label, COMSOL type, source dataset/solution).

Args: model: model name/tag (None = current model).

dataset_createA

Create a result dataset (data source for plots/evaluations/exports).

Common types: Solution, CutPlane, CutLine3D, CutPoint3D, Grid3D, Surface, Volume, Embed2D, Mirror3D, Extrude2D, Revolve2D, Sector3D, Filter, Join, TimeAverage, Integral, Average, Maximum, Minimum. Full list: catalog_dataset_types.

Args: type: dataset type string, e.g. "CutPlane". tag: dataset tag (None = auto, e.g. cpl1). Must be unique. source: source dataset tag for derived datasets (e.g. "dset1"); for type="Solution" this is the solution tag (e.g. "sol1"). properties: additional properties, e.g. {"quickplane": "xy", "quickz": "0.01"}. Plane coordinates use quickx/quicky/quickz. model: model name/tag (None = current model).

dataset_infoA

Describe one dataset: type, label, source solution, and all properties.

Args: tag: dataset tag, e.g. "dset1" or "cpl1" (see dataset_list). include_properties: include the full COMSOL property dictionary. model: model name/tag (None = current model).

dataset_set_propertyA

Set one property on an existing dataset (generic escape hatch).

Args: tag: dataset tag (e.g. "cpl1"). name: COMSOL property name (dataset_info lists valid ones), e.g. "quickz". value: property value ("0.01", 0.01, ["0","1"], ...). model: model name/tag (None = current model).

dataset_removeA

Remove a result dataset by tag (does not affect the solution data).

Args: tag: dataset tag to remove, e.g. "cpl1" (see dataset_list). model: model name/tag (None = current model).

result_numerical_listB

List derived-value ("Numerical") evaluation features in the model.

Args: model: model name/tag (None = current model).

result_createA

Create a raw derived-value feature (advanced; low-level escape hatch).

Prefer result_evaluate / result_integrate / result_average / result_minmax for normal use. type is one of catalog_numerical_types (e.g. "IntVolume", "EvalGlobal", "MassProperties", "Eval", "Interp", "Global").

Args: type: numerical feature type. tag: feature tag (None = auto "evN"). dataset: dataset tag to evaluate on (None = COMSOL default). expressions: COMSOL result expressions, e.g. ["T", "ht.ntflux"]. entities: entity selection (list of ints), or "all". named_selection: name of a model selection to use instead of entities. solnum: 1-based solution number(s) to evaluate (None = all). table: table tag to store the result in (result_table_create). properties: raw COMSOL properties to set (dataset_info/tree_properties). run: run the feature immediately (default False). model: model name/tag (None = current model).

result_removeC

Remove an evaluation/table/export/dataset node by tag.

Args: tag: node tag (e.g. "ev1", "tbl1", "data1", "cpl1"). kind: "numerical" (derived values), "table", "export" or "dataset". model: model name/tag (None = current model).

result_evaluateA

Generic result evaluation with an explicit evaluation type.

One tool for all COMSOL 6.4 evaluation types. eval_type accepts friendly aliases (below) or an exact type string from catalog_numerical_types.

Aliases: global, point/interp (arbitrary coordinates), eval_point (geometry points), field/domain (whole solution field), int_volume, int_surface, int_line, av_volume, av_surface, av_line, max_volume, max_surface, max_line, min_volume, min_surface, min_line, stddev_*, measure_volume, measure_surface, measure_line, measure_distance, mass/mass_properties, api_global.

Units are reported per expression; complex results include imaginary rows. Results are capped at max_output_items.

Args: eval_type: alias or exact numerical type (e.g. "av_volume", "EvalGlobal"). expressions: COMSOL result expressions, e.g. ["T"] or ["ht.ntflux"]. Required except for the Measure* types. dataset: dataset tag (None = feature default, usually the first solution dataset). For "field" use a solution dataset; for "point" use a solution dataset and pass coords. entities: entity numbers of the feature dimension (3=domains, 2=boundaries, 1=edges, 0=points in 3D), or "all" (default for volume/surface/line integrals/averages/min/max/measures). named_selection: named selection tag instead of entities. coords: for "point"/"interp": [[x, y, z], ...] evaluation coordinates. solnum: 1-based solution number(s), e.g. [2] or [1,2,3] (None = all). table: table tag to store the result in (adds "table" payload). properties: extra raw COMSOL properties. model: model name/tag (None = current model).

result_eval_globalA

Evaluate GLOBAL-scope expressions (parameters, global variables).

EvalGlobal works in the model's global scope: parameters, global variables/expressions, global ODE variables. Field variables (e.g. "T" of a 3D heat model) are NOT defined in global scope -use result_eval_point / result_integrate / result_average / result_minmax for fields. Example: expressions=["T0", "2*T0"] after setting parameter T0=400[K] returns [400.0, 800.0] with units [K, K].

Args: expressions: global expressions, e.g. ["T0", "2*T0"]. dataset: dataset tag (None = default solution dataset). solnum: 1-based solution number(s) (None = all). table: table tag to store the result in. model: model name/tag (None = current model).

result_eval_pointA

Evaluate expressions at arbitrary coordinates (or at geometry points).

Coordinate evaluation uses the API-only Interp feature (verified working on Solution and CutLine/CutPlane datasets). Geometry-point evaluation uses EvalPoint with point entity numbers.

Args: expressions: expressions to evaluate, e.g. ["T"]. coords: [[x, y, z], ...] coordinates (3 components for 3D, 2 for 2D). Evaluated with Interp; results include the coordinates. dataset: dataset tag; for coords usually the solution dataset (e.g. "dset1", or "dset2" for a transient solution at all times). entities: geometry point numbers for EvalPoint (e.g. [1, 2]); use instead of coords. Point entities have dimension 0. named_selection: named point selection for EvalPoint. solnum: 1-based solution number(s) (None = all solutions). model: model name/tag (None = current model).

result_eval_volumeA

Evaluate a field on all mesh nodes of a solution dataset (pointwise).

API-only Eval feature: returns the expression sampled at every mesh node of the dataset (not an integral). Output includes per-expression min/max/mean and a capped value list. For volume integrals/averages use result_integrate(result_kind="volume") / result_average.

Args: expressions: expressions to evaluate, e.g. ["T"]. dataset: dataset tag that maps directly to a solution ("dset1"). max_points: cap on returned points (default 200). solnum: 1-based solution number(s) (None = all). model: model name/tag (None = current model).

result_eval_surfaceA

Evaluate a field on a surface/cut-plane dataset (pointwise values on it).

Uses the API-only Interp feature with the given dataset (create it with dataset_create, e.g. type="CutPlane"). Returns coordinates and values at the dataset points plus min/max/mean per expression.

Args: expressions: expressions to evaluate, e.g. ["T"]. dataset: CutPlane/Surface dataset tag (e.g. "cpl1"). solnum: 1-based solution number(s) (None = all). max_points: cap on returned points (default 200). model: model name/tag (None = current model).

result_eval_lineA

Evaluate on a line: pointwise along a CutLine dataset or line integrals.

  • dataset given (e.g. a CutLine3D dataset): Interp at all line points, returns coordinates + values + min/max/mean.

  • entities/named_selection given: line entities (dimension 1) evaluated with the kind operation: "integral" (IntLine), "average" (AvLine), "max"/"min", "stddev", "measure".

Args: expressions: expressions, e.g. ["T"]. dataset: CutLine3D dataset tag for pointwise sampling along the line. entities: line entity numbers (None = all line entities with kind op). named_selection: named line selection. kind: "integral" (default for entities is average), "average", "max", "min", "stddev", "measure". solnum: 1-based solution number(s) (None = all). max_points: cap on returned points for dataset sampling. model: model name/tag (None = current model).

result_integrateA

Integrate expressions over domains, boundaries or edges.

Dimension-aware COMSOL types (verified): 3D -> IntVolume (domains) / IntSurface (boundaries) / IntLine (edges); 2D -> IntSurface (domains) / IntLine (boundaries). Physical unit includes the integration measure, e.g. "m^3K" for T over a 3D volume or "m^2K" over a 2D domain.

Args: expressions: expressions to integrate, e.g. ["T"]. kind: "volume"/"domain" (domains), "surface"/"boundary" (boundaries) or "line"/"edge" (edges; 2D: boundaries). dataset: dataset tag (None = default solution dataset). entities: entity numbers of the resolved dimension (3=domains, 2=boundaries, 1=edges in 3D; 2D: 2=domains, 1=boundaries); default = all entities of that dimension. named_selection: named selection instead of entities. solnum: 1-based solution number(s) (None = all). table: table tag to store the result in. model: model name/tag (None = current model).

result_averageA

Average expressions over domains, boundaries or edges.

Dimension-aware COMSOL types (verified): 3D -> AvVolume / AvSurface / AvLine; 2D -> AvSurface (domains) / AvLine (boundaries).

Args: expressions: expressions to average, e.g. ["T"]. kind: "volume"/"domain", "surface"/"boundary" or "line"/"edge" (2D: boundaries). dataset: dataset tag (None = default solution dataset). entities: entity numbers of the resolved dimension (default = all). named_selection: named selection instead of entities. solnum: 1-based solution number(s) (None = all). table: table tag to store the result in. model: model name/tag (None = current model).

result_minmaxA

Maximum and/or minimum of expressions over domains/boundaries/edges.

Dimension-aware COMSOL types (verified): 3D -> MaxVolume/MaxSurface/ MaxLine (Min* alike); 2D -> MaxSurface (domains) / MaxLine (boundaries).

Args: expressions: expressions, e.g. ["T"]. kind: "volume"/"domain", "surface"/"boundary" or "line"/"edge" (2D: boundaries). mode: "both" (default), "max" or "min". dataset: dataset tag (None = default solution dataset). entities: entity numbers of the resolved dimension (default = all). named_selection: named selection instead of entities. solnum: 1-based solution number(s) (None = all). model: model name/tag (None = current model).

result_mass_propertiesA

Volume, mass (and center-of-mass unit) of selected domains.

Uses the COMSOL MassProperties feature (verified working with the default three-expression set ["1", "comp1.spatial.rho", "1/1[m^2]"]). Returned rows are [volume, mass]; units ["m^3", "kg"]. The third unit ("m") belongs to the (optional) center-of-mass expression.

Args: dataset: dataset tag (None = default solution dataset). entities: domain numbers (default = all domains). named_selection: named domain selection instead of entities. expressions: optional explicit 3 expressions (volume, mass, arm); default is COMSOL's density-based set. Must have length 3. solnum: 1-based solution number(s) (None = all). table: table tag to store the result in. model: model name/tag (None = current model).

result_measureA

Measure volume / area / line length / distance between two points.

Dimension-aware COMSOL types (verified): 3D -> MeasureVolume (domains) / MeasureSurface (boundaries) / MeasureLine (edges); 2D -> MeasureSurface (domain area) / MeasureLine (boundary length). "distance" always uses MeasureDistance with exactly two point entities.

Args: kind: "volume"/"domain", "surface"/"boundary", "line"/"edge" or "distance" ("distance" needs exactly two point entities). dataset: dataset tag (None = default solution dataset). entities: entity numbers; for "distance" exactly two point entities. named_selection: named selection instead of entities. solnum: 1-based solution number(s) (None = all). table: table tag to store the result in. model: model name/tag (None = current model).

result_stddevA

Standard deviation of expressions over domains/boundaries/edges.

Dimension-aware COMSOL types (verified): 3D -> StdDevVolume / StdDevSurface / StdDevLine; 2D -> StdDevSurface (domains) / StdDevLine (boundaries).

Args: expressions: expressions, e.g. ["T"]. kind: "volume"/"domain", "surface"/"boundary" or "line"/"edge" (2D: boundaries). dataset: dataset tag (None = default solution dataset). entities: entity numbers of the resolved dimension (default = all). named_selection: named selection instead of entities. solnum: 1-based solution number(s) (None = all). model: model name/tag (None = current model).

table_listA

List result tables (tag, label, rows, columns).

Args: model: model name/tag (None = current model).

result_table_createA

Create a result table, optionally with column headers and numeric rows.

Tables are normally filled by evaluation features: pass the table tag to result_integrate/result_average/result_minmax (table="tbl1"). This tool also allows creating a table with explicit data.

Args: tag: table tag (None = auto "tblN"). headers: column headers, e.g. ["t", "T_avg"] (units may be appended in parentheses like "T (K)"). rows: numeric rows, e.g. [[0, 293.15], [1, 310.2]]. model: model name/tag (None = current model).

result_table_readA

Read a result table: column headers, real (and imaginary) rows.

Args: tag: table tag (None = use the most recently created table). max_rows: cap on returned rows (default 100). model: model name/tag (None = current model).

result_export_dataA

Export expression data to a CSV/TXT file (COMSOL Data export).

Writes mesh-node/dataset-point values with a COMSOL comment header that contains the units (e.g. % X,Y,Z,T (K)). Files are written into the artifact workspace unless filename is absolute. The response includes the path, column names with units, row count and a preview.

Args: expressions: expressions to export, e.g. ["T"]. dataset: dataset tag (None = default solution dataset). CutPlane / CutPoint datasets work and export their points. filename: output path; relative paths go to the artifact workspace. Extension .csv or .txt (default .csv). coords: optional explicit coordinates -> creates a temporary CutPoint3D dataset and exports the values at those points. solnum: 1-based solution number(s) (None = all); for multi-solution datasets every selected solution becomes a block in the file. model: model name/tag (None = current model).

result_solution_valuesB

Return solution/time/parameter values behind result datasets.

For each dataset the referenced solution is resolved and its stored parameter values are returned: time values for transient studies (pvals, e.g. [0, 0.5, 1, 2]) or parameter tuples for parametric sweeps, plus solution level names/descriptions.

Args: dataset: dataset tag to inspect (None = all datasets). model: model name/tag (None = current model).

result_eval_all_solutionsA

Evaluate an expression for every solution/time in a dataset.

The evaluation matrix columns are the solutions of the dataset (e.g. a transient dataset with N stored times) and the response adds a compact solutions list mapping solnum -> time/parameter value. Defaults to a domain average (3D: AvVolume, 2D: AvSurface), which works for field variables; pass eval_type="global" for global-scope expressions.

Args: expressions: expressions, e.g. ["T"]. eval_type: alias like "average", "integral", "global", "max", "min" or an exact numerical type. kind: dimension for the alias: "volume"/"domain", "surface"/"boundary" or "line" (2D: boundaries). dataset: dataset containing all solutions (e.g. "dset2" after a transient solve). None = default dataset. entities: entity numbers of that dimension (default = all). named_selection: named selection instead of entities. model: model name/tag (None = current model).

result_available_expressionsA

Check which candidate expressions are valid, with their physical units.

Each candidate is evaluated with the API-only Interp feature at a point (default: geometry centre), so field expressions are tested in their native spatial scope. Returns ok/error, unit and value per candidate -useful before wiring expressions into plots/exports.

Args: candidates: candidate expressions, e.g. ["T", "ht.ntflux", "u", "1+"]. dataset: dataset tag (None = first solution dataset). coords: point [[x, y, z]] used for the probe (default = geometry centre). model: model name/tag (None = current model).

session_startA

Start COMSOL and connect (client-server mode by default).

Args: cores: number of solver cores (None/0 = all available cores). version: COMSOL version string such as "6.4" (None = newest installed). port: server port (0/None = pick a free port automatically). standalone: true = run COMSOL in-process (faster, less isolated). Returns session status including version, licensed modules and loaded models.

session_connectB

Connect to an already running COMSOL server (comsolmphserver).

Args: port: TCP port the COMSOL server listens on (default COMSOL port is 2036). host: hostname or IP of the server (default localhost).

session_statusA

Return COMSOL session state, version, licensed modules and loaded models.

session_stopB

Disconnect the client and shut down the managed COMSOL server.

session_restartA

Restart the COMSOL server process and reconnect (recovery / clean state).

All models are unloaded by COMSOL; save them with model_save first and reload afterwards with model_load.

session_killA

Force-kill the managed COMSOL server process (escape hatch).

Use when a solve hangs and job_cancel cannot stop it. Afterwards call session_start to bring COMSOL back (models must be reloaded/saved first).

job_listA

List background jobs (solves, animations, batch evaluations).

Args: status: filter by pending | running | success | error | cancelled. limit: maximum number of jobs to return (newest first).

job_statusC

Return the status / progress of a background job.

job_cancelB

Request cancellation of a background job.

Cancellation is cooperative: it stops multi-step jobs between steps and is ignored (documented) by a single monolithic COMSOL solve.

job_waitB

Wait up to timeout_s seconds for a job to finish, then return its status.

study_listA

List every study in a model with its steps, options, solutions and timings.

Args: model: model name/tag (None = current model).

study_createA

Create an empty study, optionally with study steps.

Args: study: tag for the new study (None = automatic, e.g. "std1"). steps: list of step specs, each {"tag": "stat", "type": "Stationary", "properties": {...}}. type must be a COMSOL study-step type (call catalog_study_features for the full list of 81 types). label: optional display label (e.g. "Stationary heat transfer"). model: model name/tag (None = current model).

Example: steps=[{"tag": "time", "type": "Transient", "properties": {"tlist": "range(0,0.1,1)"}}, {"tag": "stat", "type": "Stationary"}]

study_add_stepA

Add a study step to an existing study (any COMSOL 6.4 study-step type).

Args: study: study tag. step_type: COMSOL study-step type, e.g. "Stationary", "Transient", "Eigenfrequency", "Frequency", "ModeAnalysis", "Parametric", "MaterialSweep", "BatchSweep", "Sensitivity", "Optimization". tag: step tag (None = automatic, e.g. "stat", "time", "eig"). label: optional display label. properties: step properties to set, e.g. {"tlist": "range(0,0.1,1)"} for Transient, {"neigs": 6} for Eigenfrequency, {"plist": ["10", "20", "30"]} for Frequency. model: model name/tag (None = current model).

study_add_sweepA

Add a sweep study step (parametric / material / batch / sensitivity / ...).

The sweep step is inserted before the solving step; if study does not exist it is created. When the study has no other steps, a Stationary solver step is appended automatically.

Args: pname: parameter name(s) to sweep, e.g. "k" or ["k", "Q0"]. plist: parameter values: list like ["1", "2", "3"], a comma string "1,2,3", a range(...) expression, or a flat list for multi-parameter sweeps. Values may carry units ("1[W/(mK)]"). punit: optional unit(s) for the sweep values, e.g. "W/(mK)". sweep_type: "Parametric" (default), "MaterialSweep", "BatchSweep", "ClusterSweep", "Sensitivity", "Optimization", ... study: study tag (None = auto-create one, e.g. "std_param1"). step_tag: tag for the sweep step (None = automatic). properties: extra study-step properties to set on the sweep step. add_solver_step: append a solver step when the study has no other step. solver_step_type: type of that solver step (default "Stationary"). solver_step_properties: properties for the appended solver step. model: model name/tag (None = current model).

Example: study_add_sweep(pname="k", plist=["1", "5", "10"], punit="W/(m*K)", study="std_parametric")

study_set_propertyA

Set properties on a study step (time list, frequencies, eigenvalues, ...).

Args: study: study tag. step: study-step tag (see study_steps). properties: property name -> value, e.g. {"tlist": "range(0,0.05,0.5)"} (Transient time list; string expressions are accepted and expanded by COMSOL), {"plist": ["10", "20", "30"], "punit": ["Hz"]} (frequency), {"neigs": 6, "shift": "10[Hz]"} (eigenfrequency), {"pname": ["k"], "plist": ["1", "5", "10"]} (parametric sweep). model: model name/tag (None = current model).

Property values: strings for expressions, numbers for numeric fields, lists of strings for string arrays. Read current values with study_steps or tree_properties.

study_set_optionsB

Configure study-level output options (default plots, convergence, storage).

Args: study: study tag (None = the only study in the model). gen_plots: generate default plots after solving. gen_conv: store convergence plots. store_solution: store the solution in the study node. store_complete_history: record the complete solver history. gen_intermediate_plots: generate intermediate plots during solving. plot_undefined_values: plot undefined values. model: model name/tag (None = current model).

study_propertiesB

Detailed description of one study: steps, options, solutions, timings.

Args: study: study tag (None = the only study in the model). model: model name/tag (None = current model).

study_stepsA

List the steps of a study with their type, active state and key properties.

Args: study: study tag (None = the only study in the model). include_properties: include the curated key properties (tlist, pname, plist, neigs, shift, plot, stol, ...). property_names: explicit list of property names to include instead. include_all_properties: return all step properties (large, ~200 each). model: model name/tag (None = current model).

study_solveA

Solve a study synchronously and report timings, solutions and messages.

Long solves block the COMSOL worker; use study_solve_async for simulations longer than ~30 s. Every call reports the wall-clock elapsed_s, the attached solver sequence tags, new datasets/plots, COMSOL's own last_computation_time and solver warnings/errors.

Args: study: study tag (None = the only study in the model). generate_plots: switch on the "Plot" option of every study step so that default plot groups are created (otherwise the client API creates none). run_no_gen: use study.runNoGen() (reuse existing solver sequences instead of regenerating them). model: model name/tag (None = current model).

Returns: study, model, elapsed_s, solution_tags, new_datasets, new_plots, solution_stats (type/size/DoFs/solution counts), last_computation_time/ date/version, warnings and errors.

study_solve_asyncA

Start a background solve job and return immediately with a job_id.

Poll progress with job_status / study_solve_wait / job_wait. The job solves one study or a list of studies sequentially; the saved model (.mph) and a JSON solve log are attached as job artifacts.

Cancellation is cooperative (job_cancel): it is honored between studies/steps; a single monolithic COMSOL solve cannot be interrupted (use session_kill as the hard-stop escape hatch).

Args: study: one study tag to solve (None = all studies of the model). studies: list of study tags to solve sequentially (alternative to study; use it to get cancellation between parameter points). generate_plots: generate default plot groups after each solve. save_model: save the model to <artifacts>/.../<model>.mph and attach it to the job (default true). model: model name/tag (None = current model).

Example: job = study_solve_async(study="std_time") # then: study_solve_wait(job["job_id"], timeout_s=180)

study_solve_waitA

Wait for a background solve job (see study_solve_async) and return it.

Args: job_id: job id returned by study_solve_async. timeout_s: maximum seconds to wait (default 120; use several polls for longer solves).

Returns the job status/progress plus the solve result and artifacts when finished. Does not consume the COMSOL worker thread.

study_logA

Computation timing / solver messages / solution statistics for a study.

COMSOL 6.4's client API does not expose the textual solver log; this returns the machine-readable substitute: last computation time/date/ version, expected computation time, per-solver-sequence warning/error/ information messages, stored solution numbers/levels, and model problems.

Args: study: study tag (None = the only study in the model). model: model name/tag (None = current model).

study_removeB

Remove a study from the model tree (its solver sequences are kept).

Args: study: study tag. model: model name/tag (None = current model).

study_duplicateA

Duplicate a study node (best effort - unsupported by COMSOL 6.4 API).

Args: study: tag of the study to duplicate. new_tag: tag for the copy (None = automatic "_copy"). model: model name/tag (None = current model).

Note: the COMSOL 6.4 client API rejects Study.duplicate()/copy() with "unsupported operation"; this tool then returns an actionable error and suggests model_clone. It is kept for future COMSOL versions.

study_enable_physicsA

Enable/disable physics interfaces for a study step ("Solve for" list).

Args: study: study tag. step: study-step tag (None = the first step). physics: physics tags or paths, e.g. ["ht"] or ["/physics/ht"] (None = every physics interface in the model). enabled: true = solve for the physics, false = deactivate it. model: model name/tag (None = current model).

study_stationaryB

Create a Stationary study and (by default) solve it immediately.

Args: study: study tag (None = automatic "std_stat1"). properties: Stationary step properties (e.g. {"stol": 1e-4, "plot": "on"}). solve: run the study after creating it (default true). generate_plots: generate default plot groups. label: optional display label. model: model name/tag (None = current model).

study_transientA

Create a time-dependent study with a time list and (by default) solve it.

Args: times: COMSOL time list expression, e.g. "range(0,0.1,1)" (0 s to 1 s in 0.1 s steps) or "range(0,0.05,0.5)". A list of values such as [0, 0.1, 0.2] is also accepted. study: study tag (None = automatic "std_time1"). properties: extra Transient step properties (e.g. {"tunit": "s"}). solve: run the study after creating it (default true). generate_plots: generate default plot groups. label: optional display label. model: model name/tag (None = current model).

study_eigenfrequencyB

Create an Eigenfrequency study (n eigenvalues) and (by default) solve it.

Args: neigs: number of eigenvalues/modes to compute (default 6). shift: eigenvalue shift expression, e.g. "0" or "10[Hz]" (None = COMSOL default). eigmethod: eigenvalue solver method, e.g. "manual" or "iterative". study: study tag (None = automatic "std_eig1"). properties: extra Eigenfrequency step properties. solve: run the study after creating it (default true). generate_plots: generate default plot groups. label: optional display label. model: model name/tag (None = current model).

study_frequencyA

Create a Frequency-domain (harmonic) study and (by default) solve it.

Args: frequencies: frequency list: a "range(10,10,100)" expression (10 Hz to 100 Hz in 10 Hz steps), a list ["10", "20", "50"], or a comma string "10,20,50". punit: frequency unit, e.g. "Hz" (default COMSOL unit). study: study tag (None = automatic "std_freq1"). properties: extra Frequency step properties. solve: run the study after creating it (default true). generate_plots: generate default plot groups. label: optional display label. model: model name/tag (None = current model).

study_parametricA

Create a parameter sweep study (Parametric step + solver) and solve it.

Args: pname: parameter name(s) to sweep, e.g. "k" or ["k", "Q0"]. plist: parameter values, e.g. ["1", "5", "10"], "1,5,10" or "range(1,1,10)". Values may include units ("1[W/(mK)]"). punit: optional unit(s) for the values, e.g. "W/(mK)". sweep_type: "Parametric" (default), "MaterialSweep", "BatchSweep", ... study: study tag (None = automatic "std_param1"). solver_step_type: physical solver step appended after the sweep (default "Stationary"; use "Transient" for transient sweeps). solver_step_properties: properties for that solver step. solve: run the study after creating it (default true). generate_plots: generate default plot groups. label: optional display label. model: model name/tag (None = current model).

solver_sequence_listB

List the solver sequences ("Solver Configurations") of the model.

Args: model: model name/tag (None = current model).

solver_sequence_createA

Create a solver sequence for a study (automatic or explicit/manual).

Args: study: study tag (None = the only study in the model). mode: "auto" (Study.createAutoSequences; COMSOL default settings) or "manual" (explicit StudyStep + Variables + solver feature sequence). sequence_tag: tag for a manual sequence (None = automatic "sol1", ...). sequence_type: for mode="auto": "all" (default), "sol" or "jobs". solver_feature_types: for mode="manual": extra feature types to add inside each solver feature, e.g. ["Direct", "FullyCoupled"]. attach: attach the manual sequence to the study (default true). model: model name/tag (None = current model).

solver_sequence_removeB

Remove a solver sequence (solution object) from the model.

Args: sequence: solver sequence tag (e.g. "sol1"). model: model name/tag (None = current model).

solver_feature_listA

List the solver-configuration feature tree of a solver sequence.

Args: sequence: solver sequence tag (None = the only one). parent: optional feature path to start from, e.g. "s1". depth: recursion depth for nested features (default 2). model: model name/tag (None = current model).

solver_feature_addA

Add a solver-configuration feature to a solver sequence.

Args: sequence: solver sequence tag (None = the only one). feature_type: COMSOL solver feature type: "FullyCoupled", "Segregated", "Direct", "Iterative", "Multigrid", "SOR", "Jacobi", "IncompleteLU", "Stationary", "Time", "Eigenvalue", "StudyStep", "Variables", ... (catalog_types("solver")). tag: feature tag (None = automatic from the type, e.g. "fc1"). parent: parent feature path (None = the sequence root). Linear solvers/coupling features usually belong inside a solver feature, e.g. parent="s1". properties: feature properties to set, e.g. {"linsolver": "pardiso"} for a Direct feature. model: model name/tag (None = current model).

solver_feature_setB

Set properties of a solver-configuration feature.

Args: sequence: solver sequence tag (None = the only one). feature: feature path inside the sequence, e.g. "s1" or "s1/fc1". properties: property name -> value, e.g. {"linsolver": "pardiso"}, {"maxiter": 200}, {"stol": 1e-4}. model: model name/tag (None = current model).

solver_feature_propertiesA

Show type, messages and properties of a solver-configuration feature.

Args: sequence: solver sequence tag (None = the only one). feature: feature path inside the sequence, e.g. "s1", "s1/fc1", "v1". include_properties: include the full property dict (default true). model: model name/tag (None = current model).

solver_feature_removeA

Remove a solver-configuration feature (COMSOL 6.4 limitation).

Args: sequence: solver sequence tag (None = the only one). feature: feature path inside the sequence, e.g. "s1/d2". model: model name/tag (None = current model).

Note: COMSOL 6.4's client API refuses to delete solver-configuration features ("cannot remove feature"); this tool reports that as a documented limitation. To restructure a solver sequence, remove and recreate it (solver_sequence_remove + solver_sequence_create).

solver_runB

Run a solver sequence (runAll / runFrom / runFromTo).

Args: sequence: solver sequence tag (None = the only one). mode: "all" (default, SolverSequence.runAll), "from" (runFrom), or "from_to" (runFromTo). from_feature: feature tag to start from (mode="from"/"from_to"), e.g. "st1" or "s1". to_feature: feature tag to stop at (mode="from_to"). generate_plots: ask runAll to create plots (where supported). model: model name/tag (None = current model).

solver_configureA

Generic solver-configuration access: list features, add one, set properties.

One tool for all low-level solver edits:

  • with just sequence -> feature tree of the sequence;

  • with add_feature_type -> create a feature (optionally under parent);

  • with feature + properties -> edit an existing feature.

Args: sequence: solver sequence tag (None = the only one). feature: existing feature path to edit, e.g. "s1/d2". properties: properties to set on feature (or on the new feature). add_feature_type: feature type to create, e.g. "Direct", "FullyCoupled". add_tag: tag for the new feature (None = automatic). parent: parent feature path for the new feature (None = sequence root). model: model name/tag (None = current model).

solution_listA

List stored solutions with type, DoFs, solution counts, datasets, messages.

Args: model: model name/tag (None = current model).

solution_infoA

Detailed information about one stored solution.

Includes: solution type (Stationary/Time/Parametric/Eigenfrequency/...), solver-sequence tag/type, attached study, storage size, DoF count, dependent fields and their DoFs, solution loop levels (t, k, lambda), solution numbers, parameter values, result datasets that use it, and solver warning/error messages.

Args: solution: solution tag (e.g. "sol1"; None = the only solution). model: model name/tag (None = current model).

solution_selectB

Point a result dataset at a stored solution (dataset "solution" property).

Args: solution: solution tag (e.g. "sol1"). dataset: result dataset tag (e.g. "dset1"; None = the only dataset). model: model name/tag (None = current model).

solution_removeC

Remove a stored solution (solver sequence) from the model.

Args: solution: solution tag (e.g. "sol1"). model: model name/tag (None = current model).

tree_childrenA

List the child nodes of a model-tree node (groups, features, properties).

Args: path: node path such as "physics/ht" or "geometries/geom1/blk1". Empty string lists the model root groups. model: model name/tag (None = current model).

tree_infoB

Show a node's tag, label, feature type, active state and selection.

Args: path: model-tree path (e.g. "physics/ht/temp1"). model: model name/tag (None = current model). include_properties: also return all property values (can be large). include_children: also return child nodes.

tree_propertiesC

Return all settable property names and values of a node.

tree_get_propertyC

Read one property from a node.

tree_set_propertyB

Set one property on a node.

value may be a string (expressions with units, e.g. "300[K]"), a number, a boolean, or a list (e.g. ["1","1","1"] for sizes). Use tree_properties first to discover property names.

tree_set_propertiesC

Set multiple properties on one node in a single call.

tree_createB

Create a child feature under a container node (generic escape hatch).

Examples: path="physics/ht", feature_type="HeatFluxBoundary", extra_args=[2]; path="functions", feature_type="Analytic"; path="plots", feature_type="PlotGroup3D". Use the catalog tools to discover valid feature types.

tree_removeC

Remove a feature node from the model tree.

tree_renameC

Rename a node (display label, not tag).

tree_retagC

Change a node's tag (programmatic identifier).

tree_toggleC

Enable/disable a feature node (None = flip).

tree_runC

Execute the node's run action (build geometry, generate mesh, run study, ...).

tree_findC

Search the model tree for nodes whose label or tag matches a regex.

Args: pattern: regular expression, e.g. "temp|T0" or "^ht". root: subtree to search from ("" = whole model). max_depth: recursion depth limit.

tree_dumpC

Dump a bounded JSON tree of part of the model tree.

tree_selection_getC

Show the entities / named selection assigned to a node.

tree_selection_setB

Assign entities to a node's selection.

Args: path: feature node path (e.g. "physics/ht/temp1"). entities: list of entity numbers, a named-selection tag, or "all". Pass null/empty to clear the selection.

visual_view_imageA

Display an exported COMSOL image inline (PNG/JPEG/BMP/GIF/WebP).

Use the path returned by plot_export_image / plot_quick / export tools. Returns the image itself as MCP image content plus a short text summary.

Args: path: absolute path to the image file. max_width: downscale to this pixel width to keep payloads small (0 = original).

visual_view_animationA

Display sampled frames of a COMSOL animation (GIF/MP4/AVI/WebM) as a filmstrip.

Returns up to frames image content blocks (evenly sampled) plus a summary (frame count, duration, fps when available). Useful to review an animation produced by the anim_* tools without opening an external player.

Args: path: absolute path to the GIF/MP4/AVI/WebM file. frames: number of frames to sample (1-12). max_width: downscale each sampled frame to this width.

comsol_capabilitiesA

Server capabilities: session state, licensed modules, catalogs, settings.

Call this first to learn what is available without starting COMSOL.

health_checkA

Check Python packages, COMSOL installation, license and workspace readiness.

catalog_physics_interfacesB

List COMSOL physics interface types (932 available in COMSOL 6.4).

Args: dimension: geometry dimension filter: "3", "2", "1", "2DAxi", "Global". query: substring filter on type name or description (e.g. "heat", "electro"). limit: maximum number of results.

catalog_physics_featuresA

List the feature types (boundary/domain conditions) allowed in a physics interface.

Args: interface: interface type name, e.g. "HeatTransfer", "SolidMechanics", "LaminarFlow", "Electrostatics", "PressureAcoustics". dimension: restrict to a dimension ("3", "2", ...) when ambiguous. query: substring filter (e.g. "flux", "inlet", "fixed").

catalog_geometry_featuresB

List geometry feature types available for a dimension (primitives, booleans, transforms, ...).

catalog_mesh_featuresC

List mesh feature types available for a dimension (FreeTet, Sweep, Size, BndLayer, ...).

catalog_study_featuresC

List study step and study feature types (Stationary, Transient, Eigenfrequency, ...).

catalog_typesC

List a registry of result/mesh/solver types.

Args: category: plot | plot_features | numerical | dataset | export | function | solver | common.

catalog_plot_featuresB

List plot feature types (121 in COMSOL 6.4) and attribute features.

Args: query: substring filter, e.g. "surface", "streamline", "arrow". kind: "plot" for primary plot features or "attribute" for attributes (Color/Deform/Height/Filter/Transparency/...).

server_infoA

Return server version, settings paths and workspace layout.

Prompts

Interactive templates invoked by user choice

NameDescription

No prompts

Resources

Contextual data attached and managed by the client

NameDescription
COMSOL session statusCurrent COMSOL session state, version, licensed modules, models.
Loaded modelsModels currently loaded in COMSOL.
Type catalog summaryCounts of COMSOL physics/geometry/mesh/study/results types.
Workspace pathsArtifact / model / scratch directories of this MCP server.

TDQS

B3.2/5.0

Scored across 274 tools

Disambiguation3/5

The tools are grouped by domain, but there are many overlapping or alias-like entries such as mesh_run/mesh_build, export_mesh/mesh_export, geom_export/export_geometry, and generic evaluators alongside specialized result_eval_* tools. Descriptions often clarify the intended use, but with 274 tools an agent faces a high risk of selecting a near-duplicate or lower-level escape hatch instead of the intended tool.

Naming Consistency5/5

Nearly all tools use a consistent snake_case prefix_action or prefix_noun convention grouped by domain: geom_*, mesh_*, phys_*, mat_*, study_*, solver_*, plot_*, result_*, anim_*, and so on. A few generic names like java_eval, health_check, and server_info deviate slightly, but the overall naming pattern is highly predictable.

Tool Count1/5

A 274-tool surface is far beyond what is appropriate for reliable tool selection, even for a broad domain like COMSOL Multiphysics. The set contains many aliases, specialized shortcuts, low-level escape hatches, and duplicated export paths, making the surface feel sprawling rather than well-scoped.

Completeness5/5

The toolset covers the full simulation lifecycle: model/session management, parameters, geometry, selections, materials, physics, multiphysics couplings, meshing, studies, solver configuration, results evaluation, plots, animations, exports, reports, libraries, and documentation. The few limitations noted, such as unsupported study duplication or solver-feature deletion, are COMSOL API constraints rather than missing surface coverage.

Maintenance

ActivityMaintained
ResponsivenessNo recent community issues