remover_produto
Permanently deletes a product from the database using its ID. Provide the product ID to remove it.
Instructions
Exclui permanentemente um produto pelo ID.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id_produto | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- server.py:110-113 (handler)The handler function for the 'remover_produto' tool. Decorated with @mcp.tool(), it takes an id_produto (int) and delegates deletion to database.deletar_registro('produtos', id_produto).
@mcp.tool() def remover_produto(id_produto: int) -> str: """Exclui permanentemente um produto pelo ID.""" return database.deletar_registro("produtos", id_produto) - server.py:110-110 (registration)The @mcp.tool() decorator registers 'remover_produto' as an MCP tool via FastMCP.
@mcp.tool() - database.py:39-45 (helper)The underlying helper function 'deletar_registro' that performs the SQL DELETE operation on the 'produtos' table.
def deletar_registro(tabela, registro_id): conn = sqlite3.connect(DB_NAME) cursor = conn.cursor() cursor.execute(f"DELETE FROM {tabela} WHERE id = ?", (registro_id,)) conn.commit() conn.close() return f" {tabela.capitalize()} ID {registro_id} removido."