MCPcopy
hub / github.com/RedPlanetHQ/core / searchEntities

Function searchEntities

apps/webapp/app/services/vectorStorage.server.ts:492–518  ·  view source on GitHub ↗
(params: {
  queryVector: number[];
  userId: string;
  workspaceId: string;
  threshold?: number;
  limit?: number;
  excludeIds?: string[];
})

Source from the content-addressed store, hash-verified

490 * Search for similar entities by vector similarity
491 */
492export async function searchEntities(params: {
493 queryVector: number[];
494 userId: string;
495 workspaceId: string;
496 threshold?: number;
497 limit?: number;
498 excludeIds?: string[];
499}): Promise<Array<{ uuid: string; score: number }>> {
500 try {
501 const results = await vectorProvider().search({
502 vector: params.queryVector,
503 namespace: VECTOR_NAMESPACES.ENTITY,
504 limit: params.limit || 10,
505 threshold: params.threshold || 0.5,
506 filter: {
507 userId: params.userId,
508 excludeIds: params.excludeIds,
509 workspaceId: params.workspaceId,
510 },
511 });
512
513 return results.map((r) => ({ uuid: r.id, score: r.score }));
514 } catch (error) {
515 logger.error(`Failed to search entities:`, { error });
516 throw error;
517 }
518}
519
520/**
521 * Batch score statements against query vector

Callers

nothing calls this directly

Calls 3

vectorProviderFunction · 0.70
searchMethod · 0.65
errorMethod · 0.45

Tested by

no test coverage detected