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

Function handleMemorySearch

apps/webapp/app/utils/mcp/memory-operations.ts:128–166  ·  view source on GitHub ↗
(args: any)

Source from the content-addressed store, hash-verified

126 * Handler for memory_search
127 */
128export async function handleMemorySearch(args: any) {
129 try {
130 const labelIds =
131 args.labelIds || (args.labelId ? [args.labelId] : undefined);
132
133 const results = await searchService.search(
134 args.query,
135 args.userId,
136 args.workspaceId,
137 {
138 startTime: args.startTime ? new Date(args.startTime) : undefined,
139 endTime: args.endTime ? new Date(args.endTime) : undefined,
140 labelIds,
141 sortBy: args.sortBy as "relevance" | "recency" | undefined,
142 },
143 args.source,
144 );
145
146 return {
147 content: [
148 {
149 type: "text",
150 text: JSON.stringify(results),
151 },
152 ],
153 };
154 } catch (error) {
155 logger.error(`MCP memory search error: ${error}`);
156 return {
157 content: [
158 {
159 type: "text",
160 text: `Error searching memory: ${error instanceof Error ? error.message : String(error)}`,
161 },
162 ],
163 isError: true,
164 };
165 }
166}
167
168/**
169 * Handler for get_documents

Callers

nothing calls this directly

Calls 2

searchMethod · 0.65
errorMethod · 0.45

Tested by

no test coverage detected