Skip to main content
Glama
juanqui

joulescope-mcp

by juanqui

List JouleScope devices

list_devices
Read-only

List connected JouleScope devices, including JS220 serial numbers and firmware versions, to identify and check device status.

Instructions

List connected JouleScope devices, including JS220 serial and firmware details when available.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The core logic of list_devices: iterates connected devices, retrieves serial number, hardware/firmware/fpga versions, and returns driver_version + devices list.
    def list_devices(self) -> dict[str, Any]:
        with self._driver_session() as driver:
            devices = []
            for device_path in list(driver.device_paths()):
                item: dict[str, Any] = {
                    "path": device_path,
                    "model": "js220" if "/js220/" in device_path else "unknown",
                    "serial_number": device_path.rstrip("/").split("/")[-1],
                    "available": True,
                }
                try:
                    driver.open(device_path, mode="restore")
                    if "/js220/" in device_path:
                        item["hardware_version"] = _version_to_str(driver.query(f"{device_path}/c/hw/version"))
                        item["firmware_version"] = _version_to_str(driver.query(f"{device_path}/c/fw/version"))
                        item["fpga_version"] = _version_to_str(driver.query(f"{device_path}/s/fpga/version"))
                except Exception as exc:
                    item["available"] = False
                    item["error"] = str(exc)
                finally:
                    with suppress(Exception):
                        driver.close(device_path)
                devices.append(item)
            return {"driver_version": self.driver_version, "devices": devices}
  • The MCP tool registration for 'list_devices' using the @mcp.tool decorator. Delegates to service.list_devices().
    @mcp.tool(
        title="List JouleScope devices",
        description="List connected JouleScope devices, including JS220 serial and firmware details when available.",
        annotations=read_only,
        structured_output=True,
    )
    def list_devices() -> dict[str, Any]:
        try:
            return service.list_devices()
        except JoulescopeMcpError as exc:
            raise _tool_error(exc) from exc
  • Helper used by list_devices to convert integer-encoded version numbers (e.g., firmware version) into dot-separated strings.
    def _version_to_str(version: Any) -> str:
        if isinstance(version, str):
            return version
        if not isinstance(version, int):
            return str(version)
        v_patch = version & 0xFFFF
        v_minor = (version >> 16) & 0xFF
        v_major = (version >> 24) & 0xFF
        return f"{v_major}.{v_minor}.{v_patch}"
  • The return type dict[str, Any] and the structured output shape (driver_version string + devices array with path/model/serial_number/available/versions) effectively serve as the schema.
    def list_devices(self) -> dict[str, Any]:
        with self._driver_session() as driver:
            devices = []
            for device_path in list(driver.device_paths()):
                item: dict[str, Any] = {
                    "path": device_path,
                    "model": "js220" if "/js220/" in device_path else "unknown",
                    "serial_number": device_path.rstrip("/").split("/")[-1],
                    "available": True,
                }
                try:
                    driver.open(device_path, mode="restore")
                    if "/js220/" in device_path:
                        item["hardware_version"] = _version_to_str(driver.query(f"{device_path}/c/hw/version"))
                        item["firmware_version"] = _version_to_str(driver.query(f"{device_path}/c/fw/version"))
                        item["fpga_version"] = _version_to_str(driver.query(f"{device_path}/s/fpga/version"))
                except Exception as exc:
                    item["available"] = False
                    item["error"] = str(exc)
                finally:
                    with suppress(Exception):
                        driver.close(device_path)
                devices.append(item)
            return {"driver_version": self.driver_version, "devices": devices}
Behavior4/5

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

Annotations already indicate read-only and non-destructive behavior. The description adds that it returns serial and firmware details when available, providing useful behavioral context beyond annotations.

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?

Single sentence, 15 words, front-loaded with the action. No redundant information.

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

Completeness5/5

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

With no parameters and an output schema present, the description fully specifies the tool's behavior. It covers what is listed and what details are included.

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?

There are no parameters (baseline 4). The description does not need to add parameter info since the schema is empty and coverage is 100%.

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 ('List connected JouleScope devices') and includes specific details about available information (JS220 serial and firmware). It effectively distinguishes from siblings like device_info which targets individual devices.

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?

No explicit guidance on when to use this tool versus alternatives. However, the simple nature of listing all devices makes the usage implied; agents can infer it for broad device enumeration.

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