Skip to main content
Glama
ajaystream

HubSpot MCP Server

by ajaystream

hubspot-update-engagement

Idempotent

Update existing HubSpot engagements like notes and tasks by modifying content, attributes, or metadata to keep CRM records current and accurate.

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 an existing HubSpot engagement (Note or Task).
  2. Allows modification of engagement attributes, content, and metadata.

📋 Prerequisites:
  1. You need the engagement ID to update an existing engagement.
  2. Use the hubspot-get-engagement tool to get the current engagement details if needed.
  3. Use the hubspot-get-user-details tool to get the owner ID.

🧭 Usage Guidance:
  1. Use for updating NOTE content or TASK details (subject, description, status).
  2. Only include the fields you want to update - other fields will remain unchanged.
  3. HubSpot notes and task descriptions support HTML formatting. However headings (<h1>, <h2>, etc.) look ugly in the CRM. So use them sparingly.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
engagementIdYesThe ID of the engagement to update
ownerIdNoThe ID of the owner of this engagement
timestampNoTimestamp for the engagement (milliseconds since epoch).
metadataYesMetadata specific to the engagement type (Note or Task)
associationsYesAssociated records for this engagement

Implementation Reference

  • Executes the tool logic: parses args, builds PATCH request body for HubSpot engagements API, sends request, handles response or error.
    async process(args) {
        try {
            const { engagementId, ownerId, timestamp, metadata, associations } = args;
            // Build request body with only provided fields
            const requestBody = {
                ...(ownerId || timestamp !== undefined
                    ? {
                        engagement: {
                            ...(ownerId && { ownerId }),
                            ...(timestamp !== undefined && { timestamp }),
                        },
                    }
                    : {}),
                ...(Object.keys(metadata).length > 0 && { metadata }),
                ...(Object.keys(associations).length > 0 && { associations }),
            };
            const response = await this.client.patch(`/engagements/v1/engagements/${engagementId}`, {
                body: requestBody,
            });
            return {
                content: [
                    {
                        type: 'text',
                        text: JSON.stringify({
                            status: 'success',
                            engagement: response,
                            message: `Successfully updated engagement ${engagementId}`,
                        }, null, 2),
                    },
                ],
            };
        }
        catch (error) {
            return {
                content: [
                    {
                        type: 'text',
                        text: `Error updating HubSpot engagement: ${error instanceof Error ? error.message : String(error)}`,
                    },
                ],
                isError: true,
            };
        }
    }
  • Zod schema defining the input parameters for updating an engagement: engagementId (required), ownerId/timestamp/metadata/associations (optional).
    const UpdateEngagementSchema = z.object({
        engagementId: z.number().int().positive().describe('The ID of the engagement to update'),
        ownerId: z
            .number()
            .int()
            .positive()
            .optional()
            .describe('The ID of the owner of this engagement'),
        timestamp: z
            .number()
            .int()
            .optional()
            .describe('Timestamp for the engagement (milliseconds since epoch).'),
        metadata: z
            .object({})
            .passthrough()
            .describe('Metadata specific to the engagement type (Note or Task)'),
        associations: AssociationsSchema.describe('Associated records for this engagement'),
    });
  • ToolDefinition object specifying name 'hubspot-update-engagement', description, inputSchema, and annotations; passed to BaseTool constructor.
    const ToolDefinition = {
        name: 'hubspot-update-engagement',
        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 an existing HubSpot engagement (Note or Task).
          2. Allows modification of engagement attributes, content, and metadata.
    
        📋 Prerequisites:
          1. You need the engagement ID to update an existing engagement.
          2. Use the hubspot-get-engagement tool to get the current engagement details if needed.
          3. Use the hubspot-get-user-details tool to get the owner ID.
    
        🧭 Usage Guidance:
          1. Use for updating NOTE content or TASK details (subject, description, status).
          2. Only include the fields you want to update - other fields will remain unchanged.
          3. HubSpot notes and task descriptions support HTML formatting. However headings (<h1>, <h2>, etc.) look ugly in the CRM. So use them sparingly.
      `,
        inputSchema: zodToJsonSchema(UpdateEngagementSchema),
        annotations: {
            title: 'Update Engagement',
            readOnlyHint: false,
            destructiveHint: false,
            idempotentHint: true,
            openWorldHint: true,
        },
    };
  • Registers an instance of UpdateEngagementTool in the central tools registry.
    registerTool(new UpdateEngagementTool());
Behavior4/5

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

The description adds valuable behavioral context beyond annotations: the guardrails warn about data modification and user consent requirements, usage guidance explains partial updates ('Only include fields you want to update'), and HTML formatting limitations. Annotations cover idempotency and non-destructive nature, but the description provides practical implementation details that help the agent use the tool correctly.

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 uses clear section headers (Guardrails, Purpose, Prerequisites, Usage Guidance) that make it easy to scan. Each section contains focused, relevant information with minimal fluff. While slightly longer than minimal, every sentence serves a clear purpose in guiding tool usage.

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?

For a mutation tool with good annotations (idempotent, non-destructive) but no output schema, the description provides strong context: guardrails for safety, prerequisites for successful invocation, and usage guidance for effective application. It covers the critical aspects needed to use this update tool correctly, though doesn't describe return values or error cases.

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 information beyond what's in the schema descriptions. It mentions engagement ID as a prerequisite and owner ID needing to be fetched, but these don't enhance understanding of the parameters themselves beyond the schema.

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 'Updates an existing HubSpot engagement (Note or Task)' with specific verbs ('updates', 'modification') and resources ('engagement', 'attributes, content, and metadata'). It clearly distinguishes from sibling tools like hubspot-create-engagement (create vs. update) and hubspot-get-engagement (read vs. update).

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 ('Use for updating NOTE content or TASK details'), when not to use (only when user explicitly requests CRM updates per guardrails), and alternatives ('Use the hubspot-get-engagement tool to get current details', 'Use the hubspot-get-user-details tool to get owner ID'). It also distinguishes from create operations by emphasizing it updates existing engagements.

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