Skip to main content
Glama
Ching-Chiang

comsol-mcp

by Ching-Chiang

run_feature

Execute a geometry or mesh sequence on a COMSOL server-side model using collection and tag identifiers.

Instructions

Run a geometry or mesh sequence on the selected server-side model.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
collectionYes
tagYes
componentNocomp1

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • Inner implementation function (_impl) that gets the current model, validates the collection type ('geometry' or 'mesh'), and calls .run() on the respective COMSOL Java sequence. Returns a dict with collection, component, and tag.
    def _impl() -> dict[str, Any]:
        model = _require_model()
        comp = component.strip() or "comp1"
        seq_tag = tag.strip()
        kind = collection.strip().lower()
        if not seq_tag:
            raise ValueError("Feature tag is required.")
        if kind == "geometry":
            model.java.component(comp).geom(seq_tag).run()
        elif kind == "mesh":
            model.java.component(comp).mesh(seq_tag).run()
        else:
            raise ValueError('collection must be "geometry" or "mesh".')
        return {"collection": kind, "component": comp, "tag": seq_tag}
    
    return _run_tool("run_feature", _impl)
  • The @mcp.tool() decorator registers 'run_feature' as an MCP tool with parameters: collection (str), tag (str), component (str, default 'comp1').
    @mcp.tool()
    def run_feature(collection: str, tag: str, component: str = "comp1") -> str:
  • Function signature defines the input schema: 'collection: str' (geometry or mesh), 'tag: str' (feature tag), 'component: str = "comp1"' (optional component tag).
    def run_feature(collection: str, tag: str, component: str = "comp1") -> str:
  • The _run_tool helper wraps the _impl callback with logging, runtime locking, and error handling, returning a standardized JSON result via _tool_result.
    def _run_tool(tool: str, callback) -> str:
        _setup_logging()
        with _runtime_lock:
            try:
                data = callback()
                return _tool_result(tool, True, data=data)
            except Exception as exc:
                logging.exception("Tool %s failed", tool)
                return _tool_result(tool, False, error=str(exc))
  • The _require_model helper retrieves the current active COMSOL model or adopts one from the server, throwing an error if none is available.
    def _require_model() -> Any:
        global _current_model
        _require_client()
        if _current_model is None:
            adopted = _adopt_model_by_name("")
            if adopted is not None:
                _set_current_model(adopted, origin="adopted")
            else:
                raise RuntimeError(
                    "No current model is selected. Use model_create() or model_load(), "
                    "or connect to a server with exactly one loaded model."
                )
        return _current_model
Behavior2/5

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

Without annotations, the description should disclose behavioral traits. It only says 'run', lacking details on whether it modifies state, is destructive, requires authentication, or what the output represents. Very limited transparency.

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

Conciseness2/5

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

The description is extremely concise (one sentence), but this comes at the cost of missing critical information. It is not well-structured to front-load key details for an agent.

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

Completeness2/5

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

Given the lack of annotations, high parameter count (3), and an output schema that is not described, the description fails to provide sufficient context for an agent to correctly invoke the tool. It omits return behavior, side effects, and parameter roles.

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

Parameters1/5

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

Schema description coverage is 0%, yet the description adds no meaning to any of the three parameters (collection, tag, component). It does not explain what these parameters represent or how they affect execution.

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?

The description clearly states the action 'Run' and the target 'geometry or mesh sequence on the selected server-side model'. It effectively conveys what the tool does and distinguishes it from sibling tools like create_feature or delete_feature, though it could be more explicit about the semantic difference.

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

Usage Guidelines2/5

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

No guidance is provided on when to use this tool versus alternatives. The description implies use for executing a sequence, but there is no explicit context about prerequisites, conditions, or excluded use cases.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Ching-Chiang/comsol-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server