oh-memos-mcp 1.0.0
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/.env.example +27 -0
- package/README.md +71 -0
- package/dist/api-client.d.ts +22 -0
- package/dist/api-client.js +127 -0
- package/dist/config.d.ts +30 -0
- package/dist/config.js +163 -0
- package/dist/cube-manager.d.ts +16 -0
- package/dist/cube-manager.js +357 -0
- package/dist/formatters.d.ts +16 -0
- package/dist/formatters.js +174 -0
- package/dist/handlers/admin.d.ts +13 -0
- package/dist/handlers/admin.js +331 -0
- package/dist/handlers/calendar.d.ts +8 -0
- package/dist/handlers/calendar.js +281 -0
- package/dist/handlers/graph.d.ts +11 -0
- package/dist/handlers/graph.js +502 -0
- package/dist/handlers/index.d.ts +7 -0
- package/dist/handlers/index.js +71 -0
- package/dist/handlers/memory.d.ts +12 -0
- package/dist/handlers/memory.js +270 -0
- package/dist/handlers/search.d.ts +11 -0
- package/dist/handlers/search.js +334 -0
- package/dist/handlers/utils.d.ts +22 -0
- package/dist/handlers/utils.js +75 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +18 -0
- package/dist/keyword-enhancer.d.ts +18 -0
- package/dist/keyword-enhancer.js +335 -0
- package/dist/memory-analysis.d.ts +7 -0
- package/dist/memory-analysis.js +45 -0
- package/dist/models.d.ts +21 -0
- package/dist/models.js +101 -0
- package/dist/query-processing.d.ts +20 -0
- package/dist/query-processing.js +265 -0
- package/dist/server.d.ts +5 -0
- package/dist/server.js +114 -0
- package/dist/tools-registry.d.ts +303 -0
- package/dist/tools-registry.js +369 -0
- package/dist/types.d.ts +118 -0
- package/dist/types.js +5 -0
- package/package.json +53 -0
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MemOS MCP Server - Tools Registry
|
|
3
|
+
*
|
|
4
|
+
* Defines all 20 memos_* tool schemas using Zod.
|
|
5
|
+
*/
|
|
6
|
+
import { z } from "zod";
|
|
7
|
+
export declare const toolSchemas: {
|
|
8
|
+
memos_context_resume: {
|
|
9
|
+
description: string;
|
|
10
|
+
inputSchema: z.ZodObject<{
|
|
11
|
+
project_path: z.ZodOptional<z.ZodString>;
|
|
12
|
+
cube_id: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
13
|
+
}, "strip", z.ZodTypeAny, {
|
|
14
|
+
cube_id: string;
|
|
15
|
+
project_path?: string | undefined;
|
|
16
|
+
}, {
|
|
17
|
+
cube_id?: string | undefined;
|
|
18
|
+
project_path?: string | undefined;
|
|
19
|
+
}>;
|
|
20
|
+
};
|
|
21
|
+
memos_search: {
|
|
22
|
+
description: string;
|
|
23
|
+
inputSchema: z.ZodObject<{
|
|
24
|
+
query: z.ZodString;
|
|
25
|
+
project_path: z.ZodOptional<z.ZodString>;
|
|
26
|
+
cube_id: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
27
|
+
top_k: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
28
|
+
compact: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
29
|
+
}, "strip", z.ZodTypeAny, {
|
|
30
|
+
cube_id: string;
|
|
31
|
+
query: string;
|
|
32
|
+
top_k: number;
|
|
33
|
+
compact: boolean;
|
|
34
|
+
project_path?: string | undefined;
|
|
35
|
+
}, {
|
|
36
|
+
query: string;
|
|
37
|
+
cube_id?: string | undefined;
|
|
38
|
+
project_path?: string | undefined;
|
|
39
|
+
top_k?: number | undefined;
|
|
40
|
+
compact?: boolean | undefined;
|
|
41
|
+
}>;
|
|
42
|
+
};
|
|
43
|
+
memos_search_context: {
|
|
44
|
+
description: string;
|
|
45
|
+
inputSchema: z.ZodObject<{
|
|
46
|
+
query: z.ZodString;
|
|
47
|
+
context: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
48
|
+
role: z.ZodEnum<["user", "assistant"]>;
|
|
49
|
+
content: z.ZodString;
|
|
50
|
+
}, "strip", z.ZodTypeAny, {
|
|
51
|
+
role: "user" | "assistant";
|
|
52
|
+
content: string;
|
|
53
|
+
}, {
|
|
54
|
+
role: "user" | "assistant";
|
|
55
|
+
content: string;
|
|
56
|
+
}>, "many">>;
|
|
57
|
+
cube_id: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
58
|
+
}, "strip", z.ZodTypeAny, {
|
|
59
|
+
cube_id: string;
|
|
60
|
+
query: string;
|
|
61
|
+
context?: {
|
|
62
|
+
role: "user" | "assistant";
|
|
63
|
+
content: string;
|
|
64
|
+
}[] | undefined;
|
|
65
|
+
}, {
|
|
66
|
+
query: string;
|
|
67
|
+
context?: {
|
|
68
|
+
role: "user" | "assistant";
|
|
69
|
+
content: string;
|
|
70
|
+
}[] | undefined;
|
|
71
|
+
cube_id?: string | undefined;
|
|
72
|
+
}>;
|
|
73
|
+
};
|
|
74
|
+
memos_save: {
|
|
75
|
+
description: string;
|
|
76
|
+
inputSchema: z.ZodObject<{
|
|
77
|
+
content: z.ZodString;
|
|
78
|
+
memory_type: z.ZodEnum<["ERROR_PATTERN", "DECISION", "MILESTONE", "BUGFIX", "FEATURE", "CONFIG", "CODE_PATTERN", "GOTCHA", "PROGRESS"]>;
|
|
79
|
+
project_path: z.ZodOptional<z.ZodString>;
|
|
80
|
+
cube_id: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
81
|
+
}, "strip", z.ZodTypeAny, {
|
|
82
|
+
cube_id: string;
|
|
83
|
+
content: string;
|
|
84
|
+
memory_type: "ERROR_PATTERN" | "DECISION" | "MILESTONE" | "BUGFIX" | "FEATURE" | "CONFIG" | "CODE_PATTERN" | "GOTCHA" | "PROGRESS";
|
|
85
|
+
project_path?: string | undefined;
|
|
86
|
+
}, {
|
|
87
|
+
content: string;
|
|
88
|
+
memory_type: "ERROR_PATTERN" | "DECISION" | "MILESTONE" | "BUGFIX" | "FEATURE" | "CONFIG" | "CODE_PATTERN" | "GOTCHA" | "PROGRESS";
|
|
89
|
+
cube_id?: string | undefined;
|
|
90
|
+
project_path?: string | undefined;
|
|
91
|
+
}>;
|
|
92
|
+
};
|
|
93
|
+
memos_list_v2: {
|
|
94
|
+
description: string;
|
|
95
|
+
inputSchema: z.ZodObject<{
|
|
96
|
+
project_path: z.ZodOptional<z.ZodString>;
|
|
97
|
+
cube_id: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
98
|
+
limit: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
99
|
+
memory_type: z.ZodOptional<z.ZodEnum<["ERROR_PATTERN", "DECISION", "MILESTONE", "BUGFIX", "FEATURE", "CONFIG", "CODE_PATTERN", "GOTCHA", "PROGRESS"]>>;
|
|
100
|
+
compact: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
101
|
+
}, "strip", z.ZodTypeAny, {
|
|
102
|
+
cube_id: string;
|
|
103
|
+
compact: boolean;
|
|
104
|
+
limit: number;
|
|
105
|
+
project_path?: string | undefined;
|
|
106
|
+
memory_type?: "ERROR_PATTERN" | "DECISION" | "MILESTONE" | "BUGFIX" | "FEATURE" | "CONFIG" | "CODE_PATTERN" | "GOTCHA" | "PROGRESS" | undefined;
|
|
107
|
+
}, {
|
|
108
|
+
cube_id?: string | undefined;
|
|
109
|
+
project_path?: string | undefined;
|
|
110
|
+
compact?: boolean | undefined;
|
|
111
|
+
memory_type?: "ERROR_PATTERN" | "DECISION" | "MILESTONE" | "BUGFIX" | "FEATURE" | "CONFIG" | "CODE_PATTERN" | "GOTCHA" | "PROGRESS" | undefined;
|
|
112
|
+
limit?: number | undefined;
|
|
113
|
+
}>;
|
|
114
|
+
};
|
|
115
|
+
memos_get: {
|
|
116
|
+
description: string;
|
|
117
|
+
inputSchema: z.ZodObject<{
|
|
118
|
+
memory_id: z.ZodString;
|
|
119
|
+
cube_id: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
120
|
+
}, "strip", z.ZodTypeAny, {
|
|
121
|
+
cube_id: string;
|
|
122
|
+
memory_id: string;
|
|
123
|
+
}, {
|
|
124
|
+
memory_id: string;
|
|
125
|
+
cube_id?: string | undefined;
|
|
126
|
+
}>;
|
|
127
|
+
};
|
|
128
|
+
memos_suggest: {
|
|
129
|
+
description: string;
|
|
130
|
+
inputSchema: z.ZodObject<{
|
|
131
|
+
context: z.ZodString;
|
|
132
|
+
}, "strip", z.ZodTypeAny, {
|
|
133
|
+
context: string;
|
|
134
|
+
}, {
|
|
135
|
+
context: string;
|
|
136
|
+
}>;
|
|
137
|
+
};
|
|
138
|
+
memos_list_cubes: {
|
|
139
|
+
description: string;
|
|
140
|
+
inputSchema: z.ZodObject<{
|
|
141
|
+
include_status: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
142
|
+
}, "strip", z.ZodTypeAny, {
|
|
143
|
+
include_status: boolean;
|
|
144
|
+
}, {
|
|
145
|
+
include_status?: boolean | undefined;
|
|
146
|
+
}>;
|
|
147
|
+
};
|
|
148
|
+
memos_get_stats: {
|
|
149
|
+
description: string;
|
|
150
|
+
inputSchema: z.ZodObject<{
|
|
151
|
+
cube_id: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
152
|
+
}, "strip", z.ZodTypeAny, {
|
|
153
|
+
cube_id: string;
|
|
154
|
+
}, {
|
|
155
|
+
cube_id?: string | undefined;
|
|
156
|
+
}>;
|
|
157
|
+
};
|
|
158
|
+
memos_trace_path: {
|
|
159
|
+
description: string;
|
|
160
|
+
inputSchema: z.ZodObject<{
|
|
161
|
+
source_id: z.ZodString;
|
|
162
|
+
target_id: z.ZodString;
|
|
163
|
+
max_depth: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
164
|
+
cube_id: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
165
|
+
}, "strip", z.ZodTypeAny, {
|
|
166
|
+
cube_id: string;
|
|
167
|
+
source_id: string;
|
|
168
|
+
target_id: string;
|
|
169
|
+
max_depth: number;
|
|
170
|
+
}, {
|
|
171
|
+
source_id: string;
|
|
172
|
+
target_id: string;
|
|
173
|
+
cube_id?: string | undefined;
|
|
174
|
+
max_depth?: number | undefined;
|
|
175
|
+
}>;
|
|
176
|
+
};
|
|
177
|
+
memos_get_graph: {
|
|
178
|
+
description: string;
|
|
179
|
+
inputSchema: z.ZodObject<{
|
|
180
|
+
query: z.ZodString;
|
|
181
|
+
cube_id: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
182
|
+
}, "strip", z.ZodTypeAny, {
|
|
183
|
+
cube_id: string;
|
|
184
|
+
query: string;
|
|
185
|
+
}, {
|
|
186
|
+
query: string;
|
|
187
|
+
cube_id?: string | undefined;
|
|
188
|
+
}>;
|
|
189
|
+
};
|
|
190
|
+
memos_export_schema: {
|
|
191
|
+
description: string;
|
|
192
|
+
inputSchema: z.ZodObject<{
|
|
193
|
+
cube_id: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
194
|
+
sample_size: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
195
|
+
}, "strip", z.ZodTypeAny, {
|
|
196
|
+
cube_id: string;
|
|
197
|
+
sample_size: number;
|
|
198
|
+
}, {
|
|
199
|
+
cube_id?: string | undefined;
|
|
200
|
+
sample_size?: number | undefined;
|
|
201
|
+
}>;
|
|
202
|
+
};
|
|
203
|
+
memos_register_cube: {
|
|
204
|
+
description: string;
|
|
205
|
+
inputSchema: z.ZodObject<{
|
|
206
|
+
cube_id: z.ZodString;
|
|
207
|
+
cube_path: z.ZodOptional<z.ZodString>;
|
|
208
|
+
}, "strip", z.ZodTypeAny, {
|
|
209
|
+
cube_id: string;
|
|
210
|
+
cube_path?: string | undefined;
|
|
211
|
+
}, {
|
|
212
|
+
cube_id: string;
|
|
213
|
+
cube_path?: string | undefined;
|
|
214
|
+
}>;
|
|
215
|
+
};
|
|
216
|
+
memos_create_user: {
|
|
217
|
+
description: string;
|
|
218
|
+
inputSchema: z.ZodObject<{
|
|
219
|
+
user_id: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
220
|
+
user_name: z.ZodOptional<z.ZodString>;
|
|
221
|
+
}, "strip", z.ZodTypeAny, {
|
|
222
|
+
user_id: string;
|
|
223
|
+
user_name?: string | undefined;
|
|
224
|
+
}, {
|
|
225
|
+
user_id?: string | undefined;
|
|
226
|
+
user_name?: string | undefined;
|
|
227
|
+
}>;
|
|
228
|
+
};
|
|
229
|
+
memos_validate_cubes: {
|
|
230
|
+
description: string;
|
|
231
|
+
inputSchema: z.ZodObject<{
|
|
232
|
+
fix: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
233
|
+
}, "strip", z.ZodTypeAny, {
|
|
234
|
+
fix: boolean;
|
|
235
|
+
}, {
|
|
236
|
+
fix?: boolean | undefined;
|
|
237
|
+
}>;
|
|
238
|
+
};
|
|
239
|
+
memos_impact: {
|
|
240
|
+
description: string;
|
|
241
|
+
inputSchema: z.ZodObject<{
|
|
242
|
+
memory_id: z.ZodString;
|
|
243
|
+
cube_id: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
244
|
+
project_path: z.ZodOptional<z.ZodString>;
|
|
245
|
+
max_depth: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
246
|
+
}, "strip", z.ZodTypeAny, {
|
|
247
|
+
cube_id: string;
|
|
248
|
+
memory_id: string;
|
|
249
|
+
max_depth: number;
|
|
250
|
+
project_path?: string | undefined;
|
|
251
|
+
}, {
|
|
252
|
+
memory_id: string;
|
|
253
|
+
cube_id?: string | undefined;
|
|
254
|
+
project_path?: string | undefined;
|
|
255
|
+
max_depth?: number | undefined;
|
|
256
|
+
}>;
|
|
257
|
+
};
|
|
258
|
+
memos_calendar: {
|
|
259
|
+
description: string;
|
|
260
|
+
inputSchema: z.ZodObject<{
|
|
261
|
+
mode: z.ZodDefault<z.ZodOptional<z.ZodEnum<["project", "student"]>>>;
|
|
262
|
+
semester: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
263
|
+
course: z.ZodOptional<z.ZodString>;
|
|
264
|
+
week: z.ZodOptional<z.ZodNumber>;
|
|
265
|
+
view: z.ZodDefault<z.ZodOptional<z.ZodEnum<["list", "week", "month"]>>>;
|
|
266
|
+
cube_id: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
267
|
+
}, "strip", z.ZodTypeAny, {
|
|
268
|
+
mode: "project" | "student";
|
|
269
|
+
view: "list" | "week" | "month";
|
|
270
|
+
cube_id: string;
|
|
271
|
+
semester: string;
|
|
272
|
+
course?: string | undefined;
|
|
273
|
+
week?: number | undefined;
|
|
274
|
+
}, {
|
|
275
|
+
mode?: "project" | "student" | undefined;
|
|
276
|
+
view?: "list" | "week" | "month" | undefined;
|
|
277
|
+
cube_id?: string | undefined;
|
|
278
|
+
semester?: string | undefined;
|
|
279
|
+
course?: string | undefined;
|
|
280
|
+
week?: number | undefined;
|
|
281
|
+
}>;
|
|
282
|
+
};
|
|
283
|
+
memos_delete: {
|
|
284
|
+
description: string;
|
|
285
|
+
inputSchema: z.ZodObject<{
|
|
286
|
+
memory_id: z.ZodOptional<z.ZodString>;
|
|
287
|
+
memory_ids: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
288
|
+
cube_id: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
289
|
+
delete_all: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
290
|
+
}, "strip", z.ZodTypeAny, {
|
|
291
|
+
cube_id: string;
|
|
292
|
+
delete_all: boolean;
|
|
293
|
+
memory_id?: string | undefined;
|
|
294
|
+
memory_ids?: string[] | undefined;
|
|
295
|
+
}, {
|
|
296
|
+
cube_id?: string | undefined;
|
|
297
|
+
memory_id?: string | undefined;
|
|
298
|
+
memory_ids?: string[] | undefined;
|
|
299
|
+
delete_all?: boolean | undefined;
|
|
300
|
+
}>;
|
|
301
|
+
};
|
|
302
|
+
};
|
|
303
|
+
//# sourceMappingURL=tools-registry.d.ts.map
|
|
@@ -0,0 +1,369 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MemOS MCP Server - Tools Registry
|
|
3
|
+
*
|
|
4
|
+
* Defines all 20 memos_* tool schemas using Zod.
|
|
5
|
+
*/
|
|
6
|
+
import { z } from "zod";
|
|
7
|
+
import { MEMOS_DEFAULT_CUBE, MEMOS_USER } from "./config.js";
|
|
8
|
+
// ============================================================================
|
|
9
|
+
// Shared Parameter Schemas
|
|
10
|
+
// ============================================================================
|
|
11
|
+
const projectPathParam = z
|
|
12
|
+
.string()
|
|
13
|
+
.optional()
|
|
14
|
+
.describe("Your current working directory (project root). The cube_id will be auto-derived from this path. " +
|
|
15
|
+
"PREFERRED over manually specifying cube_id. Example: '/mnt/g/Cyber/AudioCraft Studio' → 'audiocraft_studio_cube'");
|
|
16
|
+
const cubeIdParam = z
|
|
17
|
+
.string()
|
|
18
|
+
.optional()
|
|
19
|
+
.default(MEMOS_DEFAULT_CUBE)
|
|
20
|
+
.describe("Memory cube ID. Only use if you know the exact cube_id. Otherwise, pass project_path and let the server derive it.");
|
|
21
|
+
const memoryTypeEnum = z.enum([
|
|
22
|
+
"ERROR_PATTERN", "DECISION", "MILESTONE", "BUGFIX",
|
|
23
|
+
"FEATURE", "CONFIG", "CODE_PATTERN", "GOTCHA", "PROGRESS",
|
|
24
|
+
]);
|
|
25
|
+
// ============================================================================
|
|
26
|
+
// Tool Schema Definitions
|
|
27
|
+
// ============================================================================
|
|
28
|
+
export const toolSchemas = {
|
|
29
|
+
memos_context_resume: {
|
|
30
|
+
description: `Recover project context after context compaction or at session start.
|
|
31
|
+
|
|
32
|
+
Call this tool when:
|
|
33
|
+
- Context was just compacted (you lost conversation history)
|
|
34
|
+
- You're unsure what was being worked on
|
|
35
|
+
- Starting a new session and need project context
|
|
36
|
+
|
|
37
|
+
Returns: Recent memories (last 24h), active project summary, and session state.
|
|
38
|
+
|
|
39
|
+
⚠️ IMPORTANT: After calling this, use MCP memos tools for ALL memory operations.
|
|
40
|
+
NEVER use mkdir or Write to create memory files. All memories live in MCP memos.`,
|
|
41
|
+
inputSchema: z.object({
|
|
42
|
+
project_path: projectPathParam,
|
|
43
|
+
cube_id: cubeIdParam,
|
|
44
|
+
}),
|
|
45
|
+
},
|
|
46
|
+
memos_search: {
|
|
47
|
+
description: `Search project memories for relevant context.
|
|
48
|
+
|
|
49
|
+
USE THIS TOOL PROACTIVELY when:
|
|
50
|
+
- You encounter an error or exception (search for ERROR_PATTERN)
|
|
51
|
+
- User mentions "之前", "上次", "previously", "last time"
|
|
52
|
+
- You need to understand past decisions (search for DECISION)
|
|
53
|
+
- You're about to modify code that might have gotchas (search for GOTCHA)
|
|
54
|
+
- You see similar code patterns (search for CODE_PATTERN)
|
|
55
|
+
- Working with configuration files (search for CONFIG)
|
|
56
|
+
|
|
57
|
+
Results are automatically compacted when exceeding threshold (15+ items).
|
|
58
|
+
Use memos_get(memory_id) to retrieve full details of specific memories.
|
|
59
|
+
|
|
60
|
+
⚠️ IMPORTANT: After context compaction, call this tool to recover project context.
|
|
61
|
+
NEVER use mkdir, Write, or file operations to create memory files — all memories are stored in MCP memos.`,
|
|
62
|
+
inputSchema: z.object({
|
|
63
|
+
query: z.string().describe("Search query. Can be natural language or prefixed with memory type (e.g., 'ERROR_PATTERN ModuleNotFoundError', 'DECISION authentication')"),
|
|
64
|
+
project_path: projectPathParam,
|
|
65
|
+
cube_id: cubeIdParam,
|
|
66
|
+
top_k: z.number().int().optional().default(10).describe("Maximum number of results to return (default: 10)"),
|
|
67
|
+
compact: z.boolean().optional().default(true).describe("Enable context compression for large results (default: true). Set to false to get full results."),
|
|
68
|
+
}),
|
|
69
|
+
},
|
|
70
|
+
memos_search_context: {
|
|
71
|
+
description: `Context-aware memory search with LLM intent analysis.
|
|
72
|
+
|
|
73
|
+
USE THIS TOOL when you need smarter search that understands:
|
|
74
|
+
- The broader conversation context (what you've been discussing)
|
|
75
|
+
- Implied entities and concepts that aren't explicitly mentioned
|
|
76
|
+
- The type of information the user is really looking for
|
|
77
|
+
|
|
78
|
+
Example: If you've been discussing "login errors" and user asks "what was the solution?",
|
|
79
|
+
this tool understands they mean "login error solution" even without explicit mention.
|
|
80
|
+
|
|
81
|
+
Best used when:
|
|
82
|
+
- Query is ambiguous or refers to earlier conversation
|
|
83
|
+
- You want better recall through query expansion
|
|
84
|
+
- You need to find related concepts, not just exact matches`,
|
|
85
|
+
inputSchema: z.object({
|
|
86
|
+
query: z.string().describe("Search query - can be brief since context helps clarify intent"),
|
|
87
|
+
context: z.array(z.object({
|
|
88
|
+
role: z.enum(["user", "assistant"]),
|
|
89
|
+
content: z.string(),
|
|
90
|
+
})).optional().describe("Recent conversation messages for context (last 5-10 turns)"),
|
|
91
|
+
cube_id: z.string().optional().default(MEMOS_DEFAULT_CUBE).describe("Memory cube ID. AUTO-DERIVE from project path."),
|
|
92
|
+
}),
|
|
93
|
+
},
|
|
94
|
+
memos_save: {
|
|
95
|
+
description: `Save important information to project memory.
|
|
96
|
+
|
|
97
|
+
🚨 **MUST: 显式指定 memory_type 参数** - 不要依赖自动检测!
|
|
98
|
+
|
|
99
|
+
USE THIS TOOL when:
|
|
100
|
+
- You've solved a bug or error → **MUST use BUGFIX or ERROR_PATTERN**
|
|
101
|
+
- A significant decision was made → **MUST use DECISION** with rationale
|
|
102
|
+
- You've completed a major task → **MUST use MILESTONE**
|
|
103
|
+
- You discovered a non-obvious gotcha → **MUST use GOTCHA**
|
|
104
|
+
- You created a reusable code pattern → **MUST use CODE_PATTERN**
|
|
105
|
+
- Configuration was changed → **MUST use CONFIG**
|
|
106
|
+
|
|
107
|
+
Memory types (按优先级选择,PROGRESS 仅用于纯进度汇报):
|
|
108
|
+
- ERROR_PATTERN: Error signature + solution (有通用复用价值)
|
|
109
|
+
- BUGFIX: Bug fix with cause and solution (一次性修复)
|
|
110
|
+
- DECISION: Architectural or design choice with rationale
|
|
111
|
+
- GOTCHA: Non-obvious issue or workaround
|
|
112
|
+
- CODE_PATTERN: Reusable code template
|
|
113
|
+
- CONFIG: Environment or configuration change
|
|
114
|
+
- FEATURE: New functionality added
|
|
115
|
+
- MILESTONE: Significant project achievement
|
|
116
|
+
- PROGRESS: **仅用于纯进度更新,禁止包含错误解决方案、技术决策、陷阱警告**
|
|
117
|
+
|
|
118
|
+
⚠️ This is the ONLY way to save memories. NEVER use mkdir or Write tool to create memory directories/files.`,
|
|
119
|
+
inputSchema: z.object({
|
|
120
|
+
content: z.string().describe("Memory content to save. Be detailed - include context, rationale, and relevant code/commands."),
|
|
121
|
+
memory_type: memoryTypeEnum.describe("**REQUIRED** - Type of memory. Decision tree: Bug fix → BUGFIX/ERROR_PATTERN, Technical decision → DECISION, Gotcha → GOTCHA, Code template → CODE_PATTERN, Config change → CONFIG, New feature → FEATURE, Achievement → MILESTONE, Pure progress update → PROGRESS"),
|
|
122
|
+
project_path: projectPathParam,
|
|
123
|
+
cube_id: cubeIdParam,
|
|
124
|
+
}),
|
|
125
|
+
},
|
|
126
|
+
memos_list_v2: {
|
|
127
|
+
description: `List memories from a memory cube with context compression.
|
|
128
|
+
|
|
129
|
+
Results are automatically compacted when exceeding threshold (15+ items) to save context window.
|
|
130
|
+
Use memos_get(memory_id) to retrieve full details of specific memories.
|
|
131
|
+
|
|
132
|
+
Set compact=false to disable compression and get full results.`,
|
|
133
|
+
inputSchema: z.object({
|
|
134
|
+
project_path: projectPathParam,
|
|
135
|
+
cube_id: cubeIdParam,
|
|
136
|
+
limit: z.number().int().optional().default(20).describe("Maximum number of memories to return."),
|
|
137
|
+
memory_type: memoryTypeEnum.optional().describe("Optional: Filter by memory type (e.g., DECISION, ERROR_PATTERN)."),
|
|
138
|
+
compact: z.boolean().optional().default(true).describe("Enable context compression for large results (default: true). Set to false to get full results."),
|
|
139
|
+
}),
|
|
140
|
+
},
|
|
141
|
+
memos_get: {
|
|
142
|
+
description: `Get full details of a single memory by ID.
|
|
143
|
+
|
|
144
|
+
Use this after memos_search or memos_list_v2 returns compacted results.
|
|
145
|
+
Retrieves complete memory content, metadata, background, and relations.
|
|
146
|
+
|
|
147
|
+
Example: memos_get(memory_id="abc123-def456-...")`,
|
|
148
|
+
inputSchema: z.object({
|
|
149
|
+
memory_id: z.string().describe("The full memory ID to retrieve (from memos_search or memos_list_v2 results)"),
|
|
150
|
+
cube_id: z.string().optional().default(MEMOS_DEFAULT_CUBE).describe("Memory cube ID. AUTO-DERIVE from project path."),
|
|
151
|
+
}),
|
|
152
|
+
},
|
|
153
|
+
memos_suggest: {
|
|
154
|
+
description: `Get smart suggestions for memory searches based on current context.
|
|
155
|
+
|
|
156
|
+
Use this when you're unsure what to search for. Provide the current context
|
|
157
|
+
(error message, code snippet, user question) and get relevant search suggestions.`,
|
|
158
|
+
inputSchema: z.object({
|
|
159
|
+
context: z.string().describe("Current context (error message, code, user question)"),
|
|
160
|
+
}),
|
|
161
|
+
},
|
|
162
|
+
memos_list_cubes: {
|
|
163
|
+
description: `List all available memory cubes in the system.
|
|
164
|
+
|
|
165
|
+
USE THIS TOOL when:
|
|
166
|
+
- You encounter "cube not found" errors
|
|
167
|
+
- User asks which cubes are available
|
|
168
|
+
- You need to verify a cube exists before using it
|
|
169
|
+
- Starting a new project and want to see existing cubes
|
|
170
|
+
|
|
171
|
+
Returns:
|
|
172
|
+
- List of available cube IDs with their paths
|
|
173
|
+
- Registration status for each cube
|
|
174
|
+
- Helpful guidance if no cubes are found`,
|
|
175
|
+
inputSchema: z.object({
|
|
176
|
+
include_status: z.boolean().optional().default(false).describe("Include registration status for each cube (requires API call)"),
|
|
177
|
+
}),
|
|
178
|
+
},
|
|
179
|
+
memos_get_stats: {
|
|
180
|
+
description: `Get statistics about memories in a project cube.
|
|
181
|
+
|
|
182
|
+
Use this to see how many memories of each type (DECISION, ERROR_PATTERN, etc.) are stored.`,
|
|
183
|
+
inputSchema: z.object({
|
|
184
|
+
cube_id: z.string().optional().default(MEMOS_DEFAULT_CUBE).describe("Memory cube ID (project name)"),
|
|
185
|
+
}),
|
|
186
|
+
},
|
|
187
|
+
memos_trace_path: {
|
|
188
|
+
description: `Trace reasoning paths between two memory nodes.
|
|
189
|
+
|
|
190
|
+
USE THIS TOOL when you need to understand:
|
|
191
|
+
- How two concepts or events are connected
|
|
192
|
+
- The chain of causality or dependencies between memories
|
|
193
|
+
- Indirect relationships that span multiple hops
|
|
194
|
+
|
|
195
|
+
Returns:
|
|
196
|
+
- Whether a path exists between the two nodes
|
|
197
|
+
- Full path details with all intermediate nodes and edges
|
|
198
|
+
- The relationship types along the path (CAUSE, RELATE, CONDITION, etc.)
|
|
199
|
+
|
|
200
|
+
Example: Tracing from "Java not installed" to "API timeout error" might reveal:
|
|
201
|
+
[Java not installed] ──CAUSE──> [Neo4j failed] ──CAUSE──> [DB connection lost] ──CAUSE──> [API timeout]`,
|
|
202
|
+
inputSchema: z.object({
|
|
203
|
+
source_id: z.string().describe("ID of the source memory node to start from. Get this from memos_search or memos_get_graph."),
|
|
204
|
+
target_id: z.string().describe("ID of the target memory node to find path to. Get this from memos_search or memos_get_graph."),
|
|
205
|
+
max_depth: z.number().int().optional().default(3).describe("Maximum path length (hops). Default 3, max 10."),
|
|
206
|
+
cube_id: z.string().optional().default(MEMOS_DEFAULT_CUBE).describe("Memory cube ID. AUTO-DERIVE from project path."),
|
|
207
|
+
}),
|
|
208
|
+
},
|
|
209
|
+
memos_get_graph: {
|
|
210
|
+
description: `Get memory knowledge graph with relationships.
|
|
211
|
+
|
|
212
|
+
USE THIS TOOL when you need to understand:
|
|
213
|
+
- How memories are connected (dependencies, causality)
|
|
214
|
+
- What caused a particular issue (CAUSE relationships)
|
|
215
|
+
- Related context around a topic (RELATE relationships)
|
|
216
|
+
- Conflicting information (CONFLICT relationships)
|
|
217
|
+
|
|
218
|
+
Returns:
|
|
219
|
+
- Memory nodes matching the query
|
|
220
|
+
- Relationships between memories: CAUSE, RELATE, CONFLICT, CONDITION
|
|
221
|
+
|
|
222
|
+
Example: If you search "Neo4j startup failure", you might see:
|
|
223
|
+
[Java not installed] ──CAUSE──> [Neo4j failed to start]`,
|
|
224
|
+
inputSchema: z.object({
|
|
225
|
+
query: z.string().describe("Search query to find related memories and their relationships"),
|
|
226
|
+
cube_id: z.string().optional().default(MEMOS_DEFAULT_CUBE).describe("Memory cube ID. AUTO-DERIVE from project path: extract folder name, lowercase, replace -/./space with _, append '_cube'. Example: /mnt/g/test/MemOS → 'memos_cube', ~/my-app → 'my_app_cube'"),
|
|
227
|
+
}),
|
|
228
|
+
},
|
|
229
|
+
memos_export_schema: {
|
|
230
|
+
description: `Export knowledge graph schema and statistics.
|
|
231
|
+
|
|
232
|
+
USE THIS TOOL when you need to understand:
|
|
233
|
+
- The overall structure of the project's memory graph
|
|
234
|
+
- What types of relationships exist in the knowledge base
|
|
235
|
+
- How well-connected the memories are
|
|
236
|
+
- The most common tags and memory types
|
|
237
|
+
- Time range of stored knowledge
|
|
238
|
+
|
|
239
|
+
Returns comprehensive statistics including:
|
|
240
|
+
- Total nodes and edges
|
|
241
|
+
- Relationship type distribution (CAUSE, RELATE, CONFLICT, etc.)
|
|
242
|
+
- Memory type distribution (LongTermMemory, WorkingMemory, etc.)
|
|
243
|
+
- Top 20 most frequent tags
|
|
244
|
+
- Average and max connections per node
|
|
245
|
+
- Number of orphan (unconnected) nodes
|
|
246
|
+
- Time range of data`,
|
|
247
|
+
inputSchema: z.object({
|
|
248
|
+
cube_id: z.string().optional().default(MEMOS_DEFAULT_CUBE).describe("Memory cube ID. AUTO-DERIVE from project path."),
|
|
249
|
+
sample_size: z.number().int().optional().default(100).describe("Number of nodes to sample for analysis (10-1000). Default 100."),
|
|
250
|
+
}),
|
|
251
|
+
},
|
|
252
|
+
memos_register_cube: {
|
|
253
|
+
description: `Register a memory cube with the MemOS API.
|
|
254
|
+
|
|
255
|
+
USE THIS TOOL when you encounter:
|
|
256
|
+
- "MemCube 'xxx' is not loaded" error
|
|
257
|
+
- "Cube not registered" error
|
|
258
|
+
- After API restart when cubes need re-registration
|
|
259
|
+
|
|
260
|
+
This is the FALLBACK mechanism when auto-registration fails.
|
|
261
|
+
|
|
262
|
+
Steps to register:
|
|
263
|
+
1. First use memos_list_cubes() to find available cubes
|
|
264
|
+
2. Call this tool with the cube_id you want to register
|
|
265
|
+
3. Retry the original operation
|
|
266
|
+
|
|
267
|
+
The tool will:
|
|
268
|
+
1. Find the cube's full path from the cubes directory
|
|
269
|
+
2. Send registration request to MemOS API
|
|
270
|
+
3. Return success or detailed error message`,
|
|
271
|
+
inputSchema: z.object({
|
|
272
|
+
cube_id: z.string().describe("ID of the cube to register (e.g., 'dev_cube', 'my_project_cube')"),
|
|
273
|
+
cube_path: z.string().optional().describe("Optional: Full path to cube directory. If not provided, will be auto-detected from MEMOS_CUBES_DIR."),
|
|
274
|
+
}),
|
|
275
|
+
},
|
|
276
|
+
memos_create_user: {
|
|
277
|
+
description: `Create a user in MemOS.
|
|
278
|
+
|
|
279
|
+
USE THIS TOOL when you encounter:
|
|
280
|
+
- "User 'xxx' does not exist" error
|
|
281
|
+
- "User not found" error
|
|
282
|
+
|
|
283
|
+
This creates the user account needed to store and retrieve memories.`,
|
|
284
|
+
inputSchema: z.object({
|
|
285
|
+
user_id: z.string().optional().default(MEMOS_USER).describe("User ID to create (e.g., 'dev_user')"),
|
|
286
|
+
user_name: z.string().optional().describe("Display name for the user. Defaults to user_id if not provided."),
|
|
287
|
+
}),
|
|
288
|
+
},
|
|
289
|
+
memos_validate_cubes: {
|
|
290
|
+
description: `Validate all cube configurations and fix namespace mismatches.
|
|
291
|
+
|
|
292
|
+
USE THIS TOOL to:
|
|
293
|
+
- Check if cube configs have correct user_name (should match cube_id)
|
|
294
|
+
- Auto-fix mismatched user_name in configs
|
|
295
|
+
- Detect cubes that may write to wrong namespace
|
|
296
|
+
|
|
297
|
+
This prevents the issue where memories are saved to wrong namespace
|
|
298
|
+
(e.g., saving to 'dev_user' instead of 'my_project_cube').
|
|
299
|
+
|
|
300
|
+
Returns:
|
|
301
|
+
- List of all cubes with their validation status
|
|
302
|
+
- Any fixes that were applied
|
|
303
|
+
- Warnings for potential issues`,
|
|
304
|
+
inputSchema: z.object({
|
|
305
|
+
fix: z.boolean().optional().default(true).describe("If true, automatically fix mismatched configs. Default: true"),
|
|
306
|
+
}),
|
|
307
|
+
},
|
|
308
|
+
memos_impact: {
|
|
309
|
+
description: "Analyze the forward impact of a memory — what events, decisions, " +
|
|
310
|
+
"or milestones were caused or followed by this memory. " +
|
|
311
|
+
"Returns a grouped 'blast radius' view (direct → indirect hops). " +
|
|
312
|
+
"Use after memos_search or memos_get_graph to get a memory_id.",
|
|
313
|
+
inputSchema: z.object({
|
|
314
|
+
memory_id: z.string().describe("ID of the source memory to analyze impact from"),
|
|
315
|
+
cube_id: cubeIdParam,
|
|
316
|
+
project_path: projectPathParam,
|
|
317
|
+
max_depth: z.number().int().optional().default(3).describe("Maximum hops to trace forward (default: 3, max: 6)"),
|
|
318
|
+
}),
|
|
319
|
+
},
|
|
320
|
+
memos_calendar: {
|
|
321
|
+
description: `View memories in calendar format. Supports two modes:
|
|
322
|
+
|
|
323
|
+
PROJECT MODE (mode="project"):
|
|
324
|
+
- Shows milestone timeline grouped by month
|
|
325
|
+
- Filters MILESTONE, DECISION, FEATURE, BUGFIX, GOTCHA types
|
|
326
|
+
- Perfect for: "Show project timeline", "What milestones this month?"
|
|
327
|
+
|
|
328
|
+
STUDENT MODE (mode="student", default):
|
|
329
|
+
- View notes by semester (Spring/Fall/Summer)
|
|
330
|
+
- Filter by specific course
|
|
331
|
+
- Browse by week number
|
|
332
|
+
|
|
333
|
+
Views (student mode): list, week, month`,
|
|
334
|
+
inputSchema: z.object({
|
|
335
|
+
mode: z.enum(["project", "student"]).optional().default("student").describe("Mode: 'project' for milestone timeline, 'student' for learning notes calendar"),
|
|
336
|
+
semester: z.string().optional().default("current").describe("Semester to view (student mode). Format: 'YYYY-Season' or 'current'"),
|
|
337
|
+
course: z.string().optional().describe("Optional: Filter by course name or tag (student mode)"),
|
|
338
|
+
week: z.number().int().optional().describe("Optional: Specific week number in semester 1-18 (student mode)"),
|
|
339
|
+
view: z.enum(["list", "week", "month"]).optional().default("list").describe("View format (student mode): 'list', 'week', 'month'"),
|
|
340
|
+
cube_id: z.string().optional().default(MEMOS_DEFAULT_CUBE).describe("Memory cube ID. AUTO-DERIVE from project path."),
|
|
341
|
+
}),
|
|
342
|
+
},
|
|
343
|
+
// Delete tool schema (registered conditionally)
|
|
344
|
+
memos_delete: {
|
|
345
|
+
description: `⚠️ DELETE memories from project memory. USE WITH CAUTION!
|
|
346
|
+
|
|
347
|
+
This tool is DISABLED by default. User must explicitly enable it via MEMOS_ENABLE_DELETE=true.
|
|
348
|
+
|
|
349
|
+
ONLY use this tool when the user EXPLICITLY requests deletion.
|
|
350
|
+
NEVER use this tool proactively or without user confirmation.
|
|
351
|
+
|
|
352
|
+
Operations:
|
|
353
|
+
- Delete a single memory by ID
|
|
354
|
+
- Delete multiple memories by IDs
|
|
355
|
+
- Delete ALL memories in a cube (requires delete_all=true)
|
|
356
|
+
|
|
357
|
+
Before deleting, always:
|
|
358
|
+
1. Confirm with the user what will be deleted
|
|
359
|
+
2. Show the memory content that will be deleted
|
|
360
|
+
3. Get explicit user approval`,
|
|
361
|
+
inputSchema: z.object({
|
|
362
|
+
memory_id: z.string().optional().describe("ID of the specific memory to delete. Get this from memos_search or memos_list."),
|
|
363
|
+
memory_ids: z.array(z.string()).optional().describe("List of memory IDs to delete in batch."),
|
|
364
|
+
cube_id: z.string().optional().default(MEMOS_DEFAULT_CUBE).describe("Memory cube ID. AUTO-DERIVE from project path: extract folder name, lowercase, replace -/./space with _, append '_cube'"),
|
|
365
|
+
delete_all: z.boolean().optional().default(false).describe("Set to true to delete ALL memories in the cube. DANGEROUS! Requires explicit user confirmation."),
|
|
366
|
+
}),
|
|
367
|
+
},
|
|
368
|
+
};
|
|
369
|
+
//# sourceMappingURL=tools-registry.js.map
|