Skip to main content
Glama
francisco-perez-sorrosal

LinkedIn MCP Server

get_url_for_jobs_search

Generate an encoded URL for job searches on LinkedIn, compatible with the platform's API. Input specific job queries to retrieve tailored search links for efficient job hunting.

Instructions

Generates a properly encoded URL that can be used to search for jobs on LinkedIn.
The generated URL is compatible with LinkedIn's job search API.

Args:
    query: The search query string for jobs in LinkedIn.
           
Returns:
    str: A properly encoded URL to search for jobs on LinkedIn.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryNoLooking for Research Enginer/Machine Learning/AI Engineer jobs in San Francisco

Implementation Reference

  • The handler function for the 'get_url_for_jobs_search' tool. It is registered via the @mcp.tool() decorator. Validates the distance parameter and delegates URL composition to the helper function.
    @mcp.tool()
    def get_url_for_jobs_search(location: str = "San Francisco", distance: int = 25, query: str = "AI Research Engineer") -> str:
        """
        Generates a properly encoded URL that can be used to search for jobs on LinkedIn.
        The generated URL is compatible with LinkedIn's job search API.
        
        Args:
            location: The location to search for jobs in LinkedIn (required)
            distance: The distance from the location to search for jobs in LinkedIn (10, 25, 35, 50, 75, 100)
            query: The search query string for jobs in LinkedIn (required)
                   
        Returns:
            str: A properly encoded URL to search for jobs on LinkedIn.
        """
        if not isinstance(distance, int) or distance not in [10, 25, 35, 50, 75, 100]:
            logger.warning(f"Invalid distance {distance}, using default 25")
            distance = 25
            
        logger.info(f"Generating job search URL for location: {location}, distance: {distance}, query: {query}")
        return compose_job_search_url(location, distance, query)
  • Supporting utility function that encodes the parameters and constructs the LinkedIn job search URL. Called by the handler.
    @mcp.resource("linkedinmcpfps://job_search_query/{location}/{distance}/{query}")
    def compose_job_search_url(location: str="San Francisco", distance: int=25, query: str="AI Research Engineer") -> str:
        """
        Composes the URL to search for jobs in LinkedIn with proper URI encoding.
        
        Args:
            location: The location to search for jobs in LinkedIn
            distance: The distance from the location to search for jobs in LinkedIn
            query: The search query string for jobs in LinkedIn
            
        Returns:
            str: Properly encoded URL string with a placeholder for the start index.
        """
        encoded_location = quote_plus(location)
        encoded_distance = quote_plus(str(distance))
        encoded_query = quote_plus(query)
        logger.info(f"Encoded query: {encoded_query}")
        # The double curly braces are escaped to produce a single curly brace for later formatting of the start index
        return f"https://www.linkedin.com/jobs-guest/jobs/api/seeMoreJobPostings/search-results/?location={encoded_location}&distance={encoded_distance}&keywords={encoded_query}"
Install Server

Other Tools

Related 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/francisco-perez-sorrosal/linkedin-mcp'

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