Skip to main content
Glama

hubspot-list-associations

Retrieve relationships between HubSpot objects to map data connections. Find associated records like companies linked to contacts or deals related to companies using object IDs.

Instructions

🎯 Purpose: 1. Retrieves existing relationships between a specific object and other objects of a particular type. 2. For example, you can find all companies that a contact is associated with, all deals related to a company, or discover which customers have an open ticket. 📦 Returns: 1. Collection of associated object IDs and relationship metadata. 2. Use hubspot-batch-read-objects to get more information about the associated objects. 🧭 Usage Guidance: 1. Use this tool when mapping relationships between different HubSpot objects to understand your data's connections. 2. This tool is ideal when you already know a specific record's ID and need to discover its relationships with other object types. 3. Prefer this over hubspot-search-objects tool when exploring established connections rather than filtering by properties or criteria.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
objectTypeYesThe type of HubSpot object to get associations from. Valid values include: appointments, companies, contacts, courses, deals, leads, line_items, listings, marketing_events, meetings, orders, postal_mail, products, quotes, services, subscriptions, tickets, users. For custom objects, use the hubspot-get-schemas tool to get the objectType.
objectIdYesThe ID of the HubSpot object to get associations from
toObjectTypeYesThe type of HubSpot object to get associations to. Valid values include: appointments, companies, contacts, courses, deals, leads, line_items, listings, marketing_events, meetings, orders, postal_mail, products, quotes, services, subscriptions, tickets, users. For custom objects, use the hubspot-get-schemas tool to get the objectType.
afterNoPaging cursor token for retrieving the next page of results

Implementation Reference

  • The `process` method of `AssociationsListTool` that implements the core logic: builds the HubSpot CRM v4 API endpoint for associations and retrieves the results with pagination support.
    async process(args) { try { // Build the API path let endpoint = `/crm/v4/objects/${args.objectType}/${args.objectId}/associations/${args.toObjectType}?limit=500`; // Add pagination parameter if provided if (args.after) { endpoint += `&after=${args.after}`; } // Make API request const response = await this.client.get(endpoint); return { content: [ { type: 'text', text: JSON.stringify(response, null, 2), }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Error retrieving HubSpot associations: ${error instanceof Error ? error.message : String(error)}`, }, ], isError: true, }; } }
  • Zod input schema defining parameters: objectType (from), objectId, toObjectType (to), and optional after for pagination.
    const AssociationsListSchema = z.object({ objectType: z .string() .describe(`The type of HubSpot object to get associations from. Valid values include: ${HUBSPOT_OBJECT_TYPES.join(', ')}. For custom objects, use the hubspot-get-schemas tool to get the objectType.`), objectId: z.string().describe('The ID of the HubSpot object to get associations from'), toObjectType: z .string() .describe(`The type of HubSpot object to get associations to. Valid values include: ${HUBSPOT_OBJECT_TYPES.join(', ')}. For custom objects, use the hubspot-get-schemas tool to get the objectType.`), after: z .string() .optional() .describe('Paging cursor token for retrieving the next page of results'), });
  • Instantiation and registration of the `AssociationsListTool` using the `registerTool` function.
    registerTool(new AssociationsListTool());

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

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