Cross ref community ticket:
https://community.n8n.io/t/how-to-include-metadata-i…nside-ai-agent-response/188216
## Describe the problem/error/question
Two ways to connect PGVector store:
- (1) AI Agent - PGVector Store tool
- (2) AI Agent - Answer questions with a vector store tool - PGVector Store
<img width="821" height="1018" alt="Image" src="https://github.com/user-attachments/assets/7496d701-2fac-4b03-93b3-a3868a6670f6" />
in both cases, the node is `@n8n/n8n-nodes-langchain.vectorStorePGVector` (v1.3 atm).
The difference in JSON is only in the connection type - one is connected as `ai_tool` and another one as `ai_vectorStore`:
```
"Postgres PGVector Store": {
"ai_tool": [
[
{
"node": "AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
```
```
"Postgres PGVector Store1": {
"ai_vectorStore": [
[
{
"node": "Answer questions with a vector store",
"type": "ai_vectorStore",
"index": 0
}
]
]
}
```
When opening node configuration, ai tool has a setting to include metadata for retrieved chunks:
<img width="782" height="733" alt="Image" src="https://github.com/user-attachments/assets/d2e26682-493a-4cc4-b04a-99907f55b88f" />
the same node connected as ai_vectorStore lacks this feature:
<img width="779" height="519" alt="Image" src="https://github.com/user-attachments/assets/5de16e9e-bd76-430c-8111-45aaec2f55f8" />
## What is the error message (if any)?
## Please share your workflow/screenshots/recording
```
{
"nodes": [
{
"parameters": {
"options": {
"systemMessage": "=You are a helpful assistant, who can help users with answering questions.\n\nLocale: {{ $json.metadata.locale }}.\n\nUse locale for answer languages:\n- for \"/ca/en\" and \"/us/en\" answer in English\n- for \"/ua/ua\" answer in Ukrainian"
}
},
"type": "@n8n/n8n-nodes-langchain.agent",
"typeVersion": 2.2,
"position": [
-296,
16
],
"id": "463ae558-81d5-47d5-8df6-c2c17216550f",
"name": "AI Agent"
},
{
"parameters": {
"mode": "retrieve-as-tool",
"toolDescription": "hello github!",
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.vectorStorePGVector",
"typeVersion": 1.3,
"position": [
-512,
240
],
"id": "77053dde-8c87-46f4-8737-ed77d9d231b0",
"name": "Postgres PGVector Store",
"credentials": {
"postgres": {
"id": "Ew9emjWbv0eFURt2",
"name": "Postgres account"
}
}
},
{
"parameters": {},
"type": "@n8n/n8n-nodes-langchain.toolVectorStore",
"typeVersion": 1.1,
"position": [
-160,
240
],
"id": "26bc79ee-3a82-450e-b399-878aa7b3ea6b",
"name": "Answer questions with a vector store"
},
{
"parameters": {
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.vectorStorePGVector",
"typeVersion": 1.3,
"position": [
-264,
448
],
"id": "12ed195a-195f-45ee-ac73-51e315856bc2",
"name": "Postgres PGVector Store1",
"credentials": {
"postgres": {
"id": "Ew9emjWbv0eFURt2",
"name": "Postgres account"
}
}
},
{
"parameters": {
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
"typeVersion": 1.2,
"position": [
-184,
656
],
"id": "5402f001-18a8-466b-8bb2-73b73c2a2bc2",
"name": "Embeddings OpenAI",
"credentials": {
"openAiApi": {
"id": "KaC9RLJhAWVyQE8j",
"name": "OpenAi account"
}
}
},
{
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4.1-mini"
},
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"typeVersion": 1.2,
"position": [
24,
448
],
"id": "dc1d38b6-0301-4230-be36-d794fa77ce0e",
"name": "OpenAI Chat Model",
"credentials": {
"openAiApi": {
"id": "KaC9RLJhAWVyQE8j",
"name": "OpenAi account"
}
}
},
{
"parameters": {
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
"typeVersion": 1.2,
"position": [
-432,
448
],
"id": "2ee02dc4-6947-48b1-acd6-892c014dc098",
"name": "Embeddings OpenAI1",
"credentials": {
"openAiApi": {
"id": "KaC9RLJhAWVyQE8j",
"name": "OpenAi account"
}
}
}
],
"connections": {
"Postgres PGVector Store": {
"ai_tool": [
[
{
"node": "AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Answer questions with a vector store": {
"ai_tool": [
[
{
"node": "AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Postgres PGVector Store1": {
"ai_vectorStore": [
[
{
"node": "Answer questions with a vector store",
"type": "ai_vectorStore",
"index": 0
}
]
]
},
"Embeddings OpenAI": {
"ai_embedding": [
[
{
"node": "Postgres PGVector Store1",
"type": "ai_embedding",
"index": 0
}
]
]
},
"OpenAI Chat Model": {
"ai_languageModel": [
[
{
"node": "Answer questions with a vector store",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Embeddings OpenAI1": {
"ai_embedding": [
[
{
"node": "Postgres PGVector Store",
"type": "ai_embedding",
"index": 0
}
]
]
}
},
"pinData": {},
"meta": {
"templateCredsSetupCompleted": true,
"instanceId": "9423335a0111216c302866f5fc1752af6da6042c706e1cc46ecd439bca874130"
}
}
```
## Share the output returned by the last node
N/A
## Debug info
### core
- n8nVersion: 1.110.1
- platform: docker (self-hosted)
- nodeJsVersion: 22.19.0
- database: postgres
- executionMode: regular
- concurrency: -1
- license: enterprise (production)
### storage
- success: all
- error: all
- progress: false
- manual: true
- binaryMode: filesystem
### pruning
- enabled: true
- maxAge: 336 hours
- maxCount: 10000 executions
### client
- userAgent: mozilla/5.0 (macintosh; intel mac os x 10_15_7) applewebkit/537.36 (khtml, like gecko) chrome/140.0.0.0 safari/537.36
- isTouchDevice: false
Generated at: 2025-09-15T02:53:21.683Z