Skip to main content
Glama

get_session_info

Retrieve detailed information about a specific terminal session identified by its serial port path, such as /dev/ttyUSB0 or COM1, enabling verification of connection status and configuration.

Instructions

获取指定终端会话的详细信息

Input Schema

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

Implementation Reference

  • The handler function for get_session_info tool. It calls manager.get_session_info(session_id) and returns the result as a dict.
    def get_session_info(session_id: str) -> dict[str, Any]:
        """获取会话详细信息
    
        Args:
            session_id: 会话ID(串口路径)
    
        Returns:
            会话信息
        """
        manager = get_terminal_manager()
        return manager.get_session_info(session_id)
  • TerminalManager.get_session_info method - the core implementation that retrieves a TerminalSession by session_id and returns its info as a dict via session.get_info().to_dict().
    def get_session_info(self, session_id: str) -> dict[str, Any]:
        """获取会话详细信息
    
        Args:
            session_id: 会话ID(串口路径)
    
        Returns:
            会话信息
    
        Raises:
            SessionNotFoundError: 会话不存在
        """
        session = self.get_session(session_id)
        return session.get_info().to_dict()
  • The input schema definition for the get_session_info tool (GET_SESSION_INFO_TOOL dict), specifying session_id as a required string parameter.
    GET_SESSION_INFO_TOOL: dict[str, Any] = {
        "name": "get_session_info",
        "description": "获取指定终端会话的详细信息",
        "inputSchema": {
            "type": "object",
            "properties": {
                "session_id": {
                    "type": "string",
                    "description": "会话ID(即串口路径),如 /dev/ttyUSB0 或 COM1",
                },
            },
            "required": ["session_id"],
        },
    }
  • Registration: get_session_info is imported and called in the handle_call_tool MCP server handler when name == 'get_session_info'.
    elif name == "create_session":
        result = create_session(**arguments)
    elif name == "close_session":
        result = close_session(**arguments)
    elif name == "send_command":
        result = send_command(**arguments)
    elif name == "read_output":
        result = read_output(**arguments)
    elif name == "list_sessions":
        result = list_sessions()
    elif name == "get_session_info":
        result = get_session_info(**arguments)
  • Registration: GET_SESSION_INFO_TOOL is listed in handle_list_tools, making get_session_info available as an MCP tool (lines 128-132).
        # 终端会话工具
        types.Tool(
            name=CREATE_SESSION_TOOL["name"],
            description=CREATE_SESSION_TOOL["description"],
            inputSchema=CREATE_SESSION_TOOL["inputSchema"],
        ),
        types.Tool(
            name=CLOSE_SESSION_TOOL["name"],
            description=CLOSE_SESSION_TOOL["description"],
            inputSchema=CLOSE_SESSION_TOOL["inputSchema"],
        ),
        types.Tool(
            name=SEND_COMMAND_TOOL["name"],
            description=SEND_COMMAND_TOOL["description"],
            inputSchema=SEND_COMMAND_TOOL["inputSchema"],
        ),
        types.Tool(
            name=READ_OUTPUT_TOOL["name"],
            description=READ_OUTPUT_TOOL["description"],
            inputSchema=READ_OUTPUT_TOOL["inputSchema"],
        ),
        types.Tool(
            name=LIST_SESSIONS_TOOL["name"],
            description=LIST_SESSIONS_TOOL["description"],
            inputSchema=LIST_SESSIONS_TOOL["inputSchema"],
        ),
        types.Tool(
            name=GET_SESSION_INFO_TOOL["name"],
            description=GET_SESSION_INFO_TOOL["description"],
            inputSchema=GET_SESSION_INFO_TOOL["inputSchema"],
        ),
        types.Tool(
            name=CLEAR_BUFFER_TOOL["name"],
            description=CLEAR_BUFFER_TOOL["description"],
            inputSchema=CLEAR_BUFFER_TOOL["inputSchema"],
        ),
    ]
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations exist, and the description only says 'get detailed info' without disclosing what fields are returned, whether it reads volatile state, or any side effects. The agent lacks behavioral context.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

A single, concise sentence with no extraneous information. Every word is meaningful.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity (one param, no output schema), the description is adequate but lacks detail on what 'detailed info' includes, leaving some ambiguity for the agent.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100% (session_id with examples). The tool description adds no extra meaning beyond the schema, so a baseline of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'get' and the resource 'detailed information of terminal session', distinguishing it from siblings like list_sessions (list) and close_session (close).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool versus alternatives like list_sessions or get_status. Usage is implied but not explicitly clarified.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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