Skip to main content
Glama

comsol_python

Run custom Python inside a live COMSOL Multiphysics session to access the Java API, create physics, modify models, or execute operations not covered by standard tools.

Instructions

在当前 COMSOL 会话里执行 Python 代码(COMSOL Java API 逃生舱)。可用变量:model(mph Model)、java(model.java,com.comsol.model.Model)、client、mph、np、json。最后一行若是表达式会作为返回值。示例:java.modelNode('comp1').physics().create('ht','HeatTransfer','geom1')

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "code": "<code>"
    },
    "name": "comsol_python"
  }
}

Input Schema

NameRequiredDescriptionDefault
codeYes

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.4.5

TDQS

B3.3/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries full behavioral burden for what is effectively arbitrary code execution in a live session. It discloses the execution context and pre-bound variables, but says nothing about persistence of side effects, absence of sandboxing or rollback, privilege level, timeouts, or that code can corrupt/delete model state.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with the core purpose, then variables, then return semantics, then a concrete example. Dense but every element is useful; nothing is redundant.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

An output schema exists, so return values need little explanation beyond the last-line note. However, for a high-risk code-execution tool with zero annotation coverage, the definition is incomplete without any safety, persistence, or scope warning.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 0% with a single 'code' parameter, so the description must compensate and largely does: it enumerates available variables (model, java, client, mph, np, json) and explains return-value semantics for the last line. Only minor gaps remain, e.g. no constraints on code format or error handling.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource: execute Python code inside the current COMSOL session, and identifies itself as a Java API escape hatch with an example. This clearly separates it from typed siblings such as comsol_model or comsol_physics, though it does not name them.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The phrase 'escape hatch' implies usage when high-level tools cannot do the job, but the description never states that explicitly or tells the agent to prefer comsol_model/comsol_physics/etc. for standard operations. Usage is inferable rather than stated.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.