AI Product Assistant for Hardware Stores using PostgreSQL and Gemini - n8n Workflow

Build an intelligent n8n workflow agent connecting Google Gemini to a PostgreSQL database for real-time product queries, quoting, and expert hardware store advice. Use advanced n8n templates.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

E-commerce managers needing automated product information retrieval.
Businesses utilizing complex n8n templates for advanced customer support.
Developers looking to build custom AI agents with external database connections via an n8n node.
Users seeking a practical example of the n8n Micro-Content Provider (MCP) pattern.

Overview

This robust n8n workflow solves the challenge of providing real-time, accurate product information and complex project advice within a conversational interface. This n8n automation utilizes Google Gemini (via the dedicated n8n node) and connects it directly to a live PostgreSQL database containing detailed product inventory. The architecture leverages the n8n Micro-Content Provider (MCP) pattern, where the AI agent intelligently decides to use a custom database tool (defined by a dedicated n8n trigger and several PostgresTool n8n nodes) to fetch prices, stock, and descriptions.

This powerful n8n workflow transforms customer service by enabling instant quotes and expert product recommendations, making it one of the most valuable n8n templates for retail and construction supply businesses. Every part of the logic is managed within this single, efficient n8n instance.

How it Works

The entire process is initiated by the Chat Trigger n8n node when a user sends a query (e.g., "I need drywall supplies").


  1. Trigger & Routing: The Chat Trigger n8n trigger passes the user input to the main AI Agent n8n node.

  2. AI Orchestration: The AI Agent utilizes the Language Model (Google Gemini) and the Chat Memory n8n node to maintain conversation context. Based on the detailed system prompt, the AI determines if external data is needed.

  3. Tool Selection (MCP): If the AI decides a database lookup is required (e.g., searching for a product name or category), it calls the tool exposed by the DB Tools Client n8n node.

  4. Database Execution: This call hits the internal Database Tools Trigger (the MCP endpoint), which then routes the execution to the appropriate PostgresTool n8n node (Query Product by Name, Query Product by Category, etc.). These specialized n8n nodes dynamically receive parameters parsed by the AI.

  5. Result Synthesis: The PostgreSQL result set is returned to the AI Agent.

  6. Final Response: The Gemini LLM synthesizes the structured data (price, description, related items) into a professional, conversational response, delivering it back to the user via the initial Chat Trigger n8n node. This integrated n8n workflow ensures specialized expertise and accurate data.

Installation Guide


  1. Import the n8n workflow: Copy the provided JSON code and paste it into your n8n instance using the "New" button -> "Import from JSON".

  2. Set up PostgreSQL Credentials: Configure a new PostgreSQL credential set and ensure it has access to the required product table. Select this credential in all seven PostgresTool n8n nodes.

  3. Set up Google Gemini Credentials: Configure your Google Gemini API key credentials and select them in the Language Model (Google Gemini) n8n node.

  4. Configure MCP Endpoint: Verify the URL in the DB Tools Client n8n node matches the public endpoint of your n8n instance and the path defined in the Database Tools Trigger (/mcp/servidorbasesdedatos). This is essential for the AI Agent to communicate with the internal data retrieval n8n nodes.

  5. Activate: Save and activate the n8n workflow to make the Chat Trigger n8n trigger endpoint live. You can now test this advanced n8n template.

Node Details

Chat Trigger: The main n8n trigger for the agent, exposing a public web interface for user interaction.
AI Agent: The core orchestration n8n node. It manages the conversation flow, memory, LLM connection, and tool-use decisions based on a detailed prompt optimized for hardware sales.
Language Model (Google Gemini): Provides the intelligence for reasoning and conversation generation, leveraging the specialized n8n node for Gemini.
Chat Memory: An n8n node implementing Buffer Window Memory, crucial for maintaining conversation context and allowing follow-up questions within the n8n workflow.
DB Tools Client: This n8n node acts as the mechanism through which the AI agent calls the external tool defined by the Micro-Content Provider (MCP) n8n trigger.
Database Tools Trigger: This special n8n trigger defines the entry point for the MCP tool endpoint. It accepts requests from the DB Tools Client when the AI decides to perform a database query.


  • PostgresTool Nodes (e.g., Query Product by Name, Query Product by Category): Multiple specialized n8n node configurations for PostgreSQL. Each executes a SELECT query on the productos table, dynamically filtering results based on the parameters extracted by the AI, forming the data retrieval backbone of this n8n workflow.

Related n8n Workflows

Free

Nodes: 8 Nodes
Updated: December 26 2025
View all
Created by

Featured*