Skip to main content
Glama
ajaystream

HubSpot MCP Server

by ajaystream

hubspot-create-property

Create custom properties for HubSpot objects to customize CRM data structure and fields.

Instructions

🛡️ Guardrails:
  1. Data Modification Warning: This tool modifies HubSpot data. Only use when the user has explicitly requested to update their CRM.

🎯 Purpose:
  1. Creates new custom properties for HubSpot object types, enabling data structure customization.

📋 Prerequisites:
  1. Use the hubspot-get-user-details tool to get the OwnerId and UserId if you don't have that already.
  2. Use the hubspot-list-objects tool to sample existing objects for the object type.
  3. If hubspot-list-objects tool's response isn't helpful, use hubspot-list-properties tool.

🧭 Usage Guidance:
  1. Use this tool when you need to create a new custom property for a HubSpot object type.
  2. Makes sure that the user is looking to create a new property, and not create an object of a specific object type.
  3. Use list-properties to get a list of all properties for a given object type to be sure that the property does not already exist.
  4. Use list-properties to to understand the data structure of object properties first.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
objectTypeYesThe type of HubSpot object to create the property for. 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.
nameYesThe internal property name, which must be used when referencing the property via the API
labelYesA human-readable property label that will be shown in HubSpot
descriptionNoA description of the property that will be shown as help text
groupNameYesThe name of the property group the property belongs to
typeNoThe data type of the propertystring
fieldTypeNoControls how the property appears in HubSpottext
optionsNoA list of valid options for enumeration properties
formFieldNoWhether the property can be used in forms
hiddenNoWhether the property should be hidden in HubSpot
displayOrderNoThe order for displaying the property (lower numbers displayed first)
hasUniqueValueNoWhether the property's value must be unique
calculationFormulaNoA formula that is used to compute a calculated property
externalOptionsNoOnly for enumeration type properties. Should be set to true in conjunction with a referencedObjectType

