Skip to main content
Glama

batch_cancel_subscriptions

Cancel multiple subscriptions at once by providing subscriber codes. Optionally send notification emails.

Instructions

Batch Cancel Subscriptions

Cancela múltiplas assinaturas em lote.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
subscriber_codeYesLista de códigos de assinantes
send_mailNoEnviar e-mail de notificação aos assinantes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The main handler function for batch_cancel_subscriptions. It calls POST /payments/api/v1/subscriptions/cancel with subscriber_code and optional send_mail parameters, returning JSON results.
    async def batch_cancel_subscriptions(
        subscriber_code: list[str],
        send_mail: Optional[bool] = None,
    ) -> str:
        """Batch Cancel Subscriptions
        
        Cancela múltiplas assinaturas em lote.
        
        Args:
            subscriber_code: Lista de códigos de assinantes
            send_mail: Enviar e-mail de notificação aos assinantes"""
        endpoint = "/payments/api/v1/subscriptions/cancel"
        body = {}
        body["subscriber_code"] = subscriber_code
        if send_mail is not None:
            body["send_mail"] = send_mail
        result = await get_client().post(endpoint, json=body)
        return json.dumps(result, indent=2)
  • The dynamic registration logic in _discover_and_register_tools() that discovers all async functions in the tools package 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
  • The function signature serves as the schema: subscriber_code (list[str]) and send_mail (Optional[bool]).
    async def batch_cancel_subscriptions(
        subscriber_code: list[str],
        send_mail: Optional[bool] = None,
    ) -> str:
        """Batch Cancel Subscriptions
        
        Cancela múltiplas assinaturas em lote.
        
        Args:
            subscriber_code: Lista de códigos de assinantes
            send_mail: Enviar e-mail de notificação aos assinantes"""
        endpoint = "/payments/api/v1/subscriptions/cancel"
        body = {}
        body["subscriber_code"] = subscriber_code
        if send_mail is not None:
            body["send_mail"] = send_mail
        result = await get_client().post(endpoint, json=body)
        return json.dumps(result, indent=2)
  • The get_client() helper that provides the shared HotmartClient instance used by the handler to make HTTP requests.
    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?

With no annotations, the description must fully disclose behavioral traits, but it only states that it cancels multiple subscriptions in batch. It omits details on permissions, atomicity, error handling, or whether the operation is reversible. The send_mail parameter is mentioned in the schema but not highlighted as a behavioral option.

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 very short, with a title and one-line Portuguese sentence. It is front-loaded and has no wasted words, but it could be slightly more structured to include usage context without losing conciseness.

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 an output schema and multiple siblings, the description is too minimal. It does not explain the return value, error behavior, or how the batch operation handles partial failures. The agent lacks sufficient context to use it reliably.

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 description coverage is 100%, so the schema already documents both parameters adequately. The tool description adds no additional meaning or constraints beyond the schema, so it meets the baseline but does not enhance understanding.

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 it cancels multiple subscriptions in batch, specifying the verb (cancel), resource (subscriptions), and scope (batch). It distinguishes from sibling tools like cancel_subscription (single) and batch_reactivate_subscriptions (reactivate).

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives, such as the singular cancel_subscription or batch_reactivate_subscriptions. It does not mention prerequisites, exclusions, or appropriate contexts.

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