Skip to main content
Glama

hubspot_create_company

Create a new company record in HubSpot CRM to organize business contacts and track interactions.

Instructions

Create a new company in HubSpot

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesCompany name
propertiesNoAdditional company properties

Implementation Reference

  • MCP CallToolRequest handler case for 'hubspot_create_company' that extracts arguments and calls HubSpotClient.createCompany
    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) }] }; }
  • Input schema definition for the hubspot_create_company tool, registered in ListTools response
    { 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'] }
  • HubSpotClient.createCompany method implementing the core logic: checks for duplicates by name, creates company via HubSpot CRM API if new, with optional additional properties
    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}`); }

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