I don’t think it was removed on purpose for tools specifically, it comes from how that field is defined. In the Postgres node the Query field is marked noDataExpression (it’s the SQL editor where you write {{ }} inline instead of flipping the field to Expression mode), and the editor only offers the “let the model define this” button on fields without that flag. So you won’t get the sparkle button on Query, but you can still use $fromAI() there.
Two ways to set it up:
1. Fixed SQL, model fills in only the values (what I’d do)
SELECT id, status, total
FROM orders
WHERE customer_email = $1
AND created_at >= $2
Then Add option → Query Parameters. That one is a normal string field, so the button shows up there, or type it yourself:
{{ $fromAI('customer_email', 'Email of the customer', 'string') }},{{ $fromAI('since', 'Start date in YYYY-MM-DD format', 'string') }}
The values are sent as query parameters, so they get escaped and the model can’t change the shape of the query.
2. Let the agent write the whole query
Type the expression straight into the Query editor:
{{ $fromAI('sql_query', 'One read-only PostgreSQL SELECT statement', 'string') }}
When the node is turned into a tool, n8n collects $fromAI() calls from all of its parameters, not only the ones that have the button, so sql_query still ends up in the tool’s input schema. If you go this way, give that credential a database user with read-only access to just the tables the agent needs, because the model can send anything that user is allowed to run.