hs_search_deals
Search deals by name using full-text queries to find specific deals in HubSpot CRM.
Instructions
Full-text search across deals by name.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Full-text search (deal name, etc.) | |
| limit | No |
Implementation Reference
- src/tools/deals.ts:15-22 (handler)The main handler function for hs_search_deals. Sends a POST request to HubSpot's /crm/v3/objects/deals/search with full-text query, limit, properties, and sort order.
export async function searchDeals(args: z.infer<typeof SearchDealsSchema>) { return hubspot("/crm/v3/objects/deals/search", "POST", { query: args.query, limit: args.limit ?? 20, properties: DEAL_PROPS.split(","), sorts: [{ propertyName: "createdate", direction: "DESCENDING" }], }); } - src/tools/deals.ts:10-13 (schema)Zod schema defining the input parameters for hs_search_deals: query (string) and optional limit (integer, 1-100, default 20).
export const SearchDealsSchema = z.object({ query: z.string().describe("Full-text search (deal name, etc.)"), limit: z.number().int().min(1).max(100).default(20).optional(), }); - src/index.ts:149-154 (registration)Registration of the hs_search_deals tool with the MCP server, linking the schema and handler.
server.tool( "hs_search_deals", "Full-text search across deals by name.", SearchDealsSchema.shape, async (args) => { try { return ok(await searchDeals(args)); } catch (e) { return err(e); } }, ); - src/tools/deals.ts:4-8 (helper)Helper constant defining the list of deal properties retrieved for any deal query, used by searchDeals and other deal handlers.
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(",");