Skip to main content
Glama
Ching-Chiang

comsol-mcp

by Ching-Chiang

get_parameters

Retrieve all current global parameters from the active COMSOL model on the server.

Instructions

Return current global parameters from the selected server-side model.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The 'get_parameters' tool handler function. Decorated with @mcp.tool(), it defines _impl() which uses _require_model() and _parameter_rows() to return current global parameters from the server-side model, then delegates to _run_tool().
    @mcp.tool()
    def get_parameters() -> str:
        """Return current global parameters from the selected server-side model."""
    
        def _impl() -> dict[str, Any]:
            model = _require_model()
            rows = _parameter_rows(model)
            return {"label": _safe_model_label(model), "parameters": rows, "count": len(rows)}
    
        return _run_tool("get_parameters", _impl)
  • Helper function _parameter_rows() that extracts parameter names and expressions from the COMSOL model via Java API (model.java.param().varnames() and .get(key)).
    def _parameter_rows(model: Any) -> list[dict[str, str]]:
        names = list(model.java.param().varnames())
        rows = []
        for name in names:
            key = str(name)
            rows.append(
                {
                    "name": key,
                    "expression": str(model.java.param().get(key)),
                }
            )
        return rows
  • Tool registration via the @mcp.tool() decorator on the get_parameters function.
    @mcp.tool()
  • Generic _run_tool() utility that wraps tool execution with logging, locking, error handling, and result formatting.
    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 function signature has no parameters (no input schema), and returns a string (the JSON serialized result). The docstring describes the purpose.
    def get_parameters() -> str:
Behavior2/5

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

No annotations are provided, and the description does not disclose behavioral traits such as read-only nature, side effects, or error conditions (e.g., if no model is loaded). The agent has no information about what happens if the server state is invalid.

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

Conciseness5/5

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

The description is a single, front-loaded sentence with no redundant words. It conveys the core purpose efficiently.

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 tool has zero parameters and an output schema exists, the description still lacks context about prerequisites (e.g., model loaded, server connected) and when to call it. This is inadequate for a tool that interacts with server state.

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

Parameters3/5

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

With zero parameters, the input schema provides no parameter info, but the description does not add meaning beyond stating the tool returns 'global parameters'. It does not clarify what constitutes global parameters or how they relate to the model, so it adds minimal value.

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 tool returns global parameters from the server-side model, using a specific verb ('Return') and resource ('global parameters'). It distinguishes itself from sibling 'set_parameters'.

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?

The description does not provide guidance on when to use this tool versus alternatives like model_tree or server_info. No prerequisites, exclusions, or context are mentioned.

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