Skip to main content
Glama

get_status

Retrieve current status and configuration details for an open serial port to monitor connection parameters and operational state.

Instructions

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
portYes串口路径

Implementation Reference

  • The primary handler function for the 'get_status' tool. It retrieves the serial manager and calls its get_status method, returning the result as 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 schema definition for the 'get_status' tool, including name, description, and input schema. This is used for MCP tool registration.
    GET_STATUS_TOOL: dict[str, Any] = { "name": "get_status", "description": "获取已打开串口的当前状态和配置信息", "inputSchema": { "type": "object", "properties": { "port": { "type": "string", "description": "串口路径", }, }, "required": ["port"], }, }
  • Dispatch logic in the MCP server's call_tool handler that routes 'get_status' calls to the tool function.
    elif name == "get_status": result = get_status(**arguments)
  • Registration of the 'get_status' tool in the MCP server's list_tools handler, providing the schema.
    types.Tool( name=GET_STATUS_TOOL["name"], description=GET_STATUS_TOOL["description"], inputSchema=GET_STATUS_TOOL["inputSchema"], ),
  • Core helper method in SerialManager that implements the actual port status retrieval logic, called by the tool handler.
    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