Skip to main content
Glama
lkm1developer

HubSpot MCP Server

hubspot_create_company

Create a new company record in HubSpot CRM by specifying the company name and optional additional properties to organize business data.

Instructions

Create a new company in HubSpot

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesCompany name
propertiesNoAdditional company properties

Implementation Reference

  • Core handler function that implements the logic to create a new HubSpot company after checking for duplicates.
    async createCompany(name: string, properties?: Record<string, any>): Promise<any> {
      try {
        // Search for existing companies with same name
        // Use type assertion to satisfy the HubSpot API client types
        const searchRequest = {
          filterGroups: [{
            filters: [
              {
                propertyName: 'name',
                operator: 'EQ',
                value: name
              } as any
            ]
          }]
        } as any;
        
        const searchResponse = await this.client.crm.companies.searchApi.doSearch(searchRequest);
        
        if (searchResponse.total > 0) {
          // Company already exists
          return { 
            message: 'Company already exists', 
            company: searchResponse.results[0] 
          };
        }
        
        // If no existing company found, proceed with creation
        const companyProperties: Record<string, any> = {
          name
        };
        
        // Add any additional properties
        if (properties) {
          Object.assign(companyProperties, properties);
        }
        
        // Create company
        const apiResponse = await this.client.crm.companies.basicApi.create({
          properties: companyProperties
        });
        
        return apiResponse;
      } catch (error: any) {
        console.error('Error creating company:', error);
        throw new Error(`HubSpot API error: ${error.message}`);
      }
    }
  • src/index.ts:107-124 (registration)
    Tool registration in the MCP server, defining name, description, and input schema.
      name: 'hubspot_create_company',
      description: 'Create a new company in HubSpot',
      inputSchema: {
        type: 'object',
        properties: {
          name: { 
            type: 'string', 
            description: 'Company name' 
          },
          properties: { 
            type: 'object', 
            description: 'Additional company properties',
            additionalProperties: true
          }
        },
        required: ['name']
      }
    },
  • MCP tool call handler that dispatches to HubSpotClient.createCompany and formats the response.
    case 'hubspot_create_company': {
      const result = await this.hubspot.createCompany(
        args.name as string,
        args.properties as Record<string, any> | undefined
      );
      return {
        content: [{
          type: 'text',
          text: JSON.stringify(result, null, 2)
        }]
      };
    }
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 company but lacks critical details: it doesn't specify required permissions, whether the operation is idempotent, potential side effects (e.g., triggering workflows), or error handling. This is inadequate for a mutation tool with zero annotation coverage.

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, efficient sentence with zero wasted words. It's front-loaded with the core action and resource, making it easy to parse quickly.

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 mutation tool with no annotations and no output schema, the description is incomplete. It doesn't explain what happens on success (e.g., returns a company ID) or failure, nor does it cover behavioral aspects like authentication needs or rate limits, leaving significant gaps for the agent.

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 both parameters (name and properties). The description adds no additional parameter semantics beyond what the schema provides, such as examples or constraints. Baseline 3 is appropriate since the 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 action ('Create') and resource ('new company in HubSpot'), making the purpose immediately understandable. It distinguishes from siblings like hubspot_update_company (update vs. create) and hubspot_get_active_companies (get vs. create), though it doesn't explicitly mention these distinctions.

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 doesn't mention prerequisites (e.g., authentication), when not to use it, or compare it to siblings like hubspot_update_company for existing companies, leaving the agent to infer usage context.

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