hubspot-get-schemas
Retrieve all custom object schemas defined in a HubSpot account to identify object types, properties, and associations. Use the returned objectTypeId and objectType for accurate API requests.
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.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {},
"type": "object"
}
Implementation Reference
- The process method that executes the tool: fetches schemas from '/crm-object-schemas/v3/schemas', simplifies results, and returns formatted response or error.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 input schema (empty object) and tool definition with name, description, inputSchema, and annotations.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 GetSchemasTool in the tools registry.registerTool(new GetSchemasTool());