Skip to main content
Glama

search_linkedin_users

Find LinkedIn users by applying filters such as name, job title, company, location, industry, education, and keywords to identify relevant professionals.

Instructions

Search for LinkedIn users with various filters like keywords, name, title, company, location etc.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
company_keywordsNoExact word in the company name
countYesMaximum number of results (max 1000)
current_companyNoCompany URN or name
educationNoEducation URN or name
first_nameNoExact first name
industryNoIndustry URN or name
keywordsNoAny keyword for searching in the user page.
last_nameNoExact last name
locationNoLocation name or URN
past_companyNoPast company URN or name
school_keywordsNoExact word in the school name
timeoutNoTimeout in seconds (20-1500)
titleNoExact word in the title

Implementation Reference

  • src/index.ts:173-219 (registration)
    Registration of the 'search_linkedin_users' tool using McpServer.tool(), including inline Zod schema and the full handler function that prepares request data and calls the AnySite API via makeRequest.
    // Register search_linkedin_users tool
    server.tool(
      "search_linkedin_users",
      "Search for LinkedIn users with various filters",
      {
        keywords: z.string().optional().describe("Search keywords"),
        first_name: z.string().optional().describe("First name"),
        last_name: z.string().optional().describe("Last name"),
        title: z.string().optional().describe("Job title"),
        company_keywords: z.string().optional().describe("Company keywords"),
        count: z.number().default(10).describe("Max results"),
        timeout: z.number().default(300).describe("Timeout in seconds")
      },
      async ({ keywords, first_name, last_name, title, company_keywords, count, timeout }) => {
        const requestData: any = { timeout, count };
        if (keywords) requestData.keywords = keywords;
        if (first_name) requestData.first_name = first_name;
        if (last_name) requestData.last_name = last_name;
        if (title) requestData.title = title;
        if (company_keywords) requestData.company_keywords = company_keywords;
    
        log("Starting LinkedIn users search with:", JSON.stringify(requestData));
        try {
          const response = await makeRequest(API_CONFIG.ENDPOINTS.SEARCH_USERS, requestData);
          log(`Search complete, found ${response.length} results`);
          return {
            content: [
              {
                type: "text",
                text: JSON.stringify(response, null, 2)
              }
            ]
          };
        } catch (error) {
          log("LinkedIn search error:", error);
          return {
            content: [
              {
                type: "text",
                text: `LinkedIn search API error: ${formatError(error)}`
              }
            ],
            isError: true
          };
        }
      }
    );
  • Handler function that constructs the API request payload from input parameters, calls makeRequest to the /api/linkedin/search/users endpoint, and returns the JSON response or error.
    async ({ keywords, first_name, last_name, title, company_keywords, count, timeout }) => {
      const requestData: any = { timeout, count };
      if (keywords) requestData.keywords = keywords;
      if (first_name) requestData.first_name = first_name;
      if (last_name) requestData.last_name = last_name;
      if (title) requestData.title = title;
      if (company_keywords) requestData.company_keywords = company_keywords;
    
      log("Starting LinkedIn users search with:", JSON.stringify(requestData));
      try {
        const response = await makeRequest(API_CONFIG.ENDPOINTS.SEARCH_USERS, requestData);
        log(`Search complete, found ${response.length} results`);
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(response, null, 2)
            }
          ]
        };
      } catch (error) {
        log("LinkedIn search error:", error);
        return {
          content: [
            {
              type: "text",
              text: `LinkedIn search API error: ${formatError(error)}`
            }
          ],
          isError: true
        };
      }
  • Zod input schema defining optional search parameters like keywords, names, title, company_keywords, with defaults for count and timeout.
    {
      keywords: z.string().optional().describe("Search keywords"),
      first_name: z.string().optional().describe("First name"),
      last_name: z.string().optional().describe("Last name"),
      title: z.string().optional().describe("Job title"),
      company_keywords: z.string().optional().describe("Company keywords"),
      count: z.number().default(10).describe("Max results"),
      timeout: z.number().default(300).describe("Timeout in seconds")
  • API endpoint constant used by the handler: '/api/linkedin/search/users'
    SEARCH_USERS: "/api/linkedin/search/users",
  • makeRequest helper function used by the handler to perform HTTPS POST requests to the AnySite API with authentication.
    const makeRequest = (endpoint: string, data: any, method: string = "POST"): Promise<any> => {
      return new Promise((resolve, reject) => {
        const url = new URL(endpoint, API_CONFIG.BASE_URL);
        const postData = JSON.stringify(data);
    
        const options = {
          hostname: url.hostname,
          port: url.port || 443,
          path: url.pathname,
          method: method,
          headers: {
            "Content-Type": "application/json",
            "Content-Length": Buffer.byteLength(postData),
            "access-token": API_KEY,
            ...(ACCOUNT_ID && { "x-account-id": ACCOUNT_ID })
          }
        };
    
        const req = https.request(options, (res) => {
          let responseData = "";
          res.on("data", (chunk) => {
            responseData += chunk;
          });
    
          res.on("end", () => {
            try {
              const parsed = JSON.parse(responseData);
              if (res.statusCode && res.statusCode >= 200 && res.statusCode < 300) {
                resolve(parsed);
              } else {
                reject(new Error(`API error ${res.statusCode}: ${JSON.stringify(parsed)}`));
              }
            } catch (e) {
              reject(new Error(`Failed to parse response: ${responseData}`));
            }
          });
        });
    
        req.on("error", (error) => {
          reject(error);
        });
    
        req.write(postData);
        req.end();
      });
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions 'various filters' but doesn't describe important behavioral aspects: whether this is a read-only operation, what permissions are required, rate limits, pagination behavior, or what the return format looks like. For a search tool with 13 parameters, this is insufficient behavioral context.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that gets straight to the point. It's appropriately sized for a search tool, though it could potentially be more front-loaded with critical information about the tool's scope and limitations.

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

Completeness2/5

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

For a complex search tool with 13 parameters and no output schema, the description is incomplete. It doesn't explain what results look like, how filters interact, whether all filters are optional, or any limitations beyond what's implied. With no annotations and no output schema, users need more context about the tool's behavior and results.

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

Parameters3/5

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

Schema description coverage is 100%, so the schema already documents all 13 parameters thoroughly. The description adds minimal value beyond the schema by listing some filter types ('keywords, name, title, company, location etc.'), but doesn't provide additional semantic context about how filters combine or their relative importance. Baseline 3 is appropriate when schema does the heavy lifting.

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 tool's purpose: 'Search for LinkedIn users with various filters'. It specifies the resource (LinkedIn users) and action (search with filters). However, it doesn't explicitly differentiate from sibling tools like 'linkedin_sn_search_users' or 'get_linkedin_company_employees', which may have overlapping functionality.

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. With multiple LinkedIn-related search tools in the sibling list (like 'linkedin_sn_search_users', 'search_linkedin_posts', 'get_linkedin_company_employees'), there's no indication of when this specific user search tool is appropriate versus other search or retrieval tools.

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/anysiteio/hdw-mcp-server'

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