@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/dist/server.js CHANGED
@@ -1610,9 +1610,13 @@ async function handleSearchMemory(args, userId) {
1610
1610
  });
1611
1611
  return JSON.stringify(searchResult, null, 2);
1612
1612
  } catch (error) {
1613
- const errorMessage = error instanceof Error ? error.message : String(error);
1614
- logger.error("Failed to search memories:", { error: errorMessage, userId, query: args.query });
1615
- throw new Error(`Failed to search memories: ${errorMessage}`);
1613
+ handleToolError(error, {
1614
+ toolName: "remember_search_memory",
1615
+ operation: "search memories",
1616
+ userId,
1617
+ query: args.query,
1618
+ includeRelationships: args.include_relationships
1619
+ });
1616
1620
  }
1617
1621
  }
1618
1622
 
@@ -1686,8 +1690,13 @@ async function handleDeleteMemory(args, userId) {
1686
1690
  };
1687
1691
  return JSON.stringify(result, null, 2);
1688
1692
  } catch (error) {
1689
- logger.error("Failed to delete memory:", error);
1690
- throw new Error(`Failed to delete memory: ${error instanceof Error ? error.message : String(error)}`);
1693
+ handleToolError(error, {
1694
+ toolName: "remember_delete_memory",
1695
+ operation: "delete memory",
1696
+ userId,
1697
+ memoryId: args.memory_id,
1698
+ deleteRelationships: args.delete_relationships
1699
+ });
1691
1700
  }
1692
1701
  }
1693
1702
 
@@ -1865,23 +1874,14 @@ async function handleUpdateMemory(args, userId) {
1865
1874
  };
1866
1875
  return JSON.stringify(result, null, 2);
1867
1876
  } catch (error) {
1868
- const errorMessage = error instanceof Error ? error.message : String(error);
1869
- const errorStack = error instanceof Error ? error.stack : void 0;
1870
- logger.error("Failed to update memory:", {
1871
- error: errorMessage,
1872
- stack: errorStack,
1877
+ handleToolError(error, {
1878
+ toolName: "remember_update_memory",
1879
+ operation: "update memory",
1873
1880
  userId,
1874
1881
  memoryId: args.memory_id,
1875
- providedFields: Object.keys(args).filter((k) => k !== "memory_id")
1882
+ providedFields: Object.keys(args).filter((k) => k !== "memory_id").join(", "),
1883
+ updateCount: Object.keys(args).filter((k) => k !== "memory_id").length
1876
1884
  });
1877
- throw new Error(
1878
- `Failed to update memory: ${errorMessage}` + (errorStack ? `
1879
-
1880
- Stack trace:
1881
- ${errorStack}` : "") + `
1882
-
1883
- Context: userId=${userId}, memoryId=${args.memory_id}`
1884
- );
1885
1885
  }
1886
1886
  }
1887
1887
 
@@ -2005,8 +2005,14 @@ async function handleFindSimilar(args, userId) {
2005
2005
  };
2006
2006
  return JSON.stringify(result, null, 2);
2007
2007
  } catch (error) {
2008
- logger.error("Failed to find similar memories:", error);
2009
- throw new Error(`Failed to find similar memories: ${error instanceof Error ? error.message : String(error)}`);
2008
+ handleToolError(error, {
2009
+ toolName: "remember_find_similar",
2010
+ operation: "find similar memories",
2011
+ userId,
2012
+ memoryId: args.memory_id,
2013
+ searchText: args.text,
2014
+ limit: args.limit
2015
+ });
2010
2016
  }
2011
2017
  }
2012
2018
 
