generate_negotiation
Generates a payment slip or PIX for overdue subscription installments. Resolves late payments by creating a negotiable payment option.
Instructions
Generate Negotiation
Gera boleto ou PIX para parcelas de assinatura em atraso.
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) | |
| payment_type | Yes | Tipo de pagamento para a negociação. Values: BOLETO, PIX | |
| discount | No | discount | |
| document | No | CPF ou CNPJ do assinante (obrigatório para BOLETO) |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- The async function 'generate_negotiation' that implements the tool logic. It accepts subscription_id, recurrences, payment_type, optional discount and document, builds a POST request to /payments/api/v1/installments/negotiate, and returns the JSON result.
async def generate_negotiation( subscription_id: int, recurrences: list[int], payment_type: str, discount: Optional[dict] = None, document: Optional[str] = None, ) -> str: """Generate Negotiation Gera boleto ou PIX para parcelas de assinatura em atraso. Args: subscription_id: ID da assinatura recurrences: Números das recorrências em atraso (1 a 5 valores) payment_type: Tipo de pagamento para a negociação. Values: BOLETO, PIX discount: discount document: CPF ou CNPJ do assinante (obrigatório para BOLETO)""" 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) - The function signature and docstring define the input schema: subscription_id (int), recurrences (list[int]), payment_type (str with enum BOLETO/PIX), optional discount (dict) and document (str).
async def generate_negotiation( subscription_id: int, recurrences: list[int], payment_type: str, discount: Optional[dict] = None, document: Optional[str] = None, ) -> str: """Generate Negotiation Gera boleto ou PIX para parcelas de assinatura em atraso. Args: subscription_id: ID da assinatura recurrences: Números das recorrências em atraso (1 a 5 valores) payment_type: Tipo de pagamento para a negociação. Values: BOLETO, PIX discount: discount document: CPF ou CNPJ do assinante (obrigatório para BOLETO)""" 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:21-34 (registration)Auto-discovery registration of all tools including generate_negotiation. The server iterates over modules in tools_pkg and registers all async functions 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) - src/hotmart_mcp/tools/__init__.py:5-9 (registration)Re-exports all functions from negotiation module (including generate_negotiation) via wildcard import.
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 - src/hotmart_mcp/_shared.py:10-14 (helper)The get_client() helper used by generate_negotiation to obtain the HotmartClient singleton for making the API call.
def get_client() -> HotmartClient: global _client if _client is None: _client = HotmartClient() return _client