list_sessions
Retrieve active terminal sessions for serial port communication, enabling monitoring and management of connected devices through the UART server.
Instructions
列出所有活动的终端会话
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/uart_mcp/tools/terminal.py:92-100 (handler)The `list_sessions` function implements the core tool logic. It retrieves the terminal manager and returns a dictionary containing the list of active sessions and their count.def list_sessions() -> dict[str, Any]: """列出所有活动会话 Returns: 会话列表 """ manager = get_terminal_manager() sessions = manager.list_sessions() return {"sessions": sessions, "count": len(sessions)}
- The `LIST_SESSIONS_TOOL` dictionary defines the tool's name, description, and input schema (no required parameters).LIST_SESSIONS_TOOL: dict[str, Any] = { "name": "list_sessions", "description": "列出所有活动的终端会话", "inputSchema": { "type": "object", "properties": {}, "required": [], }, }
- src/uart_mcp/server.py:123-127 (registration)Registration of the `list_sessions` tool in the `handle_list_tools` function, providing it to the MCP server.types.Tool( name=LIST_SESSIONS_TOOL["name"], description=LIST_SESSIONS_TOOL["description"], inputSchema=LIST_SESSIONS_TOOL["inputSchema"], ),
- src/uart_mcp/server.py:171-172 (registration)Dispatch logic in `handle_call_tool` that invokes the `list_sessions` handler when the tool is called.elif name == "list_sessions": result = list_sessions()