Skip to main content
Glama

get_status

Retrieve current status and configuration details for an open serial port to monitor device communication parameters.

Instructions

获取已打开串口的当前状态和配置信息

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
portYes串口路径

Implementation Reference

  • The handler function for the 'get_status' MCP tool. It calls the serial manager's get_status method and converts the result to a dictionary.
    def get_status(port: str) -> dict[str, Any]:
        """获取串口状态
    
        Args:
            port: 串口路径
    
        Returns:
            串口状态信息
        """
        manager = get_serial_manager()
        status = manager.get_status(port)
        return status.to_dict()
  • The input schema definition for the 'get_status' tool used in MCP registration.
    GET_STATUS_TOOL: dict[str, Any] = {
        "name": "get_status",
        "description": "获取已打开串口的当前状态和配置信息",
        "inputSchema": {
            "type": "object",
            "properties": {
                "port": {
                    "type": "string",
                    "description": "串口路径",
                },
            },
            "required": ["port"],
        },
    }
  • Tool dispatch registration in the MCP server's handle_call_tool method, which invokes the get_status handler.
    elif name == "get_status":
        result = get_status(**arguments)
  • Tool listing registration in the MCP server's handle_list_tools method, exposing the get_status tool.
    types.Tool(
        name=GET_STATUS_TOOL["name"],
        description=GET_STATUS_TOOL["description"],
        inputSchema=GET_STATUS_TOOL["inputSchema"],
    ),
  • Core helper method in SerialManager that retrieves and returns the detailed PortStatus for a specific port.
    def get_status(self, port: str) -> PortStatus:
        """获取串口状态
    
        Args:
            port: 串口路径
    
        Returns:
            串口状态
    
        Raises:
            PortClosedError: 串口未打开
        """
        with self._lock:
            if port not in self._ports:
                raise PortClosedError(port)
    
            managed = self._ports[port]
            return PortStatus(
                port=port,
                is_open=True,
                config=managed.config,
                connected=managed.is_connected,
                reconnecting=managed.reconnecting,
            )

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