@@ -2168,8 +2174,13 @@ ${content}${tags}`;
2168
2174
  };
2169
2175
  return JSON.stringify(result, null, 2);
2170
2176
  } catch (error) {
2171
- logger.error("Failed to query memories:", error);
2172
- throw new Error(`Failed to query memories: ${error instanceof Error ? error.message : String(error)}`);
2177
+ handleToolError(error, {
2178
+ toolName: "remember_query_memory",
2179
+ operation: "query memories",
2180
+ userId,
2181
+ query: args.query,
2182
+ format: args.format
2183
+ });
2173
2184
  }
2174
2185
  }
2175
2186
 
@@ -2237,6 +2248,7 @@ async function handleCreateRelationship(args, userId, context) {
2237
2248
  }
2238
2249
  await ensureMemoryCollection(userId);
2239
2250
  const collection = getMemoryCollection(userId);
2251
+ logger.info("Validating memories", { userId, memoryIds: args.memory_ids });
2240
2252
  const memoryChecks = await Promise.all(
2241
2253
  args.memory_ids.map(async (memoryId) => {
2242
2254
  try {
@@ -2244,12 +2256,23 @@ async function handleCreateRelationship(args, userId, context) {
2244
2256
  returnProperties: ["user_id", "doc_type", "relationships"]
2245
2257
  });
2246
2258
  if (!memory) {
2259
+ logger.warn("Memory not found", { userId, memoryId });
2247
2260
  return { memoryId, error: "Memory not found" };
2248
2261
  }
2249
2262
  if (memory.properties.user_id !== userId) {
2263
+ logger.warn("Unauthorized memory access attempt", {
2264
+ userId,
2265
+ memoryId,
2266
+ actualUserId: memory.properties.user_id
2267
+ });
2250
2268
  return { memoryId, error: "Unauthorized: Memory belongs to another user" };
2251
2269
  }
2252
2270
  if (memory.properties.doc_type !== "memory") {
2271
+ logger.warn("Invalid doc_type for relationship", {
2272
+ userId,
2273
+ memoryId,
2274
+ docType: memory.properties.doc_type
2275
+ });
2253
2276
  return { memoryId, error: "Cannot create relationship with non-memory document" };
2254
2277
  }
2255
2278
  return {
@@ -2258,15 +2281,30 @@ async function handleCreateRelationship(args, userId, context) {
2258
2281
  relationships: memory.properties.relationships || []
2259
2282
  };
2260
2283
  } catch (error) {
2261
- return { memoryId, error: `Failed to fetch memory: ${error}` };
2284
+ const errorMsg = error instanceof Error ? error.message : String(error);
2285
+ logger.error("Failed to fetch memory for relationship", {
2286
+ userId,
2287
+ memoryId,
2288
+ error: errorMsg
2289
+ });
2290
+ return { memoryId, error: `Failed to fetch memory: ${errorMsg}` };
2262
2291
  }
2263
2292
  })
2264
2293
  );
2265
2294
  const errors = memoryChecks.filter((check) => check.error);
2266
2295
  if (errors.length > 0) {
2267
2296
  const errorMessages = errors.map((e) => `${e.memoryId}: ${e.error}`).join("; ");
2297
+ logger.error("Memory validation failed", {
2298
+ userId,
2299
+ errorCount: errors.length,
2300
+ errors: errorMessages
2301
+ });
2268
2302
  throw new Error(`Memory validation failed: ${errorMessages}`);
2269
2303
  }
2304
+ logger.info("All memories validated successfully", {
2305
+ userId,
2306
+ validatedCount: memoryChecks.length
2307
+ });
2270
2308
  const now = (/* @__PURE__ */ new Date()).toISOString();
2271
2309
  const relationship = {
2272
2310
  // Core identity
@@ -2339,8 +2377,16 @@ async function handleCreateRelationship(args, userId, context) {
2339
2377
  };
2340
2378
  return JSON.stringify(response, null, 2);
2341
2379
  } catch (error) {
2342
- logger.error("Failed to create relationship:", error);
2343
- throw new Error(`Failed to create relationship: ${error instanceof Error ? error.message : String(error)}`);
2380
+ handleToolError(error, {
2381
+ toolName: "remember_create_relationship",
2382
+ operation: "create relationship",
2383
+ userId,
2384
+ memoryIds: args.memory_ids.join(", "),
2385
+ memoryCount: args.memory_ids.length,
2386
+ relationshipType: args.relationship_type,
2387
+ observation: args.observation?.substring(0, 100)
2388
+ // First 100 chars
2389
+ });
2344
2390
  }
2345
2391
  }
2346
2392
 
@@ -2463,12 +2509,18 @@ async function handleUpdateRelationship(args, userId) {
2463
2509
  };
2464
2510
  return JSON.stringify(result, null, 2);
2465
2511
  } catch (error) {
2466
- logger.error("Failed to update relationship:", error);
2467
- throw new Error(`Failed to update relationship: ${error instanceof Error ? error.message : String(error)}`);
2512
+ handleToolError(error, {
2513
+ toolName: "remember_update_relationship",
2514
+ operation: "update relationship",
2515
+ userId,
2516
+ relationshipId: args.relationship_id,
2517
+ updatedFields: Object.keys(args).filter((k) => k !== "relationship_id")
2518
+ });
2468
2519
  }
2469
2520
  }
2470
2521
 
2471
2522
  // src/tools/search-relationship.ts
2523
+ import { Filters as Filters2 } from "weaviate-client";
2472
2524
  var searchRelationshipTool = {
2473
2525
  name: "remember_search_relationship",
2474
2526
  description: `Search relationships by observation text or relationship type.
