Skip to main content
Glama

close_session

Ends the current LinkedIn browser session and releases system resources to maintain performance and security.

Instructions

Close the current browser session and clean up resources.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main handler function for the 'close_session' tool, decorated with @mcp.tool() for automatic registration. It closes all browser drivers and returns success/error status.
    @mcp.tool() async def close_session() -> Dict[str, Any]: """Close the current browser session and clean up resources.""" from linkedin_mcp_server.drivers.chrome import close_all_drivers try: close_all_drivers() return { "status": "success", "message": "Successfully closed the browser session and cleaned up resources", } except Exception as e: return { "status": "error", "message": f"Error closing browser session: {str(e)}", }
  • Supporting utility function that closes all active Chrome WebDriver instances and clears the session store, called by the close_session handler.
    def close_all_drivers() -> None: """Close all active drivers and clean up resources.""" global active_drivers for session_id, driver in active_drivers.items(): try: logger.info(f"Closing Chrome WebDriver session: {session_id}") driver.quit() except Exception as e: logger.warning(f"Error closing driver {session_id}: {e}") active_drivers.clear() logger.info("All Chrome WebDriver sessions closed")

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/Kappasig920/MCP-LinkedIn'

If you have feedback or need assistance with the MCP directory API, please join our Discord server