Skip to main content
Glama
juanqui

joulescope-mcp

by juanqui

Configure JS220 frontend

configure_frontend
Idempotent

Configure current and voltage range modes for the JS220 precision energy analyzer, using auto for typical measurements.

Instructions

Configure JS220 current and voltage range modes. Use auto for normal agent measurements.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
device_pathNo
current_range_modeNoauto
voltage_range_modeNoauto
current_rangeNo
voltage_rangeNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Actual implementation of configure_frontend. Validates allowed modes (auto/manual/off), builds driver topic commands for current/voltage range mode and range selection, publishes them via the driver, and returns the list of published topics.
    def configure_frontend(
        self,
        device_path: str | None = None,
        current_range_mode: str | None = "auto",
        voltage_range_mode: str | None = "auto",
        current_range: str | None = None,
        voltage_range: str | None = None,
    ) -> dict[str, Any]:
        allowed_mode = {"auto", "manual", "off"}
        if current_range_mode is not None and current_range_mode not in allowed_mode:
            raise JoulescopeMcpError(f"current_range_mode must be one of {sorted(allowed_mode)}")
        if voltage_range_mode is not None and voltage_range_mode not in allowed_mode:
            raise JoulescopeMcpError(f"voltage_range_mode must be one of {sorted(allowed_mode)}")
    
        published: list[dict[str, Any]] = []
        with self._driver_session() as driver:
            device = self._select_device(driver, device_path=device_path)
            driver.open(device, mode="restore")
            try:
                commands: list[tuple[str, Any]] = []
                if current_range_mode is not None:
                    commands.append((f"{device}/s/i/range/mode", current_range_mode))
                if voltage_range_mode is not None:
                    commands.append((f"{device}/s/v/range/mode", voltage_range_mode))
                if current_range is not None:
                    commands.append((f"{device}/s/i/range/select", current_range))
                if voltage_range is not None:
                    commands.append((f"{device}/s/v/range/select", voltage_range))
                for topic, value in commands:
                    driver.publish(topic, value)
                    published.append({"topic": topic, "value": value})
            finally:
                driver.close(device)
        return {"device_path": device, "published": published}
  • MCP tool registration for configure_frontend using @mcp.tool decorator. Defines the tool schema (title, description, annotations with config_tool, structured_output) and parameter types including Literal constraints. Delegates to service.configure_frontend.
    @mcp.tool(
        title="Configure JS220 frontend",
        description="Configure JS220 current and voltage range modes. Use auto for normal agent measurements.",
        annotations=config_tool,
        structured_output=True,
    )
    def configure_frontend(
        device_path: str | None = None,
        current_range_mode: Literal["auto", "manual", "off"] | None = "auto",
        voltage_range_mode: Literal["auto", "manual", "off"] | None = "auto",
        current_range: str | None = None,
        voltage_range: str | None = None,
    ) -> dict[str, Any]:
        try:
            return service.configure_frontend(
                device_path=device_path,
                current_range_mode=current_range_mode,
                voltage_range_mode=voltage_range_mode,
                current_range=current_range,
                voltage_range=voltage_range,
            )
        except JoulescopeMcpError as exc:
            raise _tool_error(exc) from exc
  • config_tool annotation definition used for configure_frontend: readOnlyHint=False, destructiveHint=False, idempotentHint=True (configuring frontend is idempotent).
    config_tool = ToolAnnotations(readOnlyHint=False, destructiveHint=False, idempotentHint=True)
  • Unit test for configure_frontend verifying that publishing the expected topics ('s/i/range/mode' and 's/v/range/mode') with values 'auto' works correctly.
    def test_configure_frontend_publishes_expected_topics() -> None:
        driver = FakeDriver()
        result = service_with(driver).configure_frontend(current_range_mode="auto", voltage_range_mode="auto")
        assert result["published"] == [
            {"topic": "u/js220/005920/s/i/range/mode", "value": "auto"},
            {"topic": "u/js220/005920/s/v/range/mode", "value": "auto"},
        ]
Behavior3/5

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

Annotations already indicate not read-only, not destructive, and idempotent. The description adds that it configures modes and suggests auto for normal use, but does not detail side effects, prerequisites, or behavior of other parameters.

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?

The description is a single concise sentence without fluff. However, it could include more information about the undocumented parameters without violating conciseness.

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?

With 5 parameters, 0% schema coverage, and a modest description, the tool is incomplete. The description only covers two parameters, and the presence of an output schema does not absolve the need to explain inputs.

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

Parameters2/5

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

Schema description coverage is 0%, so the description must compensate. It explains current_range_mode and voltage_range_mode but ignores device_path, current_range, and voltage_range, leaving their purpose and acceptable values undefined.

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 configures JS220 current and voltage range modes, using the verb 'configure' and specifying the resource. It uniquely identifies its purpose among siblings, as no other sibling tool performs configuration.

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 description advises 'Use auto for normal agent measurements,' providing context for a common use case, but lacks when-not to use or guidance for manual/off modes. No comparison to alternatives is given.

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/juanqui/joulescope-mcp'

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