How to define and parse a dynamic JSON Body via AI Agent

Hello everyone,

I’m trying to set up an AI agent, which should dynamically construct a JSON in a specific schema and then parse it to the “Search Database” tool which does an HTTP Request. The configuration for the Body is:

This is the high-level structure of the workflow.

Information on your n8n setup

  • n8n version: latest cloud version as the admin upgraded yesterday
  • Running n8n via: n8n cloud

Has anyone done this before? This is needed because if I don’t use a dynamic JSON in the Body to filter out results, the information that is drawn from the table is too big for the model to process and I hit token limits.

Thanks,

You could define this JSON in the description of the input.

Sorry, I’m not following. I tried specifying the JSON in the description of the “Search Database” node but it didn’t work.
Can you possibly show me an example where this is done and the AI Agent handles queries dynamically in such a way through sending a dynamic JSON in the Body?

Thanks,

Provide an example of the JSON queries in the http tool description or the description of the json body itself (should be a “add description” button), the model doesnt know what JSON params are allowed, so plainly allowing it free reign will cause issues.