hs_list_properties
List all properties defined for a HubSpot CRM object type, with an option to return only custom fields. Use this to retrieve property definitions for contacts, companies, deals, tickets, products, or line items.
Instructions
List all properties defined for a CRM object type. Use customOnly=true to see only custom fields.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| objectType | Yes | CRM object type | |
| customOnly | No | Return only custom properties |
Implementation Reference
- src/tools/properties.ts:11-21 (handler)The `listProperties` function that executes the tool logic: calls the HubSpot CRM properties API, filters by customOnly, and returns a simplified property list.
export async function listProperties(args: z.infer<typeof ListPropertiesSchema>) { const res = await hubspot<{ results: Array<{ name: string; label: string; type: string; fieldType: string; groupName: string; calculated: boolean }> }>( `/crm/v3/properties/${args.objectType}`, ); const props = res.results ?? []; return { objectType: args.objectType, properties: (args.customOnly ? props.filter((p) => !p.calculated && p.groupName !== "contactinformation") : props) .map(({ name, label, type, fieldType, groupName }) => ({ name, label, type, fieldType, groupName })), }; } - src/tools/properties.ts:6-9 (schema)The Zod schema for tool input validation: requires objectType (enum of CRM object types) and optional customOnly boolean.
export const ListPropertiesSchema = z.object({ objectType: z.enum(OBJECT_TYPES).describe("CRM object type"), customOnly: z.boolean().default(false).optional().describe("Return only custom properties"), }); - src/index.ts:280-285 (registration)Registration of the tool 'hs_list_properties' on the MCP server with its schema and handler binding.
server.tool( "hs_list_properties", "List all properties defined for a CRM object type. Use customOnly=true to see only custom fields.", ListPropertiesSchema.shape, async (args) => { try { return ok(await listProperties(args)); } catch (e) { return err(e); } }, ); - src/tools/properties.ts:4-4 (helper)The list of valid CRM object types used by the schema enums.
const OBJECT_TYPES = ["contacts", "companies", "deals", "tickets", "products", "line_items"] as const;