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

Output 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")
Behavior3/5

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

With no annotations provided, the description carries full burden. It discloses the tool's destructive nature ('close' and 'clean up') which is helpful, but lacks details about what exactly gets destroyed, whether this action is reversible, authentication requirements, or error conditions. The description doesn't contradict any annotations.

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?

The description is a single, efficient sentence that states the core action first ('close the current browser session') followed by the secondary effect ('clean up resources'). Every word serves a purpose with zero redundancy or unnecessary elaboration.

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

Completeness4/5

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

Given this is a destructive operation with no annotations but an output schema exists, the description provides adequate context about what the tool does. It covers the main action and cleanup effect, though more behavioral details would be helpful. The existence of an output schema means return values are documented elsewhere.

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

Parameters4/5

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

With 0 parameters and 100% schema description coverage, the baseline is 4. The description appropriately doesn't discuss parameters since none exist, and the schema already fully documents this. No additional parameter information is needed or provided.

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

Purpose4/5

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

The description clearly states the action ('close') and target ('current browser session'), and mentions the additional effect of 'clean up resources'. It distinguishes from sibling tools which are all data retrieval operations. However, it doesn't specify what type of browser session or what resources are being cleaned up.

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

Usage Guidelines3/5

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

The description implies usage context through 'current browser session', suggesting this should be used when a session is active and needs termination. However, it provides no explicit guidance about when to use this tool versus alternatives (none exist among siblings) or prerequisites for successful execution.

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/Logos-Parthenos-AI/linkedin-mcp-server'

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