delete_coupon
Remove a discount coupon from Hotmart by providing its coupon ID.
Instructions
Delete Coupon
Exclui um cupom de desconto.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| coupon_id | Yes | ID do cupom |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- src/hotmart_mcp/tools/coupons.py:75-86 (handler)Handler function for the delete_coupon tool. Makes a DELETE request to /products/api/v1/coupon/{coupon_id} using the shared Hotmart client and returns the JSON response.
async def delete_coupon( coupon_id: int, ) -> str: """Delete Coupon Exclui um cupom de desconto. Args: coupon_id: ID do cupom""" endpoint = f"/products/api/v1/coupon/{coupon_id}" result = await get_client().delete(endpoint) return json.dumps(result, indent=2) - Input schema: expects a single 'coupon_id' integer parameter.
async def delete_coupon( coupon_id: int, ) -> str: - src/hotmart_mcp/server.py:25-37 (registration)Auto-discovery registers delete_coupon (an async function) as an MCP tool by iterating modules and calling mcp.tool()(obj).
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-14 (helper)Helper that provides the shared HotmartClient singleton used by delete_coupon to make the DELETE HTTP request.
def get_client() -> HotmartClient: global _client if _client is None: _client = HotmartClient() return _client