Skip to main content
Glama

hubspot_update_contact

Update existing HubSpot contact information by specifying contact ID and properties to modify. Maintains current data if contact does not exist.

Instructions

Update an existing contact in HubSpot (ignores if contact does not exist)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contact_idYesHubSpot contact ID to update
propertiesYesContact properties to update

Implementation Reference

  • The primary handler function that executes the tool logic: checks if the contact exists using getById, then updates the properties via HubSpot CRM contacts.basicApi.update. Returns success message or handles not found gracefully.
    async updateContact( contactId: string, properties: Record<string, any> ): Promise<any> { try { // Check if contact exists try { await this.client.crm.contacts.basicApi.getById(contactId); } catch (error: any) { // If contact doesn't exist, return a message if (error.statusCode === 404) { return { message: 'Contact not found, no update performed', contactId }; } // For other errors, throw them to be caught by the outer try/catch throw error; } // Update the contact const apiResponse = await this.client.crm.contacts.basicApi.update(contactId, { properties }); return { message: 'Contact updated successfully', contactId, properties }; } catch (error: any) { console.error('Error updating contact:', error); throw new Error(`HubSpot API error: ${error.message}`); } }
  • src/index.ts:186-204 (registration)
    Tool registration in the ListToolsRequestHandler, defining name, description, and input schema.
    { name: 'hubspot_update_contact', description: 'Update an existing contact in HubSpot (ignores if contact does not exist)', inputSchema: { type: 'object', properties: { contact_id: { type: 'string', description: 'HubSpot contact ID to update' }, properties: { type: 'object', description: 'Contact properties to update', additionalProperties: true } }, required: ['contact_id', 'properties'] } },
  • Input schema defining required contact_id and arbitrary properties object for the tool.
    inputSchema: { type: 'object', properties: { contact_id: { type: 'string', description: 'HubSpot contact ID to update' }, properties: { type: 'object', description: 'Contact properties to update', additionalProperties: true } }, required: ['contact_id', 'properties']
  • MCP server handler dispatcher in CallToolRequestHandler that invokes the HubSpotClient updateContact method and formats the response.
    case 'hubspot_update_contact': { const result = await this.hubspot.updateContact( args.contact_id as string, args.properties as Record<string, any> ); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] }; }

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