Skip to main content
Glama

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

TableJSON Schema
NameRequiredDescriptionDefault
subscription_idYesID da assinatura
recurrencesYesNúmeros das recorrências em atraso (1 a 5 valores)
payment_typeYesTipo de pagamento para a negociação. Values: BOLETO, PIX
discountNodiscount
documentNoCPF ou CNPJ do assinante (obrigatório para BOLETO)

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

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)
  • 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)
  • 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
  • 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
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description must disclose behavioral traits. It only states the creation of boleto or PIX but does not mention whether it modifies subscription state, requires authentication, or what side effects occur. The existence of an output schema is not leveraged to describe return values.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single concise sentence that conveys the core purpose. It is front-loaded with the key action. However, it could be slightly more efficient or include additional context without becoming verbose.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool has 5 parameters including optional ones like discount and document (required conditionally for BOLETO), the description does not explain these relationships or the effect on the subscription. The output schema exists but is not mentioned. The description lacks crucial context for a mutation tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, and each parameter already has a description. The tool description adds no extra meaning beyond the payment type ('boleto ou PIX'), which is already captured in the payment_type parameter description. No additional semantic context is provided.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool generates a boleto or PIX for overdue subscription installments. It uses a specific verb ('gera'), identifies the resource ('boleto ou PIX'), and provides context ('parcelas de assinatura em atraso'). This distinguishes it from sibling tools like cancel_subscription or refund_sale.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage for generating payment instruments for overdue installments but does not explicitly state when to use this tool versus alternatives (e.g., when to refund or cancel). No exclusions or alternative tool names are mentioned.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/thaleslaray/hotmart-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server