get_product_plans
Retrieve subscription plans for a specific product by providing the product ID. Supports pagination and filtering by plan ID.
Instructions
Get Product Plans
Retorna os planos de assinatura 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 | |
| id_ | No | ID do plano | |
| 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:79-107 (handler)The handler function for 'get_product_plans'. It takes product_id (required), max_results, page_token, id_, and select as optional parameters. Calls GET /products/api/v1/products/{product_id}/plans and returns the JSON response.
async def get_product_plans( product_id: int, max_results: Optional[int] = None, page_token: Optional[str] = None, id_: Optional[int] = None, select: Optional[str] = None, ) -> str: """Get Product Plans Retorna os planos de assinatura 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 id_: ID do plano select: Seleção de campos customizados na resposta""" endpoint = f"/products/api/v1/products/{product_id}/plans" params = {} if max_results is not None: params["max_results"] = max_results if page_token is not None: params["page_token"] = page_token if id_ is not None: params["id"] = id_ if select is not None: params["select"] = select result = await get_client().get(endpoint, params=params) return json.dumps(result, indent=2) - The function signature defines the input schema: product_id (int, required), max_results (Optional[int]), page_token (Optional[str]), id_ (Optional[int]), select (Optional[str]). Output is always str (JSON).
async def get_product_plans( product_id: int, max_results: Optional[int] = None, page_token: Optional[str] = None, id_: Optional[int] = None, select: Optional[str] = None, ) -> str: - src/hotmart_mcp/server.py:21-37 (registration)Automatic registration: _discover_and_register_tools() iterates all modules in hotmart_mcp.tools, finds async functions, and registers them via mcp.tool()(obj). This is how get_product_plans gets registered.
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/tools/products.py:8-8 (registration)The __all__ export list includes 'get_product_plans', making it publicly accessible from the products module.
__all__ = ["list_products", "get_product_offers", "get_product_plans"] - src/hotmart_mcp/_shared.py:10-14 (helper)The get_client() helper provides the shared HotmartClient singleton used by get_product_plans to make HTTP requests.
def get_client() -> HotmartClient: global _client if _client is None: _client = HotmartClient() return _client