Skip to main content
Glama
Cyreslab-AI

Have I Been Pwned MCP Server

check_email

Verify if an email address has been exposed in data breaches using the Have I Been Pwned API. Includes options to check unverified breaches and truncate response data for streamlined results.

Instructions

Check if an email address has been found in data breaches

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
emailYesEmail address to check
include_unverifiedNoInclude unverified breaches in the results
truncate_responseNoTruncate the response to only include breach names

Implementation Reference

  • The primary handler function that executes the check_email tool logic, querying the HIBP API for breached accounts associated with the given email and formatting the response.
    private async handleCheckEmail(args: any) {
      if (!args.email || typeof args.email !== "string") {
        throw new McpError(
          ErrorCode.InvalidParams,
          "Email address is required"
        );
      }
    
      const params: Record<string, any> = {};
    
      if (args.include_unverified !== undefined) {
        params.includeUnverified = args.include_unverified;
      }
    
      if (args.truncate_response !== undefined) {
        params.truncateResponse = args.truncate_response;
      }
    
      const response = await this.axiosInstance.get(`/breachedaccount/${encodeURIComponent(args.email)}`, { params });
    
      if (!response.data || response.data.length === 0) {
        return {
          content: [
            {
              type: "text",
              text: "Good news! This email address has not been found in any known data breaches.",
            },
          ],
        };
      }
    
      // Format the breach data for better readability
      const breaches = response.data;
      const breachCount = breaches.length;
    
      let summary = `⚠️ This email address was found in ${breachCount} data breach${breachCount > 1 ? 'es' : ''}.\n\n`;
    
      if (args.truncate_response) {
        // If truncated, just list the breach names
        summary += "Breaches: " + breaches.map((breach: any) => breach.Name).join(", ");
      } else {
        // Otherwise, provide detailed information
        summary += "Breach details:\n\n";
    
        breaches.forEach((breach: any, index: number) => {
          summary += `${index + 1}. ${breach.Name} (${breach.BreachDate})\n`;
          summary += `   Domain: ${breach.Domain}\n`;
          summary += `   Description: ${breach.Description}\n`;
          summary += `   Compromised data: ${breach.DataClasses.join(", ")}\n`;
    
          if (index < breaches.length - 1) {
            summary += "\n";
          }
        });
    
        summary += "\nRecommendations:\n";
        summary += "- Change your password for these services immediately\n";
        summary += "- If you used the same password elsewhere, change those too\n";
        summary += "- Enable two-factor authentication where available\n";
        summary += "- Consider using a password manager";
      }
    
      return {
        content: [
          {
            type: "text",
            text: summary,
          },
        ],
      };
    }
  • Input schema defining the parameters for the check_email tool, including email (required), include_unverified, and truncate_response options.
    inputSchema: {
      type: "object",
      properties: {
        email: {
          type: "string",
          description: "Email address to check",
        },
        include_unverified: {
          type: "boolean",
          description: "Include unverified breaches in the results",
          default: true,
        },
        truncate_response: {
          type: "boolean",
          description: "Truncate the response to only include breach names",
          default: false,
        },
      },
      required: ["email"],
    },
  • src/index.ts:80-103 (registration)
    Registration of the check_email tool in the list of available tools returned by ListToolsRequestSchema.
    {
      name: "check_email",
      description: "Check if an email address has been found in data breaches",
      inputSchema: {
        type: "object",
        properties: {
          email: {
            type: "string",
            description: "Email address to check",
          },
          include_unverified: {
            type: "boolean",
            description: "Include unverified breaches in the results",
            default: true,
          },
          truncate_response: {
            type: "boolean",
            description: "Truncate the response to only include breach names",
            default: false,
          },
        },
        required: ["email"],
      },
    },
  • Dispatch in the CallToolRequestSchema handler that routes check_email calls to the handleCheckEmail function.
    case "check_email":
      return await this.handleCheckEmail(request.params.arguments);
  • Special error handling for 404 responses specific to check_email, treating it as a successful 'no breaches found' result.
    if (error.response?.status === 404 && request.params.name === "check_email") {
      return {
        content: [
          {
            type: "text",
            text: "Good news! This email address has not been found in any known data breaches.",
          },
        ],
      };
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool's function but lacks details on permissions, rate limits, data sources, or response format. While it implies a read-only operation, it does not explicitly confirm safety or describe potential errors or limitations.

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, clear sentence with zero wasted words. It is front-loaded with the core purpose and efficiently communicates the tool's function without unnecessary elaboration.

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 moderate complexity (3 parameters, no output schema, no annotations), the description is minimally adequate. It covers the basic purpose but lacks behavioral context and usage guidelines, leaving gaps in understanding how to effectively invoke the tool or interpret 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 fully documents all parameters. The description does not add any meaning beyond what the schema provides, such as explaining the implications of 'include_unverified' or 'truncate_response' in practical terms. Baseline 3 is appropriate as the schema handles parameter documentation.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('check') and resource ('email address') with the explicit purpose of determining if it 'has been found in data breaches.' It distinguishes itself from siblings like check_password (different resource) and get_breach_details/list_all_breaches (different scope).

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 does not mention sibling tools like check_password for password checks or get_breach_details for detailed breach information, leaving the agent to infer usage context without explicit direction.

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

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/Cyreslab-AI/hibp-mcp-server'

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