Skip to main content
Glama

get_company_profile

Retrieve structured LinkedIn company profile data including optional employee information by providing a company name.

Instructions

Get a specific company's LinkedIn profile.

Args: company_name (str): LinkedIn company name (e.g., "docker", "anthropic", "microsoft") get_employees (bool): Whether to scrape the company's employees (slower)

Returns: Dict[str, Any]: Structured data from the company's profile

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
company_nameYes
get_employeesNo

Implementation Reference

  • Core handler function for the 'get_company_profile' tool. Uses linkedin_scraper.Company to fetch company profile data from LinkedIn, structures it into a dictionary, optionally includes employee data, with comprehensive error handling.
    @mcp.tool() async def get_company_profile( company_name: str, get_employees: bool = False ) -> Dict[str, Any]: """ Get a specific company's LinkedIn profile. Args: company_name (str): LinkedIn company name (e.g., "docker", "anthropic", "microsoft") get_employees (bool): Whether to scrape the company's employees (slower) Returns: Dict[str, Any]: Structured data from the company's profile """ try: # Construct clean LinkedIn URL from company name linkedin_url = f"https://www.linkedin.com/company/{company_name}/" driver = safe_get_driver() logger.info(f"Scraping company: {linkedin_url}") if get_employees: logger.info("Fetching employees may take a while...") company = Company( linkedin_url, driver=driver, get_employees=get_employees, close_on_complete=False, ) # Convert showcase pages to structured dictionaries showcase_pages: List[Dict[str, Any]] = [ { "name": page.name, "linkedin_url": page.linkedin_url, "followers": page.followers, } for page in company.showcase_pages ] # Convert affiliated companies to structured dictionaries affiliated_companies: List[Dict[str, Any]] = [ { "name": affiliated.name, "linkedin_url": affiliated.linkedin_url, "followers": affiliated.followers, } for affiliated in company.affiliated_companies ] # Build the result dictionary result: Dict[str, Any] = { "name": company.name, "about_us": company.about_us, "website": company.website, "phone": company.phone, "headquarters": company.headquarters, "founded": company.founded, "industry": company.industry, "company_type": company.company_type, "company_size": company.company_size, "specialties": company.specialties, "showcase_pages": showcase_pages, "affiliated_companies": affiliated_companies, "headcount": company.headcount, } # Add employees if requested and available if get_employees and company.employees: result["employees"] = company.employees return result except Exception as e: return handle_tool_error(e, "get_company_profile")
  • Registration function that defines and registers the get_company_profile tool using the @mcp.tool() decorator on the MCP server instance.
    def register_company_tools(mcp: FastMCP) -> None: """ Register all company-related tools with the MCP server. Args: mcp (FastMCP): The MCP server instance """ @mcp.tool() async def get_company_profile( company_name: str, get_employees: bool = False ) -> Dict[str, Any]: """ Get a specific company's LinkedIn profile. Args: company_name (str): LinkedIn company name (e.g., "docker", "anthropic", "microsoft") get_employees (bool): Whether to scrape the company's employees (slower) Returns: Dict[str, Any]: Structured data from the company's profile """ try: # Construct clean LinkedIn URL from company name linkedin_url = f"https://www.linkedin.com/company/{company_name}/" driver = safe_get_driver() logger.info(f"Scraping company: {linkedin_url}") if get_employees: logger.info("Fetching employees may take a while...") company = Company( linkedin_url, driver=driver, get_employees=get_employees, close_on_complete=False, ) # Convert showcase pages to structured dictionaries showcase_pages: List[Dict[str, Any]] = [ { "name": page.name, "linkedin_url": page.linkedin_url, "followers": page.followers, } for page in company.showcase_pages ] # Convert affiliated companies to structured dictionaries affiliated_companies: List[Dict[str, Any]] = [ { "name": affiliated.name, "linkedin_url": affiliated.linkedin_url, "followers": affiliated.followers, } for affiliated in company.affiliated_companies ] # Build the result dictionary result: Dict[str, Any] = { "name": company.name, "about_us": company.about_us, "website": company.website, "phone": company.phone, "headquarters": company.headquarters, "founded": company.founded, "industry": company.industry, "company_type": company.company_type, "company_size": company.company_size, "specialties": company.specialties, "showcase_pages": showcase_pages, "affiliated_companies": affiliated_companies, "headcount": company.headcount, } # Add employees if requested and available if get_employees and company.employees: result["employees"] = company.employees return result except Exception as e: return handle_tool_error(e, "get_company_profile")
  • Invokes the registration of company tools (including get_company_profile) during MCP server creation.
    register_company_tools(mcp)

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