Skip to main content
Glama

close_session

Terminate an active serial port communication session to free system resources and ensure proper device disconnection.

Instructions

关闭指定的终端会话

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
session_idYes会话ID(即串口路径),如 /dev/ttyUSB0 或 COM1

Implementation Reference

  • The handler function for the 'close_session' tool. It retrieves the terminal manager and calls its close_session method with the provided session_id, returning the result as a dictionary.
    def close_session(session_id: str) -> dict[str, Any]: """关闭指定终端会话 Args: session_id: 会话ID(串口路径) Returns: 操作结果 """ manager = get_terminal_manager() return manager.close_session(session_id)
  • The schema definition for the 'close_session' tool, specifying the input schema that requires a 'session_id' string.
    CLOSE_SESSION_TOOL: dict[str, Any] = { "name": "close_session", "description": "关闭指定的终端会话", "inputSchema": { "type": "object", "properties": { "session_id": { "type": "string", "description": "会话ID(即串口路径),如 /dev/ttyUSB0 或 COM1", }, }, "required": ["session_id"], }, }
  • Registration of the 'close_session' tool in the MCP server's list_tools handler, providing name, description, and input schema.
    types.Tool( name=CLOSE_SESSION_TOOL["name"], description=CLOSE_SESSION_TOOL["description"], inputSchema=CLOSE_SESSION_TOOL["inputSchema"], ),
  • Dispatch logic in the MCP server's call_tool handler that invokes the close_session function when the tool 'close_session' is called.
    elif name == "close_session": result = close_session(**arguments)

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