Skip to content

Latest commit

 

History

History
224 lines (153 loc) · 16.9 KB

README.md

File metadata and controls

224 lines (153 loc) · 16.9 KB

Search

(search)

Overview

Available Operations

searchCompanies

Search for companies by filtering on properties, searching through associations, and sorting results. Learn more about CRM search.

Example Usage

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();

Standalone function

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();

Parameters

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.

Response

Promise<operations.SearchCompaniesResponse>

Errors

Error Type Status Code Content Type
errors.APIError 4XX, 5XX */*

searchContacts

Search for contacts by filtering on properties, searching through associations, and sorting results. Learn more about CRM search.

Example Usage

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();

Standalone function

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();

Parameters

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.

Response

Promise<operations.SearchContactsResponse>

Errors

Error Type Status Code Content Type
errors.APIError 4XX, 5XX */*

searchDeals

Example Usage

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();

Standalone function

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();

Parameters

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.

Response

Promise<operations.SearchDealsResponse>

Errors

Error Type Status Code Content Type
errors.APIError 4XX, 5XX */*