Skip to main content
Glama
Meerkats-Ai

Hunter.io MCP Server

by Meerkats-Ai

hunter_email_count

Retrieve the total number of email addresses associated with a specific domain or company using Hunter.io MCP Server. Quickly assess available contact data for outreach or verification purposes.

Instructions

Know how many email addresses we have for a domain or a company.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
companyNoThe company name to get the count for (alternative to domain)
domainNoThe domain name to get the count for, e.g. "stripe.com"

Implementation Reference

  • The handler for the 'hunter_email_count' tool. Validates input parameters using isEmailCountParams, calls the Hunter.io /email-count API endpoint with retry logic via withRetry, and returns the response or error.
    case 'hunter_email_count': {
      if (!isEmailCountParams(args)) {
        throw new McpError(
          ErrorCode.InvalidParams,
          'Invalid arguments for hunter_email_count'
        );
      }
    
      try {
        // Hunter.io API expects query parameters for email count
        const response = await withRetry(
          async () => apiClient.get('/email-count', { params: args }),
          'email count'
        );
    
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(response.data, null, 2),
            },
          ],
          isError: false,
        };
      } catch (error) {
        const errorMessage = axios.isAxiosError(error)
          ? `API Error: ${error.response?.data?.message || error.message}`
          : `Error: ${error instanceof Error ? error.message : String(error)}`;
    
        return {
          content: [{ type: 'text', text: errorMessage }],
          isError: true,
        };
      }
    }
  • Tool definition for 'hunter_email_count' including name, description, and input schema (domain or company as optional strings).
    const EMAIL_COUNT_TOOL: Tool = {
      name: 'hunter_email_count',
      description: 'Know how many email addresses we have for a domain or a company.',
      inputSchema: {
        type: 'object',
        properties: {
          domain: {
            type: 'string',
            description: 'The domain name to get the count for, e.g. "stripe.com"',
          },
          company: {
            type: 'string',
            description: 'The company name to get the count for (alternative to domain)',
          }
        },
        required: [],
      },
    };
  • src/index.ts:424-432 (registration)
    Registers the 'hunter_email_count' tool (via EMAIL_COUNT_TOOL) in the ListToolsRequest handler response.
      tools: [
        FIND_EMAIL_TOOL,
        VERIFY_EMAIL_TOOL,
        DOMAIN_SEARCH_TOOL,
        EMAIL_COUNT_TOOL,
        ACCOUNT_INFO_TOOL,
      ],
    }));
  • Type guard function that validates the input arguments for the 'hunter_email_count' tool, ensuring it's an object with at least one of 'domain' or 'company' as strings.
    function isEmailCountParams(args: unknown): args is EmailCountParams {
      if (
        typeof args !== 'object' ||
        args === null
      ) {
        return false;
      }
    
      // At least one of domain or company must be provided
      if (
        !('domain' in args || 'company' in args)
      ) {
        return false;
      }
    
      // Check domain if provided
      if (
        'domain' in args &&
        (args as { domain: unknown }).domain !== undefined &&
        typeof (args as { domain: unknown }).domain !== 'string'
      ) {
        return false;
      }
    
      // Check company if provided
      if (
        'company' in args &&
        (args as { company: unknown }).company !== undefined &&
        typeof (args as { company: unknown }).company !== 'string'
      ) {
        return false;
      }
    
      return true;
    }
  • TypeScript interface defining the parameter shape for 'hunter_email_count' tool.
    interface EmailCountParams {
      domain?: string;
      company?: string;
    }
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/Meerkats-Ai/hunter-io-mcp-server'

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