@@ -2536,63 +2588,46 @@ async function handleSearchRelationship(args, userId) {
2536
2588
  const collection = getMemoryCollection(userId);
2537
2589
  const limit = args.limit ?? 10;
2538
2590
  const offset = args.offset ?? 0;
2539
- const whereFilters = [
2540
- {
2541
- path: "doc_type",
2542
- operator: "Equal",
2543
- valueText: "relationship"
2544
- }
2545
- ];
2591
+ const filterList = [];
2592
+ filterList.push(
2593
+ collection.filter.byProperty("doc_type").equal("relationship")
2594
+ );
2546
2595
  if (args.relationship_types && args.relationship_types.length > 0) {
2547
2596
  if (args.relationship_types.length === 1) {
2548
- whereFilters.push({
2549
- path: "relationship_type",
2550
- operator: "Equal",
2551
- valueText: args.relationship_types[0]
2552
- });
2597
+ filterList.push(
2598
+ collection.filter.byProperty("relationship_type").equal(args.relationship_types[0])
2599
+ );
2553
2600
  } else {
2554
- whereFilters.push({
2555
- operator: "Or",
2556
- operands: args.relationship_types.map((type) => ({
2557
- path: "relationship_type",
2558
- operator: "Equal",
2559
- valueText: type
2560
- }))
2561
- });
2601
+ const typeFilters = args.relationship_types.map(
2602
+ (type) => collection.filter.byProperty("relationship_type").equal(type)
2603
+ );
2604
+ filterList.push(Filters2.or(...typeFilters));
2562
2605
  }
2563
2606
  }
2564
2607
  if (args.strength_min !== void 0) {
2565
- whereFilters.push({
2566
- path: "strength",
2567
- operator: "GreaterThanEqual",
2568
- valueNumber: args.strength_min
2569
- });
2608
+ filterList.push(
2609
+ collection.filter.byProperty("strength").greaterOrEqual(args.strength_min)
2610
+ );
2570
2611
  }
2571
2612
  if (args.confidence_min !== void 0) {
2572
- whereFilters.push({
2573
- path: "confidence",
2574
- operator: "GreaterThanEqual",
2575
- valueNumber: args.confidence_min
2576
- });
2613
+ filterList.push(
2614
+ collection.filter.byProperty("confidence").greaterOrEqual(args.confidence_min)
2615
+ );
2577
2616
  }
2578
2617
  if (args.tags && args.tags.length > 0) {
2579
- whereFilters.push({
2580
- path: "tags",
2581
- operator: "ContainsAny",
2582
- valueTextArray: args.tags
2583
- });
2618
+ filterList.push(
2619
+ collection.filter.byProperty("tags").containsAny(args.tags)
2620
+ );
2584
2621
  }
2622
+ const combinedFilters = filterList.length > 1 ? Filters2.and(...filterList) : filterList[0];
2585
2623
  const searchOptions = {
2586
2624
  alpha: 1,
2587
2625
  // Pure semantic search for relationships
2588
2626
  limit: limit + offset
2589
2627
  // Get extra for offset
2590
2628
  };
2591
- if (whereFilters.length > 0) {
2592
- searchOptions.filters = whereFilters.length > 1 ? {
2593
- operator: "And",
2594
- operands: whereFilters
2595
- } : whereFilters[0];
2629
+ if (combinedFilters) {
2630
+ searchOptions.filters = combinedFilters;
2596
2631
  }
2597
2632
  const results = await collection.query.hybrid(args.query, searchOptions);
2598
2633
  const paginatedResults = results.objects.slice(offset, offset + limit);
@@ -2628,8 +2663,13 @@ async function handleSearchRelationship(args, userId) {
2628
2663
  };
2629
2664
  return JSON.stringify(result, null, 2);
2630
2665
  } catch (error) {
2631
- logger.error("Failed to search relationships:", error);
2632
- throw new Error(`Failed to search relationships: ${error instanceof Error ? error.message : String(error)}`);
2666
+ handleToolError(error, {
2667
+ toolName: "remember_search_relationship",
2668
+ operation: "search relationships",
2669
+ userId,
2670
+ query: args.query,
2671
+ limit: args.limit
2672
+ });
2633
2673
  }
2634
2674
  }
