Skip to main content
Glama
ajaystream

HubSpot MCP Server

by ajaystream

hubspot-list-associations

Read-only

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());
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnlyHint=true, destructiveHint=false, and openWorldHint=true, covering safety and scope. The description adds valuable behavioral context beyond annotations: it explains the return format ('Collection of associated object IDs and relationship metadata'), suggests a follow-up action ('Use hubspot-batch-read-objects to get more information'), and clarifies the tool's focus on existing relationships rather than property-based filtering. No contradictions with annotations exist.

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 well-structured with clear sections (Purpose, Returns, Usage Guidance), uses bullet points for readability, and every sentence adds value without redundancy. It's appropriately sized for the tool's complexity and front-loads key information efficiently.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity, rich annotations (covering read-only, non-destructive, open-world behavior), and 100% schema coverage, the description is complete. It explains the tool's purpose, usage context, return format, and integration with other tools (hubspot-batch-read-objects), addressing all necessary aspects without needing an output schema.

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?

Schema description coverage is 100%, so the schema fully documents all parameters. The description doesn't add specific parameter details beyond what the schema provides, such as explaining the relationship between objectType and toObjectType or clarifying the 'after' parameter's pagination role. However, it implies the tool's purpose involves these parameters through examples, meeting the baseline for high schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description explicitly states the tool's purpose with specific verbs ('retrieves existing relationships') and resources ('between a specific object and other objects of a particular type'), and provides concrete examples (e.g., 'all companies that a contact is associated with'). It clearly distinguishes this tool's relationship-mapping function from other tools in the sibling list.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit guidance on when to use this tool ('when mapping relationships,' 'when you already know a specific record's ID'), when not to use it ('Prefer this over hubspot-search-objects tool when exploring established connections rather than filtering by properties or criteria'), and names a specific alternative tool (hubspot-search-objects). This gives clear context for tool selection.

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

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