Skip to main content
Glama

Close Session

close_session

Terminate the active LinkedIn browser session and release 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 execution logic for the close_session tool. It imports and calls close_all_drivers to terminate browser sessions and returns a success or error status.
    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)}",
            }
  • Registers the close_session tool on the MCP server using the @mcp.tool decorator with appropriate annotations.
    @mcp.tool(
        annotations=ToolAnnotations(
            title="Close Session",
            readOnlyHint=False,
            destructiveHint=False,
            openWorldHint=False,
        )
    )
  • Helper function that closes all active Chrome WebDriver instances by iterating over the global active_drivers dictionary and calling quit() on each.
    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?

Annotations indicate this is not read-only, not open-world, and not destructive, but the description adds context by specifying 'clean up resources,' which implies cleanup behavior beyond the annotations. However, it lacks details on what resources are cleaned, side effects, or response format, leaving gaps in behavioral understanding.

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 directly states the tool's purpose and additional effect ('clean up resources'). It is front-loaded with the core action and wastes no words, making it highly concise and well-structured.

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 (0 parameters, no complex annotations, and an output schema exists), the description is minimally adequate. It covers the basic action but lacks details on usage context, behavioral specifics, or integration with siblings, leaving room for improvement in completeness.

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 schema fully documents the absence of inputs. The description doesn't need to add parameter details, so it appropriately focuses on the tool's action without redundancy, earning a baseline score for zero-parameter tools.

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 ('the current browser session'), and mentions resource cleanup as an additional effect. However, it doesn't differentiate from sibling tools, which are all read-only data retrieval operations, making the distinction obvious but not explicit in the description itself.

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?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., after completing tasks), exclusions (e.g., not for data retrieval), or relate to sibling tools like 'get_company_profile' or 'search_jobs', which serve entirely different purposes.

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/stickerdaniel/linkedin-mcp-server'

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