Skip to main content
Glama
ajaystream

HubSpot MCP Server

by ajaystream

hubspot-batch-update-objects

Update multiple HubSpot CRM objects of the same type in a single batch operation to modify properties efficiently.

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. Updates multiple existing HubSpot objects of the same objectType in a single API call.
  2. Use this tool when the user wants to update one or more existing CRM objects.
  3. If you are unsure about the property type to update, identify existing properties of the object and ask the user.

📋 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.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
objectTypeYesThe type of HubSpot object to update. 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.
inputsYesArray of objects to update (maximum 100 per batch)

Implementation Reference

  • The main handler function that processes the tool input, calls the HubSpot CRM API for batch updating objects, and formats the response.
    async process(args) {
        try {
            const response = await this.client.post(`/crm/v3/objects/${args.objectType}/batch/update`, {
                body: {
                    inputs: args.inputs,
                },
            });
            return {
                content: [
                    {
                        type: 'text',
                        text: JSON.stringify({
                            status: response.status,
                            results: response.results.map(result => ({
                                id: result.id,
                                properties: result.properties,
                                createdAt: result.createdAt,
                                updatedAt: result.updatedAt,
                                archived: result.archived,
                                archivedAt: result.archivedAt,
                            })),
                            requestedAt: response.requestedAt,
                            startedAt: response.startedAt,
                            completedAt: response.completedAt,
                        }, null, 2),
                    },
                ],
            };
        }
        catch (error) {
            return {
                content: [
                    {
                        type: 'text',
                        text: `Error batch updating HubSpot objects: ${error instanceof Error ? error.message : String(error)}`,
                    },
                ],
                isError: true,
            };
        }
    }
  • Zod schema definitions for input validation: PropertiesSchema, ObjectUpdateInputSchema, and the main BatchUpdateObjectsSchema passed to BaseTool.
    const PropertiesSchema = z.record(z.string(), z.string());
    const ObjectUpdateInputSchema = z.object({
        id: z.string().describe('ID of the object to update'),
        properties: PropertiesSchema.describe('Object properties as key-value pairs'),
        idProperty: z.string().optional().describe('Optional unique property name to use as the ID'),
        objectWriteTraceId: z.string().optional().describe('Optional trace ID for debugging purposes'),
    });
    const BatchUpdateObjectsSchema = z.object({
        objectType: z
            .string()
            .describe(`The type of HubSpot object to update. Valid values include: ${HUBSPOT_OBJECT_TYPES.join(', ')}. For custom objects, use the hubspot-get-schemas tool to get the objectType.`),
        inputs: z
            .array(ObjectUpdateInputSchema)
            .min(1)
            .max(100)
            .describe('Array of objects to update (maximum 100 per batch)'),
    });
  • Registration of the BatchUpdateObjectsTool instance using the registerTool function.
    registerTool(new BatchUpdateObjectsTool());
  • ToolDefinition object containing the tool name, description, inputSchema, and annotations, passed to BaseTool constructor.
    const ToolDefinition = {
        name: 'hubspot-batch-update-objects',
        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. Updates multiple existing HubSpot objects of the same objectType in a single API call.
          2. Use this tool when the user wants to update one or more existing CRM objects.
          3. If you are unsure about the property type to update, identify existing properties of the object and ask the user.
    
        📋 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.
      `,
        inputSchema: zodToJsonSchema(BatchUpdateObjectsSchema),
        annotations: {
            title: 'Update Multiple CRM Objects',
            readOnlyHint: false,
            destructiveHint: false,
            idempotentHint: false,
            openWorldHint: true,
        },
    };
Behavior4/5

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

The description adds valuable behavioral context beyond annotations. Annotations indicate it's not read-only, not destructive, not idempotent, and open-world. The description adds a data modification warning, clarifies it's for updating existing objects (not creating), mentions batch limits (up to 100 per batch implied via schema), and provides debugging hints (objectWriteTraceId). It doesn't contradict annotations, as 'modifies HubSpot data' aligns with readOnlyHint=false.

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

Conciseness4/5

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

The description is well-structured with emoji-labeled sections (Guardrails, Purpose, Prerequisites), making it easy to scan. It's appropriately sized for a batch update tool with prerequisites, though some sentences could be more concise (e.g., the Purpose section has slightly repetitive phrasing). Overall, it's front-loaded with critical warnings and purpose, with no wasted text.

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 (batch update with prerequisites), the description is mostly complete. It covers purpose, usage guidelines, warnings, and prerequisites. However, there's no output schema, and the description doesn't explain return values or error handling, which is a minor gap. Annotations provide safety context (e.g., not destructive), and schema covers parameters well, so it's largely adequate but could benefit from output details.

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 parameters thoroughly. The description doesn't add significant parameter-specific semantics beyond what's in the schema (e.g., it mentions objectType but doesn't elaborate beyond schema's enum-like list). It implies batch size via 'multiple' and references prerequisites for property identification, but these are general usage tips rather than parameter explanations. Baseline 3 is appropriate given 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 clearly states the tool's purpose: 'Updates multiple existing HubSpot objects of the same objectType in a single API call.' It specifies the verb ('updates'), resource ('HubSpot objects'), scope ('multiple'), and constraint ('same objectType'), and distinguishes it from siblings like hubspot-batch-create-objects (create vs. update) and hubspot-update-engagement (specific object type vs. general).

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: 'Use this tool when the user wants to update one or more existing CRM objects.' It also includes prerequisites (e.g., use hubspot-get-user-details for OwnerId/UserId, hubspot-list-objects for sampling) and alternatives for uncertainty (e.g., use hubspot-list-properties if hubspot-list-objects isn't helpful), clearly differentiating it from other tools.

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