get_module_pages
Retrieve all pages (lessons) within a specific module of a Hotmart members area using the module ID and subdomain.
Instructions
Get Pages
Retorna as páginas (aulas) de um módulo.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| module_id | Yes | ID do módulo | |
| subdomain | Yes | Subdomínio da área de membros | |
| select | No | Seleção de campos customizados na resposta |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- src/hotmart_mcp/tools/club.py:36-56 (handler)The `get_module_pages` async handler function. Calls GET /club/api/v1/modules/{module_id}/pages via get_client(), passing subdomain and optional select params, returning JSON string.
async def get_module_pages( module_id: str, subdomain: str, select: Optional[str] = None, ) -> str: """Get Pages Retorna as páginas (aulas) de um módulo. Args: module_id: ID do módulo subdomain: Subdomínio da área de membros select: Seleção de campos customizados na resposta""" endpoint = f"/club/api/v1/modules/{module_id}/pages" params = {} if subdomain is not None: params["subdomain"] = subdomain 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/server.py:21-37 (registration)Automatic registration in `_discover_and_register_tools()`: iterates all tool modules, finds async functions, and registers them as MCP tools via `mcp.tool()(obj)`.
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:1-14 (helper)The `get_client()` helper that provides the shared HotmartClient singleton used by get_module_pages.
"""Shared lazy singleton for the Hotmart API client.""" from __future__ import annotations from hotmart_mcp.client import HotmartClient _client: HotmartClient | None = None def get_client() -> HotmartClient: global _client if _client is None: _client = HotmartClient() return _client - src/hotmart_mcp/client.py:197-258 (helper)The `get()` method on `HotmartClient` that get_module_pages calls to make the actual HTTP GET request.
async def get( self, path: str, params: dict[str, Any] | None = None, select: list[str] | None = None, ) -> dict[str, Any]: return await self._request("GET", path, params=params, select=select) async def post( self, path: str, json: dict[str, Any] | None = None, params: dict[str, Any] | None = None, ) -> dict[str, Any]: return await self._request("POST", path, params=params, json=json) async def put( self, path: str, json: dict[str, Any] | None = None, params: dict[str, Any] | None = None, ) -> dict[str, Any]: return await self._request("PUT", path, params=params, json=json) async def patch( self, path: str, json: dict[str, Any] | None = None, params: dict[str, Any] | None = None, ) -> dict[str, Any]: return await self._request("PATCH", path, params=params, json=json) async def delete( self, path: str, params: dict[str, Any] | None = None, ) -> dict[str, Any]: return await self._request("DELETE", path, params=params) async def get_all_pages( self, path: str, params: dict[str, Any] | None = None, select: list[str] | None = None, items_key: str = "items", ) -> list[dict[str, Any]]: params = dict(params) if params else {} all_items: list[dict[str, Any]] = [] while True: data = await self.get(path, params=params, select=select) items = data.get(items_key, []) all_items.extend(items) next_token = (data.get("page_info") or {}).get("next_page_token") if not next_token: break params["page_token"] = next_token return all_items - src/hotmart_mcp/tools/__init__.py:3-9 (registration)Re-exports all club tools (including get_module_pages) via `from .club import *`.
from .club import * # noqa: F401,F403 from .coupons import * # noqa: F401,F403 from .negotiation import * # noqa: F401,F403 from .products import * # noqa: F401,F403 from .sales import * # noqa: F401,F403 from .subscriptions import * # noqa: F401,F403 from .tickets import * # noqa: F401,F403