Skip to main content
Glama

list_ports

Discover available serial port devices by retrieving their paths, descriptions, and hardware IDs for UART communication setup.

Instructions

列出所有可用串口设备,返回设备路径、描述信息和硬件ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function that executes the list_ports tool logic: retrieves the serial manager and returns a list of available ports as dictionaries.
    def list_ports() -> list[dict[str, str]]: """列出所有可用串口设备 返回系统中所有可用的串口设备列表,已过滤黑名单中的串口。 Returns: 串口信息列表,每个元素包含 port、description、hwid 字段 """ manager = get_serial_manager() ports = manager.list_ports() return [p.to_dict() for p in ports]
  • Tool schema definition including name, description, and empty input schema (no parameters required).
    LIST_PORTS_TOOL: dict[str, Any] = { "name": "list_ports", "description": "列出所有可用串口设备,返回设备路径、描述信息和硬件ID", "inputSchema": { "type": "object", "properties": {}, "required": [], }, }
  • Registration of the list_ports tool in the MCP server's list_tools handler, using the schema from list_ports.py.
    types.Tool( name=LIST_PORTS_TOOL["name"], description=LIST_PORTS_TOOL["description"], inputSchema=LIST_PORTS_TOOL["inputSchema"], ),
  • Dispatch/handling of list_ports tool call in the MCP server's call_tool handler, invoking the list_ports function.
    if name == "list_ports": result = list_ports()

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/donnel666/uart-mcp'

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