(search)
- searchCompanies - Search for companies
- searchContacts - Search for contacts
- searchDeals
Search for companies by filtering on properties, searching through associations, and sorting results. Learn more about CRM search.
import { Hubspot } from "mcp-hubspot";
const hubspot = new Hubspot({
hubspotToken: process.env["HUBSPOT_HUBSPOT_TOKEN"] ?? "",
});
async function run() {
const result = await hubspot.search.searchCompanies({});
// Handle the result
console.log(result);
}
run();
The standalone function version of this method:
import { HubspotCore } from "mcp-hubspot/core.js";
import { searchSearchCompanies } from "mcp-hubspot/funcs/searchSearchCompanies.js";
// Use `HubspotCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const hubspot = new HubspotCore({
hubspotToken: process.env["HUBSPOT_HUBSPOT_TOKEN"] ?? "",
});
async function run() {
const res = await searchSearchCompanies(hubspot, {});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result);
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
components.PublicObjectSearchRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<operations.SearchCompaniesResponse>
Error Type | Status Code | Content Type |
---|---|---|
errors.APIError | 4XX, 5XX | */* |
Search for contacts by filtering on properties, searching through associations, and sorting results. Learn more about CRM search.
import { Hubspot } from "mcp-hubspot";
const hubspot = new Hubspot({
hubspotToken: process.env["HUBSPOT_HUBSPOT_TOKEN"] ?? "",
});
async function run() {
const result = await hubspot.search.searchContacts({});
// Handle the result
console.log(result);
}
run();
The standalone function version of this method:
import { HubspotCore } from "mcp-hubspot/core.js";
import { searchSearchContacts } from "mcp-hubspot/funcs/searchSearchContacts.js";
// Use `HubspotCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const hubspot = new HubspotCore({
hubspotToken: process.env["HUBSPOT_HUBSPOT_TOKEN"] ?? "",
});
async function run() {
const res = await searchSearchContacts(hubspot, {});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result);
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
components.PublicObjectSearchRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<operations.SearchContactsResponse>
Error Type | Status Code | Content Type |
---|---|---|
errors.APIError | 4XX, 5XX | */* |
import { Hubspot } from "mcp-hubspot";
const hubspot = new Hubspot({
hubspotToken: process.env["HUBSPOT_HUBSPOT_TOKEN"] ?? "",
});
async function run() {
const result = await hubspot.search.searchDeals({});
// Handle the result
console.log(result);
}
run();
The standalone function version of this method:
import { HubspotCore } from "mcp-hubspot/core.js";
import { searchSearchDeals } from "mcp-hubspot/funcs/searchSearchDeals.js";
// Use `HubspotCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const hubspot = new HubspotCore({
hubspotToken: process.env["HUBSPOT_HUBSPOT_TOKEN"] ?? "",
});
async function run() {
const res = await searchSearchDeals(hubspot, {});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result);
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
components.PublicObjectSearchRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<operations.SearchDealsResponse>
Error Type | Status Code | Content Type |
---|---|---|
errors.APIError | 4XX, 5XX | */* |