hs_get_deal
Retrieve a single deal by ID to view its amount, stage, close date, and associated contacts and companies.
Instructions
Retrieve a single deal by ID with amount, stage, close date, and associated contacts/companies.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| dealId | Yes | HubSpot deal ID |
Implementation Reference
- src/tools/deals.ts:28-33 (handler)The actual handler function `getDeal` that executes the tool logic. It calls the HubSpot CRM API via GET /crm/v3/objects/deals/{dealId} with properties and associations.
export async function getDeal(args: z.infer<typeof GetDealSchema>) { return hubspot(`/crm/v3/objects/deals/${args.dealId}`, "GET", undefined, { properties: DEAL_PROPS, associations: "contacts,companies", }); } - src/tools/deals.ts:24-26 (schema)Schema definition `GetDealSchema` which defines the input parameter: a `dealId` string.
export const GetDealSchema = z.object({ dealId: z.string().describe("HubSpot deal ID"), }); - src/index.ts:156-161 (registration)Registration of the tool `hs_get_deal` via `server.tool()` with description, schema, and handler wrapper.
server.tool( "hs_get_deal", "Retrieve a single deal by ID with amount, stage, close date, and associated contacts/companies.", GetDealSchema.shape, async (args) => { try { return ok(await getDeal(args)); } catch (e) { return err(e); } }, ); - src/tools/deals.ts:4-8 (helper)Helper constant `DEAL_PROPS` defining the list of deal properties retrieved by the handler.
const DEAL_PROPS = [ "dealname", "amount", "dealstage", "pipeline", "closedate", "hubspot_owner_id", "hs_deal_stage_probability", "createdate", "hs_is_closed_won", "hs_is_closed", "associated_contact_ids", ].join(",");