Skip to main content
Glama
Ching-Chiang

comsol-mcp

by Ching-Chiang

delete_feature

Remove a specific geometry feature from a server-side COMSOL model by specifying component, geometry, and tag.

Instructions

Delete a geometry feature from the selected server-side model.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
componentYes
geometryYes
tagYes
run_geometryNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The @mcp.tool() decorator registers 'delete_feature' as an MCP tool with FastMCP.
    @mcp.tool()
    def delete_feature(component: str, geometry: str, tag: str, run_geometry: bool = False) -> str:
  • The 'delete_feature' function (lines 847-870) is the handler. It defines an inner _impl() that gets the current model, resolves component/geometry/feature tag, removes the feature via feature_container.remove(feature_tag), optionally runs geometry, and returns the result. The _impl is wrapped by _run_tool() for consistent error handling and logging.
    def delete_feature(component: str, geometry: str, tag: str, run_geometry: bool = False) -> str:
        """Delete a geometry feature from the selected server-side model."""
    
        def _impl() -> dict[str, Any]:
            model = _require_model()
            comp = component.strip() or "comp1"
            geom = geometry.strip() or "geom1"
            feature_tag = tag.strip()
            if not feature_tag:
                raise ValueError("Feature tag is required.")
            feature_container = model.java.component(comp).geom(geom).feature()
            if feature_tag not in list(feature_container.tags()):
                raise LookupError(f'Feature "{feature_tag}" does not exist.')
            feature_container.remove(feature_tag)
            if run_geometry:
                model.java.component(comp).geom(geom).run()
            return {
                "component": comp,
                "geometry": geom,
                "tag": feature_tag,
                "run_geometry": bool(run_geometry),
            }
    
        return _run_tool("delete_feature", _impl)
  • The _run_tool helper wraps the handler callback with logging, lock management, error handling, and result formatting 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 _tool_result helper formats the success/failure response JSON including tool name, timestamp, server status, data, and error info.
    def _tool_result(tool: str, success: bool, data: dict[str, Any] | None = None, error: str = "") -> str:
        global _last_command, _last_error
        _last_command = tool
        _last_error = error
        payload = {
            "success": success,
            "tool": tool,
            "timestamp": time.time(),
            "datetime": _now_iso(),
            "server": _status_payload(),
            "data": data or {},
            "error": error,
            "log_path": str(SERVER_LOG),
            "operations_path": str(OPERATIONS_FILE),
        }
        _append_operation(
            {
                "tool": tool,
                "success": success,
                "error": error,
                "data": data or {},
            }
        )
        _write_status({"last_command": tool, "last_error": error})
        return _json(payload)
  • The _require_model helper ensures a server-side model is available before the feature deletion can proceed.
    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."
Behavior2/5

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

With no annotations, the description must disclose behavioral traits. It only says 'Delete' but omits details like reversibility, side effects, required state, or impact of the 'run_geometry' parameter.

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?

While a single sentence is concise, it omits essential parameter details, making it inadequate for a tool with 4 parameters and a complex operation.

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

Completeness1/5

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

Given the lack of annotations, presence of an output schema not described, and 4 undocumented parameters, the description is severely incomplete. It does not enable correct invocation.

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 explanation for any of the 4 parameters (component, geometry, tag, run_geometry). The agent gains no insight beyond raw names.

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

Purpose5/5

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

The description clearly states the action ('Delete') and the resource ('geometry feature') with context ('from the selected server-side model'), distinguishing it from siblings like create_feature and update_feature.

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 on when to use this tool versus alternatives (e.g., run_feature, update_feature). No conditions, prerequisites, or when-not advice provided.

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