hotmart_negotiation_generate
Generate a negotiation for a Hotmart subscription by specifying overdue recurrences, payment type, and optional discount and document.
Instructions
Generate Negotiation.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| subscription_id | Yes | ID da assinatura | |
| recurrences | Yes | Números das recorrências em atraso (1 a 5 valores). Pass a JSON array of integers, e.g. `[12345, 67890]`. | |
| payment_type | Yes | Payment type para a negociação. Allowed values: 'BOLETO', 'PIX' | |
| discount | No | discount. **Fraction between 0 and 1** (NOT percent). Ex: `0.25` = 25% off. Pass `0.10` for 10%, NOT `10`. | |
| document | No | Subscriber's CPF or CNPJ (required when payment_method is BILLET) |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- The main implementation of the hotmart_negotiation_generate tool. It is an async function that calls POST /payments/api/v1/installments/negotiate with subscription_id, recurrences, payment_type, optional discount and document parameters, returning the JSON response.
async def hotmart_negotiation_generate( subscription_id: int, recurrences: list[int], payment_type: str, discount: Optional[dict] = None, document: Optional[str] = None, ) -> str: """Generate Negotiation. Args: subscription_id: ID da assinatura recurrences: Números das recorrências em atraso (1 a 5 valores). Pass a JSON array of integers, e.g. `[12345, 67890]`. payment_type: Payment type para a negociação. Allowed values: 'BOLETO', 'PIX' discount: discount. **Fraction between 0 and 1** (NOT percent). Ex: `0.25` = 25% off. Pass `0.10` for 10%, NOT `10`. document: Subscriber's CPF or CNPJ (required when payment_method is BILLET)""" endpoint = "/payments/api/v1/installments/negotiate" body = {} body["subscription_id"] = subscription_id body["recurrences"] = recurrences body["payment_type"] = payment_type if discount is not None: body["discount"] = discount if document is not None: body["document"] = document result = await get_client().post(endpoint, json=body) return json.dumps(result, indent=2) - src/hotmart_mcp/tools/negotiation.py:8-36 (registration)The tool is exported via __all__ in the negotiation module, which is re-exported through tools/__init__.py (line 5).
__all__ = ["hotmart_negotiation_generate"] async def hotmart_negotiation_generate( subscription_id: int, recurrences: list[int], payment_type: str, discount: Optional[dict] = None, document: Optional[str] = None, ) -> str: """Generate Negotiation. Args: subscription_id: ID da assinatura recurrences: Números das recorrências em atraso (1 a 5 valores). Pass a JSON array of integers, e.g. `[12345, 67890]`. payment_type: Payment type para a negociação. Allowed values: 'BOLETO', 'PIX' discount: discount. **Fraction between 0 and 1** (NOT percent). Ex: `0.25` = 25% off. Pass `0.10` for 10%, NOT `10`. document: Subscriber's CPF or CNPJ (required when payment_method is BILLET)""" endpoint = "/payments/api/v1/installments/negotiate" body = {} body["subscription_id"] = subscription_id body["recurrences"] = recurrences body["payment_type"] = payment_type if discount is not None: body["discount"] = discount if document is not None: body["document"] = document result = await get_client().post(endpoint, json=body) return json.dumps(result, indent=2) - src/hotmart_mcp/server.py:25-37 (registration)Auto-discovery registration: server.py iterates all modules under hotmart_mcp.tools and registers every async coroutine function (including hotmart_negotiation_generate) 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:10-15 (helper)The get_client() helper that provides the HotmartClient singleton used by the handler to make the HTTP POST request.
def get_client() -> HotmartClient: global _client if _client is None: _client = HotmartClient() return _client - The function signature defines the input schema: subscription_id (int), recurrences (list[int]), payment_type (str), discount (Optional[dict]), document (Optional[str]).
async def hotmart_negotiation_generate( subscription_id: int, recurrences: list[int], payment_type: str, discount: Optional[dict] = None, document: Optional[str] = None, ) -> str: """Generate Negotiation. Args: subscription_id: ID da assinatura recurrences: Números das recorrências em atraso (1 a 5 valores). Pass a JSON array of integers, e.g. `[12345, 67890]`. payment_type: Payment type para a negociação. Allowed values: 'BOLETO', 'PIX' discount: discount. **Fraction between 0 and 1** (NOT percent). Ex: `0.25` = 25% off. Pass `0.10` for 10%, NOT `10`. document: Subscriber's CPF or CNPJ (required when payment_method is BILLET)""" endpoint = "/payments/api/v1/installments/negotiate" body = {} body["subscription_id"] = subscription_id body["recurrences"] = recurrences body["payment_type"] = payment_type if discount is not None: body["discount"] = discount if document is not None: body["document"] = document result = await get_client().post(endpoint, json=body) return json.dumps(result, indent=2)