2635
2675
 
@@ -2730,8 +2770,12 @@ async function handleDeleteRelationship(args, userId) {
2730
2770
  };
2731
2771
  return JSON.stringify(result, null, 2);
2732
2772
  } catch (error) {
2733
- logger.error("Failed to delete relationship:", error);
2734
- throw new Error(`Failed to delete relationship: ${error instanceof Error ? error.message : String(error)}`);
2773
+ handleToolError(error, {
2774
+ toolName: "remember_delete_relationship",
2775
+ operation: "delete relationship",
2776
+ userId,
2777
+ relationshipId: args.relationship_id
2778
+ });
2735
2779
  }
2736
2780
  }
2737
2781
 
@@ -3101,8 +3145,12 @@ async function handleSetPreference(args, userId) {
3101
3145
  logger.info("Preferences set successfully", { userId });
3102
3146
  return JSON.stringify(result, null, 2);
3103
3147
  } catch (error) {
3104
- logger.error("Failed to set preferences:", error);
3105
- throw new Error(`Failed to set preferences: ${error instanceof Error ? error.message : String(error)}`);
3148
+ handleToolError(error, {
3149
+ toolName: "remember_set_preference",
3150
+ operation: "set preference",
3151
+ userId,
3152
+ preferencesProvided: Object.keys(args.preferences || {}).length
3153
+ });
3106
3154
  }
3107
3155
  }
3108
3156
 
@@ -3158,8 +3206,12 @@ async function handleGetPreferences(args, userId) {
3158
3206
  logger.info("Preferences retrieved successfully", { userId, category, isDefault });
3159
3207
  return JSON.stringify(response, null, 2);
3160
3208
  } catch (error) {
3161
- logger.error("Failed to get preferences:", error);
3162
- throw new Error(`Failed to get preferences: ${error instanceof Error ? error.message : String(error)}`);
3209
+ handleToolError(error, {
3210
+ toolName: "remember_get_preferences",
3211
+ operation: "get preferences",
3212
+ userId,
3213
+ category: args.category
3214
+ });
3163
3215
  }
3164
3216
  }
3165
3217
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prmichaelsen/remember-mcp",
3
- "version": "2.0.2",
3
+ "version": "2.0.4",
4
4
  "description": "Multi-tenant memory system MCP server with vector search and relationships",
5
5
  "main": "dist/server.js",
6
6
  "type": "module",
@@ -6,6 +6,7 @@
6
6
  import type { Relationship, MemoryContext } from '../types/memory.js';
