How eneelkant/marketing-database-agent works
Marketing Database Agent lets a Gemini Enterprise user request a prospect list, then returns a CSV download rather than displaying prospect rows in chat. The primary flow queries BigQuery and exports to Cloud Storage; a bucket-triggered helper renames the file, looks up export-job details, logs usage, and requests an admin email. A scheduled BigQuery procedure refreshes the clean prospect view. The repository also contains an optional MCP export server, documented as blocked by organization policy. Relationships for unsampled agent, SQL, and Apps Script behavior follow README documentation; implementation detail is limited to the supplied excerpts.
Main entry points: csv-helper/index.js CSV event handler · agent_instructions.md Gemini agent · mcp-server-optional/index.js MCP HTTP endpoint · setup_auto_view.sh Prospect view
Components 20
Prospect Generation
- Gemini agent
agent/agent_instructions.md - Title matching
agent/agent_instructions.md - BigQuery connector
- Export bucket
Data Preparation
- Prospect view
bigquery/setup_auto_view.sh - Hourly refresh
bigquery/setup_auto_view.sh
Audit and Email
- CSV event handler
csv-helper/index.js - Download naming
csv-helper/index.js - Export job lookup
csv-helper/index.js - Delivered row count
csv-helper/index.js - Generation log
- Monthly totals
csv-helper/index.js - Email sender
apps-script/Code.gs
Optional MCP Export
- MCP HTTP endpoint
mcp-server-optional/index.js - Prospect search
mcp-server-optional/index.js - CSV and signed link
mcp-server-optional/index.js - Cloud Storage
Other components
- Gemini user
- Admin recipients
- MCP client
Connections 20
- Gemini user → Gemini agent: requests list
README.md - Gemini agent → BigQuery connector: queries and exports
README.md - Gemini agent → Title matching: applies matching
README.md - BigQuery connector → Prospect view: queries
README.md - BigQuery connector → Export bucket: exports CSV
README.md - Gemini agent → Gemini user: returns download link
README.md - Hourly refresh → Prospect view: refreshes view
README.md - Export bucket → CSV event handler: triggers on new file
README.md - CSV event handler → Download naming: sets download name
csv-helper/index.js - CSV event handler → Export job lookup: looks up export
csv-helper/index.js - CSV event handler → Delivered row count: counts rows
csv-helper/index.js - CSV event handler → Generation log: inserts generation
csv-helper/index.js - CSV event handler → Monthly totals: queries totals
csv-helper/index.js - CSV event handler → Email sender: posts email data
csv-helper/index.js - Email sender → Admin recipients: emails
README.md - MCP client → MCP HTTP endpoint: calls tool
mcp-server-optional/index.js - MCP HTTP endpoint → Prospect search: dispatches search
mcp-server-optional/index.js - Prospect search → Prospect view: queries prospects
- MCP HTTP endpoint → CSV and signed link: builds CSV
mcp-server-optional/index.js - CSV and signed link → Cloud Storage: uploads and signs
mcp-server-optional/index.js