Skip to main content
Glama
lkm1developer

HubSpot MCP Server

hubspot_create_contact

Add new contacts to HubSpot CRM by providing essential details like name and email, enabling organized customer relationship management.

Instructions

Create a new contact in HubSpot

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
firstnameYesContact's first name
lastnameYesContact's last name
emailNoContact's email address
propertiesNoAdditional contact properties

Implementation Reference

  • MCP CallToolRequestSchema handler switch case that extracts arguments and delegates to HubSpotClient.createContact, returning the result as JSON text content.
    case 'hubspot_create_contact': {
      const result = await this.hubspot.createContact(
        args.firstname as string,
        args.lastname as string,
        args.email as string | undefined,
        args.properties as Record<string, any> | undefined
      );
      return {
        content: [{
          type: 'text',
          text: JSON.stringify(result, null, 2)
        }]
      };
    }
  • src/index.ts:79-105 (registration)
    Tool registration definition returned by ListToolsRequestSchema handler, including name, description, and input schema.
    {
      name: 'hubspot_create_contact',
      description: 'Create a new contact in HubSpot',
      inputSchema: {
        type: 'object',
        properties: {
          firstname: { 
            type: 'string', 
            description: "Contact's first name" 
          },
          lastname: { 
            type: 'string', 
            description: "Contact's last name" 
          },
          email: { 
            type: 'string', 
            description: "Contact's email address" 
          },
          properties: { 
            type: 'object', 
            description: 'Additional contact properties',
            additionalProperties: true
          }
        },
        required: ['firstname', 'lastname']
      }
    },
  • HubSpotClient.createContact method: searches for existing contact by firstname/lastname (and optional company), creates new contact if not exists, adds email and custom properties, uses HubSpot CRM API.
    async createContact(
      firstname: string, 
      lastname: string, 
      email?: string, 
      properties?: Record<string, any>
    ): Promise<any> {
      try {
        // Search for existing contacts with same name and company
        const company = properties?.company;
        
        // Use type assertion to satisfy the HubSpot API client types
        const searchRequest = {
          filterGroups: [{
            filters: [
              {
                propertyName: 'firstname',
                operator: 'EQ',
                value: firstname
              } as any,
              {
                propertyName: 'lastname',
                operator: 'EQ',
                value: lastname
              } as any
            ]
          }]
        } as any;
        
        // Add company filter if provided
        if (company) {
          searchRequest.filterGroups[0].filters.push({
            propertyName: 'company',
            operator: 'EQ',
            value: company
          } as any);
        }
        
        const searchResponse = await this.client.crm.contacts.searchApi.doSearch(searchRequest);
        
        if (searchResponse.total > 0) {
          // Contact already exists
          return { 
            message: 'Contact already exists', 
            contact: searchResponse.results[0] 
          };
        }
        
        // If no existing contact found, proceed with creation
        const contactProperties: Record<string, any> = {
          firstname,
          lastname
        };
        
        // Add email if provided
        if (email) {
          contactProperties.email = email;
        }
        
        // Add any additional properties
        if (properties) {
          Object.assign(contactProperties, properties);
        }
        
        // Create contact
        const apiResponse = await this.client.crm.contacts.basicApi.create({
          properties: contactProperties
        });
        
        return apiResponse;
      } catch (error: any) {
        console.error('Error creating contact:', error);
        throw new Error(`HubSpot API error: ${error.message}`);
      }
    }
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 creates a contact, implying a write operation, but doesn't cover critical aspects like required permissions, whether the operation is idempotent, error handling for duplicate emails, or what the response looks like (e.g., success/failure, contact ID). This leaves significant gaps for an agent to use it effectively.

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, direct sentence with no wasted words, making it highly concise and front-loaded. It efficiently communicates the core purpose without unnecessary elaboration, earning a top score for brevity and clarity.

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?

Given the complexity of a write operation with no annotations and no output schema, the description is insufficient. It doesn't explain the behavioral traits (e.g., mutation effects, error cases) or what to expect upon success, leaving the agent without key context needed for reliable tool invocation in a HubSpot environment.

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?

The input schema has 100% description coverage, clearly documenting all four parameters (firstname, lastname, email, properties) with their types and purposes. The description adds no additional parameter information beyond what's in the schema, so it meets the baseline of 3 for adequate coverage without extra value.

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 action ('Create') and resource ('new contact in HubSpot'), making the purpose immediately understandable. However, it doesn't differentiate this tool from its sibling 'hubspot_update_contact' beyond the creation vs. update distinction, which is implicit but not explicit.

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 like 'hubspot_update_contact' for existing contacts or 'hubspot_get_active_contacts' for retrieval. It also doesn't mention prerequisites, such as needing HubSpot access or when creation is appropriate versus other operations.

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

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