Skip to main content
Glama

refund_sale

Refund a sale by providing the transaction code. Requires APPROVED or COMPLETE status and falls within the 7-30 day refund window.

Instructions

Sales Refund

Realiza o reembolso de uma venda. A venda deve estar com status APPROVED ou COMPLETE. Não disponível para trial, BACS ou SEPA. Janela de reembolso de 7 a 30 dias (máximo 60).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
transaction_codeYesCódigo da transação

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The main handler/implementation of the refund_sale tool. It accepts a 'transaction_code' parameter, sends a PUT request to '/payments/api/v1/sales/{transaction_code}/refund', and returns the JSON response.
    async def refund_sale(
        transaction_code: str,
    ) -> str:
        """Sales Refund
        
        Realiza o reembolso de uma venda. A venda deve estar com status APPROVED ou COMPLETE. Não disponível para trial, BACS ou SEPA. Janela de reembolso de 7 a 30 dias (máximo 60).
        
        Args:
            transaction_code: Código da transação"""
        endpoint = f"/payments/api/v1/sales/{transaction_code}/refund"
        result = await get_client().put(endpoint)
        return json.dumps(result, indent=2)
  • Automatic tool registration in _discover_and_register_tools(). It imports all modules under hotmart_mcp.tools and registers every public async function as an MCP tool via mcp.tool()(obj). The refund_sale function (from sales.py) gets registered here automatically.
    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
  • Helper function 'get_client()' used by refund_sale to obtain the HotmartClient singleton for making the API call.
    def get_client() -> HotmartClient:
        global _client
        if _client is None:
            _client = HotmartClient()
        return _client
Behavior4/5

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

No annotations are provided, so the description carries full burden. It discloses the refund action, required status, payment exclusions, and time window. It does not mention reversibility or side effects, but the core behavior is transparent.

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

Conciseness5/5

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

The description is concise, front-loaded with the action, and structured into clear bullet points (status, exclusions, window). Every sentence adds value.

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

Completeness4/5

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

Given the tool's simplicity (1 param, no output schema provided), the description covers prerequisites, exclusions, and timing. It could mention mutation implications, but overall it is complete enough for correct invocation.

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?

The single parameter 'transaction_code' has a minimal schema description. The tool description adds no further parameter details beyond what the schema provides. With schema coverage at 100%, the baseline score of 3 is appropriate.

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 performs a refund of a sale, specifying required statuses and exclusions. It is distinct from sibling tools which focus on subscriptions, coupons, and events.

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

Usage Guidelines4/5

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

The description provides explicit conditions for use: sale must be APPROVED or COMPLETE, not for trial/BACS/SEPA, and within a 7-30 day window (max 60). It lacks explicit alternatives but the conditions are clear.

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