Implementation Reference

  • The handler function that processes the input arguments, normalizes the property name, cleans the data, and makes a POST request to the HubSpot CRM API to create the property.
    async process(args) {
        try {
            const propertyData = {
                ...args,
                // Ensure name follows HubSpot naming convention (lowercase, no spaces)
                name: args.name.toLowerCase().replace(/\s+/g, '_'),
            };
            const { objectType, ...dataWithoutObjectType } = propertyData;
            const cleanPropertyData = Object.fromEntries(Object.entries(dataWithoutObjectType).filter(([_, value]) => value !== undefined));
            const response = await this.client.post(`/crm/v3/properties/${args.objectType}`, {
                body: cleanPropertyData,
            });
            return {
                content: [
                    {
                        type: 'text',
                        text: JSON.stringify(response, null, 2),
                    },
                ],
            };
        }
        catch (error) {
            return {
                content: [
                    {
                        type: 'text',
                        text: `Error creating HubSpot property for ${args.objectType}: ${error instanceof Error ? error.message : String(error)}`,
                    },
                ],
                isError: true,
            };
        }
    }
  • Zod schema defining the input parameters for creating a HubSpot property, including objectType, name, label, type, fieldType, and various options.
    const CreatePropertySchema = z.object({
        objectType: z
            .string()
            .describe(`The type of HubSpot object to create the property for. Valid values include: ${HUBSPOT_OBJECT_TYPES.join(', ')}. For custom objects, use the hubspot-get-schemas tool to get the objectType.`),
        name: z
            .string()
            .describe('The internal property name, which must be used when referencing the property via the API'),
        label: z.string().describe('A human-readable property label that will be shown in HubSpot'),
        description: z
            .string()
            .optional()
            .describe('A description of the property that will be shown as help text'),
        groupName: z.string().describe('The name of the property group the property belongs to'),
        type: z
            .enum(['string', 'number', 'date', 'datetime', 'enumeration', 'bool'])
            .default('string')
            .describe('The data type of the property'),
        fieldType: z
            .enum([
            'text',
            'textarea',
            'date',
            'file',
            'number',
            'select',
            'radio',
            'checkbox',
            'booleancheckbox',
            'calculation',
        ])
            .default('text')
            .describe('Controls how the property appears in HubSpot'),
        options: z
            .array(PropertyOptionSchema)
            .optional()
            .describe('A list of valid options for enumeration properties'),
        formField: z.boolean().optional().describe('Whether the property can be used in forms'),
        hidden: z.boolean().optional().describe('Whether the property should be hidden in HubSpot'),
        displayOrder: z
            .number()
            .int()
            .optional()
            .describe('The order for displaying the property (lower numbers displayed first)'),
        hasUniqueValue: z.boolean().optional().describe("Whether the property's value must be unique"),
        calculationFormula: z
            .string()
            .optional()
            .describe('A formula that is used to compute a calculated property'),
        externalOptions: z
            .boolean()
            .optional()
            .describe('Only for enumeration type properties. Should be set to true in conjunction with a referencedObjectType'),
    });
  • Registers an instance of the CreatePropertyTool with the tool registry, making the 'hubspot-create-property' tool available.
    registerTool(new CreatePropertyTool());
  • Tool definition object including the tool name 'hubspot-create-property', detailed description, input schema conversion, and annotations for MCP.
    const ToolDefinition = {
        name: 'hubspot-create-property',
        description: `
        🛡️ Guardrails:
          1. Data Modification Warning: This tool modifies HubSpot data. Only use when the user has explicitly requested to update their CRM.
    
        🎯 Purpose:
          1. Creates new custom properties for HubSpot object types, enabling data structure customization.
    
        📋 Prerequisites:
          1. Use the hubspot-get-user-details tool to get the OwnerId and UserId if you don't have that already.
          2. Use the hubspot-list-objects tool to sample existing objects for the object type.
          3. If hubspot-list-objects tool's response isn't helpful, use hubspot-list-properties tool.
    
        🧭 Usage Guidance:
          1. Use this tool when you need to create a new custom property for a HubSpot object type.
          2. Makes sure that the user is looking to create a new property, and not create an object of a specific object type.
          3. Use list-properties to get a list of all properties for a given object type to be sure that the property does not already exist.
          4. Use list-properties to to understand the data structure of object properties first.
      `,
        inputSchema: zodToJsonSchema(CreatePropertySchema),
        annotations: {
            title: 'Create CRM Property',
            readOnlyHint: false,
            destructiveHint: false,
            idempotentHint: false,
            openWorldHint: true,
        },
    };
  • Imports the CreatePropertyTool class necessary for registration.
    import { CreatePropertyTool } from './properties/createPropertyTool.js';
Behavior4/5

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

The description adds valuable behavioral context beyond annotations: it warns about data modification ('modifies HubSpot data') and emphasizes user confirmation, which complements the annotations (readOnlyHint=false, destructiveHint=false). However, it doesn't mention potential side effects like rate limits or authentication requirements, leaving some gaps in behavioral disclosure.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is structured with emoji headings, which aids readability but adds visual clutter. It includes some redundant information (e.g., repeating the purpose in 'Usage Guidance'), and the prerequisites section could be more concise. However, it's front-loaded with key warnings and purpose, and most sentences earn their place by providing actionable guidance.

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 complexity (14 parameters, mutation operation) and lack of output schema, the description does well by covering prerequisites, usage guidance, and behavioral warnings. It compensates for the absence of output schema by guiding users to other tools for context. However, it could better explain error handling or response format to be fully complete.

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 already documents all 14 parameters thoroughly. The description adds no specific parameter semantics beyond what's in the schema, such as explaining relationships between parameters (e.g., 'options' is only for 'enumeration' type). Baseline 3 is appropriate when the schema does the heavy lifting.

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 'Creates new custom properties for HubSpot object types' with a specific verb ('creates') and resource ('custom properties'), clearly distinguishing it from sibling tools like hubspot-update-property (updates existing properties) and hubspot-create-objects (creates objects, not properties). The purpose is precise and differentiated.

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 you need to create a new custom property'), when not to use it ('not create an object of a specific object type'), and alternatives to consider first (list-properties to check for existing properties). It also includes prerequisites and sibling tool references for context.

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