@prmichaelsen/remember-mcp 2.0.2 → 2.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/README.md +68 -7
- package/agent/progress.yaml +70 -3
- package/agent/tasks/task-22-comprehensive-error-handling.md +218 -0
- package/agent/tasks/task-23-fix-relationship-creation-errors.md +97 -0
- package/agent/tasks/task-24-fix-weaviate-filter-path-error.md +132 -0
- package/agent/tasks/task-25-fix-update-memory-errors.md +116 -0
- package/dist/server-factory.js +128 -76
- package/dist/server.js +128 -76
- package/package.json +1 -1
- package/src/tools/create-relationship.ts +42 -5
- package/src/tools/delete-memory.ts +8 -2
- package/src/tools/delete-relationship.ts +7 -2
- package/src/tools/find-similar.ts +9 -2
- package/src/tools/get-preferences.ts +7 -2
- package/src/tools/query-memory.ts +8 -2
- package/src/tools/search-memory.ts +8 -3
- package/src/tools/search-relationship.ts +44 -47
- package/src/tools/set-preference.ts +7 -2
- package/src/tools/update-memory.ts +5 -14
- package/src/tools/update-relationship.ts +8 -2
|
@@ -3,9 +3,11 @@
|
|
|
3
3
|
* Search relationships by observation text or type
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
+
import { Filters } from 'weaviate-client';
|
|
6
7
|
import type { Relationship } from '../types/memory.js';
|
|
7
8
|
import { getMemoryCollection } from '../weaviate/schema.js';
|
|
8
9
|
import { logger } from '../utils/logger.js';
|
|
10
|
+
import { handleToolError } from '../utils/error-handler.js';
|
|
9
11
|
|
|
10
12
|
/**
|
|
11
13
|
* Tool definition for remember_search_relationship
|
|
@@ -100,84 +102,74 @@ export async function handleSearchRelationship(
|
|
|
100
102
|
userId: string
|
|
101
103
|
): Promise<string> {
|
|
102
104
|
try {
|
|
103
|
-
logger.info('Searching relationships', {
|
|
104
|
-
userId,
|
|
105
|
+
logger.info('Searching relationships', {
|
|
106
|
+
userId,
|
|
105
107
|
query: args.query,
|
|
106
|
-
types: args.relationship_types
|
|
108
|
+
types: args.relationship_types
|
|
107
109
|
});
|
|
108
110
|
|
|
109
111
|
const collection = getMemoryCollection(userId);
|
|
110
112
|
const limit = args.limit ?? 10;
|
|
111
113
|
const offset = args.offset ?? 0;
|
|
112
114
|
|
|
113
|
-
// Build
|
|
114
|
-
const
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
];
|
|
115
|
+
// Build filters using Weaviate v3 API
|
|
116
|
+
const filterList: any[] = [];
|
|
117
|
+
|
|
118
|
+
// Always filter by doc_type = 'relationship'
|
|
119
|
+
filterList.push(
|
|
120
|
+
collection.filter.byProperty('doc_type').equal('relationship')
|
|
121
|
+
);
|
|
121
122
|
|
|
122
123
|
// Add relationship type filter
|
|
123
124
|
if (args.relationship_types && args.relationship_types.length > 0) {
|
|
124
125
|
if (args.relationship_types.length === 1) {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
valueText: args.relationship_types[0],
|
|
129
|
-
});
|
|
126
|
+
filterList.push(
|
|
127
|
+
collection.filter.byProperty('relationship_type').equal(args.relationship_types[0])
|
|
128
|
+
);
|
|
130
129
|
} else {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
valueText: type,
|
|
137
|
-
})),
|
|
138
|
-
});
|
|
130
|
+
// Multiple types: use OR logic
|
|
131
|
+
const typeFilters = args.relationship_types.map(type =>
|
|
132
|
+
collection.filter.byProperty('relationship_type').equal(type)
|
|
133
|
+
);
|
|
134
|
+
filterList.push(Filters.or(...typeFilters));
|
|
139
135
|
}
|
|
140
136
|
}
|
|
141
137
|
|
|
142
138
|
// Add strength filter
|
|
143
139
|
if (args.strength_min !== undefined) {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
valueNumber: args.strength_min,
|
|
148
|
-
});
|
|
140
|
+
filterList.push(
|
|
141
|
+
collection.filter.byProperty('strength').greaterOrEqual(args.strength_min)
|
|
142
|
+
);
|
|
149
143
|
}
|
|
150
144
|
|
|
151
145
|
// Add confidence filter
|
|
152
146
|
if (args.confidence_min !== undefined) {
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
valueNumber: args.confidence_min,
|
|
157
|
-
});
|
|
147
|
+
filterList.push(
|
|
148
|
+
collection.filter.byProperty('confidence').greaterOrEqual(args.confidence_min)
|
|
149
|
+
);
|
|
158
150
|
}
|
|
159
151
|
|
|
160
152
|
// Add tags filter
|
|
161
153
|
if (args.tags && args.tags.length > 0) {
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
valueTextArray: args.tags,
|
|
166
|
-
});
|
|
154
|
+
filterList.push(
|
|
155
|
+
collection.filter.byProperty('tags').containsAny(args.tags)
|
|
156
|
+
);
|
|
167
157
|
}
|
|
168
158
|
|
|
159
|
+
// Combine all filters with AND logic
|
|
160
|
+
const combinedFilters = filterList.length > 1
|
|
161
|
+
? Filters.and(...filterList)
|
|
162
|
+
: filterList[0];
|
|
163
|
+
|
|
169
164
|
// Build search options
|
|
170
165
|
const searchOptions: any = {
|
|
171
166
|
alpha: 1.0, // Pure semantic search for relationships
|
|
172
167
|
limit: limit + offset, // Get extra for offset
|
|
173
168
|
};
|
|
174
169
|
|
|
175
|
-
// Add filters
|
|
176
|
-
if (
|
|
177
|
-
searchOptions.filters =
|
|
178
|
-
operator: 'And' as const,
|
|
179
|
-
operands: whereFilters,
|
|
180
|
-
} : whereFilters[0];
|
|
170
|
+
// Add filters
|
|
171
|
+
if (combinedFilters) {
|
|
172
|
+
searchOptions.filters = combinedFilters;
|
|
181
173
|
}
|
|
182
174
|
|
|
183
175
|
// Perform hybrid search (semantic search on observation field)
|
|
@@ -222,7 +214,12 @@ export async function handleSearchRelationship(
|
|
|
222
214
|
|
|
223
215
|
return JSON.stringify(result, null, 2);
|
|
224
216
|
} catch (error) {
|
|
225
|
-
|
|
226
|
-
|
|
217
|
+
handleToolError(error, {
|
|
218
|
+
toolName: 'remember_search_relationship',
|
|
219
|
+
operation: 'search relationships',
|
|
220
|
+
userId,
|
|
221
|
+
query: args.query,
|
|
222
|
+
limit: args.limit,
|
|
223
|
+
});
|
|
227
224
|
}
|
|
228
225
|
}
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
import { PreferencesDatabaseService } from '../services/preferences-database.service.js';
|
|
7
7
|
import { logger } from '../utils/logger.js';
|
|
8
|
+
import { handleToolError } from '../utils/error-handler.js';
|
|
8
9
|
import {
|
|
9
10
|
UserPreferences,
|
|
10
11
|
getPreferenceDescription,
|
|
@@ -139,7 +140,11 @@ export async function handleSetPreference(
|
|
|
139
140
|
|
|
140
141
|
return JSON.stringify(result, null, 2);
|
|
141
142
|
} catch (error) {
|
|
142
|
-
|
|
143
|
-
|
|
143
|
+
handleToolError(error, {
|
|
144
|
+
toolName: 'remember_set_preference',
|
|
145
|
+
operation: 'set preference',
|
|
146
|
+
userId,
|
|
147
|
+
preferencesProvided: Object.keys(args.preferences || {}).length,
|
|
148
|
+
});
|
|
144
149
|
}
|
|
145
150
|
}
|
|
@@ -249,22 +249,13 @@ export async function handleUpdateMemory(
|
|
|
249
249
|
|
|
250
250
|
return JSON.stringify(result, null, 2);
|
|
251
251
|
} catch (error) {
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
logger.error('Failed to update memory:', {
|
|
256
|
-
error: errorMessage,
|
|
257
|
-
stack: errorStack,
|
|
252
|
+
handleToolError(error, {
|
|
253
|
+
toolName: 'remember_update_memory',
|
|
254
|
+
operation: 'update memory',
|
|
258
255
|
userId,
|
|
259
256
|
memoryId: args.memory_id,
|
|
260
|
-
providedFields: Object.keys(args).filter(k => k !== 'memory_id'),
|
|
257
|
+
providedFields: Object.keys(args).filter(k => k !== 'memory_id').join(', '),
|
|
258
|
+
updateCount: Object.keys(args).filter(k => k !== 'memory_id').length,
|
|
261
259
|
});
|
|
262
|
-
|
|
263
|
-
// Include detailed error information for debugging
|
|
264
|
-
throw new Error(
|
|
265
|
-
`Failed to update memory: ${errorMessage}` +
|
|
266
|
-
(errorStack ? `\n\nStack trace:\n${errorStack}` : '') +
|
|
267
|
-
`\n\nContext: userId=${userId}, memoryId=${args.memory_id}`
|
|
268
|
-
);
|
|
269
260
|
}
|
|
270
261
|
}
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
import type { RelationshipUpdate } from '../types/memory.js';
|
|
7
7
|
import { getMemoryCollection } from '../weaviate/schema.js';
|
|
8
8
|
import { logger } from '../utils/logger.js';
|
|
9
|
+
import { handleToolError } from '../utils/error-handler.js';
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* Tool definition for remember_update_relationship
|
|
@@ -183,7 +184,12 @@ export async function handleUpdateRelationship(
|
|
|
183
184
|
|
|
184
185
|
return JSON.stringify(result, null, 2);
|
|
185
186
|
} catch (error) {
|
|
186
|
-
|
|
187
|
-
|
|
187
|
+
handleToolError(error, {
|
|
188
|
+
toolName: 'remember_update_relationship',
|
|
189
|
+
operation: 'update relationship',
|
|
190
|
+
userId,
|
|
191
|
+
relationshipId: args.relationship_id,
|
|
192
|
+
updatedFields: Object.keys(args).filter(k => k !== 'relationship_id'),
|
|
193
|
+
});
|
|
188
194
|
}
|
|
189
195
|
}
|