I can see some issues in your User message. First, it didn’t add the INPUT information to your User message, so the AI does not know what you’re talking about, that’s why it’s replying, answering for the information.
You should create a User message where you add the input info, something like this:
Begin your generation, using the input information below:
{{ $json.output }}
Note: This is the output of your Merge1, so just click the field with the mouse and drag it to the User Message
—-------------
You also should inform the Model what is the definition of the input, so you should add at least the JSON fields the model would receive.
I’ll suggest you to add a System message and on the system message add all the basic instructions, input definition and tools used.
About tools, when you said “You have access to Google Sheets”. This instruction can be confused to the model, the best practices when using tools is to instruct the model to use the tool to access the Google Sheet, like this:
# Tools
- Google Sheet: Use this tool to access the Google Sheets with the information of…
Hope that helps!
Let me know if you have any other question, all the best!
The problem is because of the previous Merge Node.
Your data structure shows unmatched and allData, probably coming from separate branches. When you use a Merge Node, only the current item’s root $json is available — not both full branches unless they were properly merged.
You can explicitly reference data from both inputs like this:
{{ $input[1].json.allData[0].Kontonummer }}
{{ $input[1].json.allData[0].match }}
This avoids red expressions because it pins the reference to the correct input.
I see the problem, the issue is that {{ $json.unmatched.toJsonString() }} is not deeply serializing the objects, so the AI sees: [object Object], [object Object], …
This happens because toJsonString() doesn’t deeply expand nested arrays/objects unless they’re properly structured.
To pass a readable JSON array into the AI Agent, use the stringify() function instead, like this:
{{ JSON.stringify($json.unmatched, null, 2) }}
Other issue I saw in your screenshot is you’re using the INPUT information in both the USER and SYSTEM prompt. It doesn’t make much sense to send the input twice.
Just as a recap, the SYSTEM prompt should have the instructions to the model and the USER prompt the INPUT.
Also, there are many ways to merge the information on the Merge Node, take a look on the node documentation and see if the merge option you choose is the best option for your user case.
Merge Docs: Merge | n8n Docs