hs_get_company
Retrieve a single HubSpot company by its ID to get all standard properties along with associated contact and deal IDs.
Instructions
Retrieve a single company by ID with all standard properties and associated contact/deal IDs.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| companyId | Yes | HubSpot company ID |
Implementation Reference
- src/tools/companies.ts:28-33 (handler)The actual handler function for hs_get_company. Calls hubspot API to retrieve a single company by ID with standard properties and associated contact/deal IDs.
export async function getCompany(args: z.infer<typeof GetCompanySchema>) { return hubspot(`/crm/v3/objects/companies/${args.companyId}`, "GET", undefined, { properties: COMPANY_PROPS, associations: "contacts,deals", }); } - src/tools/companies.ts:24-26 (schema)Zod schema for hs_get_company input validation. Expects a single required field: companyId (string).
export const GetCompanySchema = z.object({ companyId: z.string().describe("HubSpot company ID"), }); - src/index.ts:133-138 (registration)Tool registration using server.tool() with name 'hs_get_company', schema, and handler wrapper.
server.tool( "hs_get_company", "Retrieve a single company by ID with all standard properties and associated contact/deal IDs.", GetCompanySchema.shape, async (args) => { try { return ok(await getCompany(args)); } catch (e) { return err(e); } }, ); - src/tools/companies.ts:4-8 (helper)Shared COMPANY_PROPS constant defining the list of standard company properties to retrieve.
const COMPANY_PROPS = [ "name", "domain", "industry", "numberofemployees", "annualrevenue", "city", "state", "country", "phone", "website", "hs_lead_status", "lifecyclestage", "createdate", "hubspot_owner_id", ].join(",");