hubspot-get-schemas
Retrieve all custom object schemas from HubSpot to understand available object types, properties, and associations for CRM operations.
Instructions
🎯 Purpose:
1. Retrieves all custom object schemas defined in the HubSpot account.
🧠Usage Guidance:
1. Before working with custom objects to understand available object types,
their properties, and associations.
📦 Returns:
1. Provides the objectTypeId and objectType for each schema.
2. These attributes should be used for this object type instead of "custom" in subsequent requests.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "hubspot-get-schemas"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- The `process` method implements the tool's core logic: fetches custom object schemas from HubSpot API endpoint '/crm-object-schemas/v3/schemas', simplifies the results by extracting key fields, formats the response as structured content, and handles errors.
async process(_args) { try { const schemas = await this.client.get('/crm-object-schemas/v3/schemas'); const simplifiedResults = schemas.results.map((schema) => ({ objectTypeId: schema.objectTypeId, objectType: schema.fullyQualifiedName.split('_')[1], name: schema.name, labels: schema.labels, })); return { content: [ { type: 'text', text: 'Custom object schemas found. Note: These attributes should be used instead of "custom" in subsequent requests:', }, { type: 'text', text: JSON.stringify({ results: simplifiedResults }, null, 2), }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Error retrieving schemas: ${error instanceof Error ? error.message : String(error)}`, }, ], isError: true, }; } } - Defines the Zod input schema (empty, no parameters required) and the full tool definition including name, description, inputSchema conversion, and annotations for tool metadata.
const SchemaInfoSchema = z.object({}); const ToolDefinition = { name: 'hubspot-get-schemas', description: ` 🎯 Purpose: 1. Retrieves all custom object schemas defined in the HubSpot account. 🧠Usage Guidance: 1. Before working with custom objects to understand available object types, their properties, and associations. 📦 Returns: 1. Provides the objectTypeId and objectType for each schema. 2. These attributes should be used for this object type instead of "custom" in subsequent requests. `, inputSchema: zodToJsonSchema(SchemaInfoSchema), annotations: { title: 'Get Object Schemas', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true, }, }; - dist/tools/toolsRegistry.js:44-44 (registration)Registers an instance of the GetSchemasTool with the central tool registry.
registerTool(new GetSchemasTool()); - dist/tools/toolsRegistry.js:21-21 (registration)Imports the GetSchemasTool class required for registration.
import { GetSchemasTool } from './objects/getSchemaTool.js';