get_product_offers
Retrieve offers for a specific product by providing the product ID, with optional filtering and pagination.
Instructions
Get Product Offers
Retorna as ofertas de um produto.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| product_id | Yes | ID do produto | |
| max_results | No | Número máximo de resultados por página | |
| page_token | No | Token de paginação para a próxima página | |
| offer_key | No | Chave da oferta | |
| select | No | Seleção de campos customizados na resposta |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- src/hotmart_mcp/tools/products.py:48-76 (handler)Async function that implements the get_product_offers tool. Makes a GET request to /products/api/v1/products/{product_id}/offers with optional query params (max_results, page_token, offer_key, select) and returns the result as a JSON string.
async def get_product_offers( product_id: int, max_results: Optional[int] = None, page_token: Optional[str] = None, offer_key: Optional[str] = None, select: Optional[str] = None, ) -> str: """Get Product Offers Retorna as ofertas de um produto. Args: product_id: ID do produto max_results: Número máximo de resultados por página page_token: Token de paginação para a próxima página offer_key: Chave da oferta select: Seleção de campos customizados na resposta""" endpoint = f"/products/api/v1/products/{product_id}/offers" params = {} if max_results is not None: params["max_results"] = max_results if page_token is not None: params["page_token"] = page_token if offer_key is not None: params["offer_key"] = offer_key if select is not None: params["select"] = select result = await get_client().get(endpoint, params=params) return json.dumps(result, indent=2) - src/hotmart_mcp/tools/products.py:8-8 (registration)Export registration: get_product_offers is exposed in the module's __all__ list.
__all__ = ["list_products", "get_product_offers", "get_product_plans"] - src/hotmart_mcp/server.py:21-37 (registration)Auto-registration: server.py discovers all async functions (including get_product_offers) from the tools package and registers them as MCP tools via mcp.tool().
def _discover_and_register_tools() -> int: """Import all modules under hotmart_mcp.tools and register async functions.""" registered = 0 for module_info in pkgutil.iter_modules(tools_pkg.__path__, prefix=f"{tools_pkg.__name__}."): if module_info.name.endswith("__init__"): continue module = importlib.import_module(module_info.name) for name, obj in inspect.getmembers(module, iscoroutinefunction): if name.startswith("_"): continue mcp.tool()(obj) registered += 1 return registered - src/hotmart_mcp/_shared.py:10-14 (helper)Shared helper that provides a lazy singleton HotmartClient instance used by get_product_offers to make the API request.
def get_client() -> HotmartClient: global _client if _client is None: _client = HotmartClient() return _client