Skip to main content
Glama
ZLeventer

hubspot-mcp

hs_contact_by_email

Look up HubSpot contacts by exact email address and retrieve up to 5 matching records.

Instructions

Look up contacts by exact email address. Returns up to 5 matches.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
emailYesContact's email address

Implementation Reference

  • src/index.ts:96-101 (registration)
    Registers the 'hs_contact_by_email' tool on the MCP server with a description, schema shape, and handler that delegates to contactByEmail.
    server.tool(
      "hs_contact_by_email",
      "Look up contacts by exact email address. Returns up to 5 matches.",
      ContactByEmailSchema.shape,
      async (args) => { try { return ok(await contactByEmail(args)); } catch (e) { return err(e); } },
    );
  • Zod schema for the tool input: an 'email' field validated as a string email.
    export const ContactByEmailSchema = z.object({
      email: z.string().email().describe("Contact's email address"),
    });
  • Handler function that calls the HubSpot API (POST /crm/v3/objects/contacts/search) filtering by exact email match, returning up to 5 results with standard contact properties.
    export async function contactByEmail(args: z.infer<typeof ContactByEmailSchema>) {
      return hubspot("/crm/v3/objects/contacts/search", "POST", {
        filterGroups: [{
          filters: [{ propertyName: "email", operator: "EQ", value: args.email }],
        }],
        properties: CONTACT_PROPS.split(","),
        limit: 5,
      });
    }
  • Defines CONTACT_PROPS - a comma-joined list of standard contact property names used in the search.
    const CONTACT_PROPS = [
      "firstname", "lastname", "email", "phone", "company", "jobtitle",
      "lifecyclestage", "hs_lead_status", "createdate", "lastmodifieddate",
      "hubspot_owner_id", "hs_analytics_source",
    ].join(",");
  • Generic hubspot API client function that makes authenticated requests to the HubSpot REST API.
    export async function hubspot<T = unknown>(
      path: string,
      method: "GET" | "POST" | "PATCH" | "DELETE" = "GET",
      body?: unknown,
      params?: Record<string, string | number | boolean>,
    ): Promise<T> {
      const token = getToken();
    
      let url = `${BASE_URL}${path}`;
      if (params && method === "GET") {
        const qs = new URLSearchParams(
          Object.entries(params).map(([k, v]) => [k, String(v)]),
        ).toString();
        if (qs) url += `?${qs}`;
      }
    
      const res = await fetch(url, {
        method,
        headers: {
          Authorization: `Bearer ${token}`,
          "Content-Type": "application/json",
        },
        ...(body && method !== "GET" ? { body: JSON.stringify(body) } : {}),
      });
    
      if (!res.ok) {
        const text = await res.text().catch(() => res.statusText);
        throw new HubSpotError(`HubSpot API error (${res.status}): ${text}`, res.status);
      }
    
      if (res.status === 204) return undefined as T;
      return (await res.json()) as T;
    }
Behavior3/5

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

No annotations provided, so the description carries the burden. It discloses a return limit of 5 matches, but lacks info on authentication, rate limits, or behavior when no match found.

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?

Two sentences, immediate verb, no filler. Every sentence adds value.

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

Completeness4/5

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

For a simple lookup with one parameter and no output schema, the description adequately covers purpose and return limit. It could mention response structure but is complete enough.

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

Parameters4/5

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

Schema coverage is 100% with the parameter description. The description adds 'exact' and 'up to 5 matches', providing useful behavioral context beyond the schema.

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 states 'Look up contacts by exact email address' with a specific verb and resource, and distinguishes from sibling tools like hs_get_contact (by ID) and hs_search_contacts (fuzzy search) by emphasizing exact match.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies use when you have an exact email, but it does not explicitly state when not to use or compare to alternatives like hs_search_contacts or hs_recent_contacts.

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/ZLeventer/hubspot-mcp'

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