Selfcorrecting for AI Agents

The idea is:

Right now I have tool calling nodes that throw errors on rest apis if the structure is wrong.
However, the API does throw actually useful errors.
So my feature request would be (if it does not exist already), that it should be possible to give tool errors back to the Agent, so that the agent can actually respond to the problem instead of just breaking the whole flow.

My use case:

I use the HTTP Request Tool, to interact with the Microsoft Defender XDR Hunting API. This needs correctly formatted Kusto queries, and that is not always so simple for a model to achieve in one shot. But I think this could be a general feature to add for all tools, since a retry logic is never a bad idea.

I think it would be beneficial to add this because:

For me this is an integral part of what agents are for. They write something, they get an error, they try again with the new information.
Very similar to the Structured Output Parser

Any resources to support this?

Not really

Are you willing to work on this?

I have sadly no knowledge on the internas of N8N, but if someone is able to point me to where I should start I can definitely help with a pull request if necessary.

Sidenote

I am right now testing with subflow usage instead. Since I can then use the error handling of a normal node instead of a tool node.