Actions2
Custom SQL
AI-generatedSummary
Execute a custom SQL query on a PostgreSQL vector database using a single embedding vector as a parameter to perform vector operations such as similarity search.
Inputs
- agentDescription — Optional description to guide how the AI agent should use this tool.
- sqlQuery (required) — Custom SQL query string that must include a $1 placeholder for the embedding vector parameter.
- customOptions.debug — Enable detailed logging for troubleshooting by setting debug mode to true.
Output shape
a single JSON string representing the query result set
The SQL query must include exactly one parameter ($1) representing the embedding vector serialized as a JSON array string. The output is a JSON string formatted with indentation, containing the rows returned by the query. Errors will throw exceptions with descriptions. Debug logs are available when debug mode is enabled.
Examples
Example 1: Perform a vector similarity search with custom SQL
Specify the SQL query ordering rows by similarity to the provided embedding vector using the <=> operator, for example: SELECT * FROM n8n_vectors ORDER BY embedding <=> $1 LIMIT 10. Set debug mode to true to receive detailed execution logs.