Skip to main content
Glama
ajaystream

HubSpot MCP Server

by ajaystream

hubspot-get-association-definitions

Read-onlyIdempotent

Retrieve valid association types between HubSpot objects to ensure proper relationship creation and troubleshoot errors.

Instructions

🎯 Purpose:
  1. Retrieves valid association types between specific HubSpot object types.

📦 Returns:
  1. Array of valid association definitions with type IDs, labels, and categories.

🧭 Usage Guidance:
  1. Always use before creating associations to ensure valid relationship types or to help troubleshoot association creation errors.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fromObjectTypeYesThe type of HubSpot object to get association 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.
toObjectTypeYesThe type of HubSpot object to get association 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.

Implementation Reference

  • The main handler function that processes the tool input by calling the HubSpot CRM v4 API endpoint to retrieve association labels/definitions between the specified fromObjectType and toObjectType.
    async process(args) {
        try {
            const response = await this.client.get(`/crm/v4/associations/${args.fromObjectType}/${args.toObjectType}/labels`);
            return {
                content: [
                    {
                        type: 'text',
                        text: JSON.stringify(response, null, 2),
                    },
                ],
            };
        }
        catch (error) {
            return {
                content: [
                    {
                        type: 'text',
                        text: `Error retrieving HubSpot association schema definitions: ${error instanceof Error ? error.message : String(error)}`,
                    },
                ],
                isError: true,
            };
        }
    }
  • Zod schema defining the input parameters for the tool: fromObjectType and toObjectType, with descriptions referencing valid HubSpot object types.
    const AssociationSchemaDefinitionSchema = z.object({
        fromObjectType: z
            .string()
            .describe(`The type of HubSpot object to get association from. Valid values include: ${HUBSPOT_OBJECT_TYPES.join(', ')}. For custom objects, use the hubspot-get-schemas tool to get the objectType.`),
        toObjectType: z
            .string()
            .describe(`The type of HubSpot object to get association to. Valid values include: ${HUBSPOT_OBJECT_TYPES.join(', ')}. For custom objects, use the hubspot-get-schemas tool to get the objectType.`),
    });
  • Import statement for the AssociationSchemaDefinitionTool class.
    import { AssociationSchemaDefinitionTool } from './associations/getAssociationDefinitionsTool.js';
  • Instantiation and registration of the AssociationSchemaDefinitionTool using the registerTool function.
    registerTool(new AssociationSchemaDefinitionTool());
Behavior4/5

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

Annotations already indicate this is a read-only, non-destructive, idempotent operation with open-world data, so the description doesn't need to repeat those safety aspects. However, it adds valuable context about the tool's role in validation workflows ('to ensure valid relationship types or to help troubleshoot'), which goes beyond what annotations provide. No contradiction with annotations exists.

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 emoji-labeled sections (Purpose, Returns, Usage Guidance), each containing a single, focused sentence. It is front-loaded with the core purpose, avoids redundancy, and every sentence contributes directly to understanding the tool's use. No wasted words.

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

Completeness4/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 (2 required parameters, no output schema), the description is largely complete: it states the purpose, return format, and usage context. However, it could slightly enhance completeness by mentioning that it returns an array of definitions with details like type IDs, labels, and categories, though this is implied in the Returns section. Annotations cover safety aspects well.

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, fully documenting both parameters (fromObjectType and toObjectType) with valid values and guidance for custom objects. The description does not add any parameter-specific information beyond what the schema provides, so it meets the baseline of 3 for high schema coverage without extra value.

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 clearly states the tool's purpose with specific verbs ('retrieves') and resources ('valid association types between specific HubSpot object types'), distinguishing it from sibling tools like hubspot-list-associations (which lists actual associations) and hubspot-get-schemas (which gets object schemas). The purpose is precise and unambiguous.

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 ('Always use before creating associations to ensure valid relationship types or to help troubleshoot association creation errors'), which clearly differentiates it from alternatives like hubspot-batch-create-associations (for creating) and hubspot-list-associations (for listing existing ones). It gives a concrete use case and timing.

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