How do i get ai agent to search mongodb that is already indexed?

Describe the problem/error/question

How do i get an ai agent to reference mongodb? I have successfully added json data into mangodb and indexed it.

I want to be able to chat and say ‘ i want a 16gb HP laptop’ and have it give me the SKU based on the search parameters

What is the error message (if any)?

Please share your workflow

Expression in AI agent

ID: {{ $json._id }}
MMT Code: {{ $json['MMT Code'] }}
SKU: {{ $json.SKU }}
Manufacturer: {{ $json.Manufacturer }}
Category: {{ $json.Category }}
Description: {{ $json.Description }}
Cost: {{ $json.Cost }}
Stock: {{ $json.Stock }}

Work flow was too massive due to the pinned data

Share the output returned by the last node

Searching

Test data

screenshot of successful index data

Information on your n8n setup

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

you need to add mongodb as a tool.

like this:

Legend! Thank you that helped