fix(n8n): drop Add fields the v3 API does not accept, correct docs

The Add operation exposed app_id, includes, and excludes in Additional
Fields and forwarded them to POST /v3/memories/add/. None of the three
are declared on that endpoint's schema (they belong to MemoryInput, used
by POST /v1/memories/), so they were silently dropped by the server.

app_id was worse than a no-op: the entity-id guard accepted it as
satisfying "at least one entity id", so filling only App ID passed local
validation and then sent a v3 request carrying no scope v3 recognises.
The guard now requires User ID, Agent ID, or Run ID.

Docs corrections alongside it:
- Add: document Custom Instructions and Custom Categories, which the
  node has always supported but the docs never mentioned
- Get Many: document Return All, which the docs omitted entirely
- README: Infer and Wait for Completion are independent controls; the
  README claimed infer=false returns synchronously, contradicting the
  node's own field description and its actual behaviour
This commit is contained in:
kartik-mem0
2026-07-29 21:41:23 +05:30
parent aa939d00d4
commit 2a61fe1a32
3 changed files with 22 additions and 30 deletions
@@ -163,12 +163,6 @@ export class Mem0 implements INodeType {
type: 'string',
default: '',
},
{
displayName: 'App ID',
name: 'app_id',
type: 'string',
default: '',
},
{
displayName: 'Custom Categories',
name: 'custom_categories',
@@ -186,20 +180,6 @@ export class Mem0 implements INodeType {
description:
'Optional instructions that steer what the extractor keeps or ignores',
},
{
displayName: 'Excludes',
name: 'excludes',
type: 'string',
default: '',
description: 'Optional: skip memories matching this description',
},
{
displayName: 'Includes',
name: 'includes',
type: 'string',
default: '',
description: 'Optional: only extract memories matching this description',
},
{
displayName: 'Infer',
name: 'infer',
@@ -366,7 +346,6 @@ export class Mem0 implements INodeType {
const userId = this.getNodeParameter('userId', i, '') as string;
if (userId) body.user_id = userId;
if (addFields.agent_id) body.agent_id = addFields.agent_id;
if (addFields.app_id) body.app_id = addFields.app_id;
if (addFields.run_id) body.run_id = addFields.run_id;
if (addFields.metadata) {
try {
@@ -400,14 +379,11 @@ export class Mem0 implements INodeType {
}
}
if (addFields.includes) body.includes = addFields.includes;
if (addFields.excludes) body.excludes = addFields.excludes;
// API requires at least one entity id — fail clearly instead of a raw 4xx.
if (!body.user_id && !body.agent_id && !body.run_id && !body.app_id) {
if (!body.user_id && !body.agent_id && !body.run_id) {
throw new NodeOperationError(
this.getNode(),
'Add requires at least one of User ID, Agent ID, Run ID, or App ID',
'Add requires at least one of User ID, Agent ID, or Run ID',
{ itemIndex: i },
);
}