Manage Gemini File Search RAG stores and documents with n8n forms
Quick Overview This workflow creates and manages Gemini File Search RAG stores via an Agents tool, and ingests documents through an n8n Form that uploads files to Google’s Generative Language API for indexing.
How it works Receives tool calls from an n8n Chat Agent with fields like action, storeName, documentName, query, and force. Normalizes the tool input and routes the request to the correct operation (list, create, get, query, list documents, delete document, or delete store). Calls the Google Generative Language API to list stores, create a new fileSearchStore, fetch store status, or run a Gemini grounded query against a selected store. Lists documents in a store or deletes a specific document using its documentName when requested. Deletes an entire store only when force is explicitly set, otherwise returns a force-required error message. Separately, an n8n Form trigger accepts file uploads and either creates a new store or targets an existing store, then uploads and imports each file into the Gemini File Search store for indexing. Displays a completion page with the store ID (storeName) to use in the Agents tool for querying and ongoing management.
Setup Add Google Gemini (Google PaLM / Generative Language API) credentials in n8n with access to the File Search and Gemini models endpoints. Publish the workflow form and use its public URL to ingest documents, pasting an existing fileSearchStores/... ID when adding to an existing store. Add this workflow as a Tool in your n8n Agent, and ensure the agent sends separate fields (action, displayName, storeName, documentName, query, force) rather than embedding JSON in query. Update any environment-specific values such as pageSize limits or the Gemini model name (gemini-2.5-flash) if your project uses different defaults.
Related Templates
AI Weather Forecasts with MCP Integration
Real-time Weather Forecasts with MCP Tools This n8n workflow demonstrates how to integrate real-time weather intelligen...
Google Sheets UI for n8n Workflow
Google Sheets UI for Workflow Control This n8n template provides a practical and efficient way to manage your n8n workf...
Demo Workflow - How to use workflowStaticData()
This workflow demonstrates how to use the workflowStaticData() function to set any type of variable that will persist wi...
🔒 Please log in to import templates to n8n and favorite templates
Workflow Visualization
Loading...
Preparing workflow renderer
Comments (0)
Login to post comments