7
7
  import { ensureMemoryCollection, 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_create_relationship
@@ -110,6 +111,8 @@ export async function handleCreateRelationship(
110
111
  const collection = getMemoryCollection(userId);
111
112
 
112
113
  // Verify all memories exist and belong to user
114
+ logger.info('Validating memories', { userId, memoryIds: args.memory_ids });
115
+
113
116
  const memoryChecks = await Promise.all(
114
117
  args.memory_ids.map(async (memoryId) => {
115
118
  try {
@@ -118,24 +121,41 @@ export async function handleCreateRelationship(
118
121
  });
119
122
 
120
123
  if (!memory) {
124
+ logger.warn('Memory not found', { userId, memoryId });
121
125
  return { memoryId, error: 'Memory not found' };
122
126
  }
123
127
 
124
128
  if (memory.properties.user_id !== userId) {
129
+ logger.warn('Unauthorized memory access attempt', {
130
+ userId,
131
+ memoryId,
132
+ actualUserId: memory.properties.user_id
133
+ });
125
134
  return { memoryId, error: 'Unauthorized: Memory belongs to another user' };
126
135
  }
127
136
 
128
137
  if (memory.properties.doc_type !== 'memory') {
138
+ logger.warn('Invalid doc_type for relationship', {
139
+ userId,
140
+ memoryId,
141
+ docType: memory.properties.doc_type
142
+ });
129
143
  return { memoryId, error: 'Cannot create relationship with non-memory document' };
130
144
  }
131
145
 
132
- return {
133
- memoryId,
146
+ return {
147
+ memoryId,
134
148
  memory,
135
149
  relationships: (memory.properties.relationships as string[]) || []
136
150
  };
137
151
  } catch (error) {
138
- return { memoryId, error: `Failed to fetch memory: ${error}` };
152
+ const errorMsg = error instanceof Error ? error.message : String(error);
153
+ logger.error('Failed to fetch memory for relationship', {
154
+ userId,
155
+ memoryId,
156
+ error: errorMsg
157
+ });
158
+ return { memoryId, error: `Failed to fetch memory: ${errorMsg}` };
139
159
  }
140
160
  })
141
161
  );
@@ -144,8 +164,18 @@ export async function handleCreateRelationship(
144
164
  const errors = memoryChecks.filter(check => check.error);
145
165
  if (errors.length > 0) {
146
166
  const errorMessages = errors.map(e => `${e.memoryId}: ${e.error}`).join('; ');
167
+ logger.error('Memory validation failed', {
168
+ userId,
169
+ errorCount: errors.length,
170
+ errors: errorMessages
171
+ });
147
172
  throw new Error(`Memory validation failed: ${errorMessages}`);
148
173
  }
174
+
175
+ logger.info('All memories validated successfully', {
176
+ userId,
177
+ validatedCount: memoryChecks.length
178
+ });
149
179
 
150
180
  // Build relationship object
151
181
  const now = new Date().toISOString();
@@ -239,7 +269,14 @@ export async function handleCreateRelationship(
239
269
 
240
270
  return JSON.stringify(response, null, 2);
241
271
  } catch (error) {
242
- logger.error('Failed to create relationship:', error);
243
- throw new Error(`Failed to create relationship: ${error instanceof Error ? error.message : String(error)}`);
272
+ handleToolError(error, {
273
+ toolName: 'remember_create_relationship',
274
+ operation: 'create relationship',
275
+ userId,
276
+ memoryIds: args.memory_ids.join(', '),
277
+ memoryCount: args.memory_ids.length,
278
+ relationshipType: args.relationship_type,
279
+ observation: args.observation?.substring(0, 100), // First 100 chars
280
+ });
244
281
  }
245
282
  }
@@ -5,6 +5,7 @@
5
5
 
6
6
  import { getMemoryCollection } from '../weaviate/schema.js';
7
7
  import { logger } from '../utils/logger.js';
8
+ import { handleToolError } from '../utils/error-handler.js';
8
9
 
9
10
  /**
10
11
  * Tool definition for remember_delete_memory
@@ -120,7 +121,12 @@ export async function handleDeleteMemory(
120
121
 
121
122
  return JSON.stringify(result, null, 2);
122
123
  } catch (error) {
123
- logger.error('Failed to delete memory:', error);
124
- throw new Error(`Failed to delete memory: ${error instanceof Error ? error.message : String(error)}`);
124
+ handleToolError(error, {
125
+ toolName: 'remember_delete_memory',
126
+ operation: 'delete memory',
127
+ userId,
128
+ memoryId: args.memory_id,
129
+ deleteRelationships: args.delete_relationships,
130
+ });
125
131
  }
126
132
  }
@@ -5,6 +5,7 @@
5
5
 
6
6
  import { getMemoryCollection } from '../weaviate/schema.js';
7
7
  import { logger } from '../utils/logger.js';
8
+ import { handleToolError } from '../utils/error-handler.js';
8
9
 
9
10
  /**
10
11
  * Tool definition for remember_delete_relationship
@@ -154,7 +155,11 @@ export async function handleDeleteRelationship(
154
155
 
155
156
  return JSON.stringify(result, null, 2);
156
157
  } catch (error) {
157
- logger.error('Failed to delete relationship:', error);
158
- throw new Error(`Failed to delete relationship: ${error instanceof Error ? error.message : String(error)}`);
158
+ handleToolError(error, {
159
+ toolName: 'remember_delete_relationship',
160
+ operation: 'delete relationship',
161
+ userId,
162
+ relationshipId: args.relationship_id,
163
+ });
159
164
  }
160
165
  }
@@ -6,6 +6,7 @@
6
6
  import type { Memory } 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_find_similar
@@ -193,7 +194,13 @@ export async function handleFindSimilar(
193
194
 
194
195
  return JSON.stringify(result, null, 2);
195
196
  } catch (error) {
196
- logger.error('Failed to find similar memories:', error);
197
- throw new Error(`Failed to find similar memories: ${error instanceof Error ? error.message : String(error)}`);
197
+ handleToolError(error, {
198
+ toolName: 'remember_find_similar',
199
+ operation: 'find similar memories',
200
+ userId,
201
+ memoryId: args.memory_id,
202
+ searchText: args.text,
203
+ limit: args.limit,
204
+ });
198
205
  }
199
206
  }
@@ -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
  PreferenceCategory,
@@ -105,7 +106,11 @@ export async function handleGetPreferences(
105
106
 
106
107
  return JSON.stringify(response, null, 2);
107
108
  } catch (error) {
108
- logger.error('Failed to get preferences:', error);
109
- throw new Error(`Failed to get preferences: ${error instanceof Error ? error.message : String(error)}`);
109
+ handleToolError(error, {
110
+ toolName: 'remember_get_preferences',
111
+ operation: 'get preferences',
112
+ userId,
113
+ category: args.category,
114
+ });
110
115
  }
111
116
  }
@@ -6,6 +6,7 @@
6
6
  import type { Memory, SearchFilters } 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
  import { buildCombinedSearchFilters } from '../utils/weaviate-filters.js';
10
11
 
11
12
  /**
@@ -231,7 +232,12 @@ export async function handleQueryMemory(
231
232
 
232
233
  return JSON.stringify(result, null, 2);
233
234
  } catch (error) {
234
- logger.error('Failed to query memories:', error);
235
- throw new Error(`Failed to query memories: ${error instanceof Error ? error.message : String(error)}`);
235
+ handleToolError(error, {
236
+ toolName: 'remember_query_memory',
237
+ operation: 'query memories',
238
+ userId,
239
+ query: args.query,
240
+ format: args.format,
241
+ });
236
242
  }
237
243
  }
@@ -6,6 +6,7 @@
6
6
  import type { Memory, Relationship, SearchOptions, SearchResult, SearchFilters } 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
  import { buildCombinedSearchFilters, buildMemoryOnlyFilters } from '../utils/weaviate-filters.js';
10
11
 
11
12
  /**
@@ -191,8 +192,12 @@ export async function handleSearchMemory(
191
192
 
192
193
  return JSON.stringify(searchResult, null, 2);
193
194
  } catch (error) {
194
- const errorMessage = error instanceof Error ? error.message : String(error);
195
- logger.error('Failed to search memories:', { error: errorMessage, userId, query: args.query });
196
- throw new Error(`Failed to search memories: ${errorMessage}`);
195
+ handleToolError(error, {
196
+ toolName: 'remember_search_memory',
197
+ operation: 'search memories',
198
+ userId,
199
+ query: args.query,
200
+ includeRelationships: args.include_relationships,
201
+ });
197
202
  }
198
203
  }