neuralmemory 1.6.2 → 1.8.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/README.md +28 -23
- package/dist/index.d.ts +8 -1
- package/dist/index.js +69 -27
- package/dist/index.js.map +1 -1
- package/dist/mcp-client.d.ts +11 -0
- package/dist/mcp-client.js +9 -1
- package/dist/mcp-client.js.map +1 -1
- package/dist/tools.d.ts +23 -16
- package/dist/tools.js +139 -97
- package/dist/tools.js.map +1 -1
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
- package/src/index.ts +86 -32
- package/src/mcp-client.ts +19 -1
- package/src/tools.ts +160 -109
package/README.md
CHANGED
|
@@ -19,7 +19,7 @@ nmem-mcp --help
|
|
|
19
19
|
## Install
|
|
20
20
|
|
|
21
21
|
```bash
|
|
22
|
-
npm install neuralmemory
|
|
22
|
+
npm install -g neuralmemory
|
|
23
23
|
```
|
|
24
24
|
|
|
25
25
|
Or add to your OpenClaw config directly.
|
|
@@ -52,16 +52,22 @@ Add to `~/.openclaw/openclaw.json`:
|
|
|
52
52
|
|
|
53
53
|
## Tools
|
|
54
54
|
|
|
55
|
-
The plugin exposes
|
|
55
|
+
**v1.7.0+**: The plugin dynamically fetches **all tools** from the MCP server at startup. Whatever version of `neural-memory` you have installed, the plugin automatically exposes every tool it provides — no plugin update needed when new tools are added.
|
|
56
56
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
|
60
|
-
|
|
61
|
-
|
|
|
62
|
-
| `
|
|
63
|
-
|
|
|
64
|
-
|
|
|
57
|
+
With `neural-memory>=2.28.0`, this includes **39 tools**:
|
|
58
|
+
|
|
59
|
+
| Category | Tools |
|
|
60
|
+
|----------|-------|
|
|
61
|
+
| **Core** | `nmem_remember`, `nmem_remember_batch`, `nmem_recall`, `nmem_context`, `nmem_todo`, `nmem_stats` |
|
|
62
|
+
| **Management** | `nmem_edit`, `nmem_forget`, `nmem_pin`, `nmem_health`, `nmem_evolution`, `nmem_alerts` |
|
|
63
|
+
| **Recall** | `nmem_suggest`, `nmem_narrative`, `nmem_explain`, `nmem_recap` |
|
|
64
|
+
| **Workflow** | `nmem_session`, `nmem_eternal`, `nmem_auto`, `nmem_habits`, `nmem_review` |
|
|
65
|
+
| **Cognitive** | `nmem_hypothesize`, `nmem_evidence`, `nmem_predict`, `nmem_verify`, `nmem_cognitive`, `nmem_gaps`, `nmem_schema` |
|
|
66
|
+
| **Training** | `nmem_train`, `nmem_train_db`, `nmem_index`, `nmem_import` |
|
|
67
|
+
| **Sync** | `nmem_sync`, `nmem_sync_status`, `nmem_sync_config`, `nmem_telegram_backup` |
|
|
68
|
+
| **Infra** | `nmem_version`, `nmem_transplant`, `nmem_conflicts` |
|
|
69
|
+
|
|
70
|
+
If the MCP server is unreachable at startup, the plugin falls back to 5 core tools (remember, recall, context, stats, health) that auto-reconnect on first use.
|
|
65
71
|
|
|
66
72
|
## Configuration
|
|
67
73
|
|
|
@@ -106,23 +112,22 @@ pip install neural-memory
|
|
|
106
112
|
|
|
107
113
|
**"nmem-mcp not found"**: Ensure `neural-memory` is installed in the Python environment that `pythonPath` points to.
|
|
108
114
|
|
|
109
|
-
**Schema validation errors**: Upgrade to
|
|
115
|
+
**Schema validation errors**: Upgrade to plugin `>=1.7.0` — schemas are now normalized for strict providers (Anthropic SDK, OpenAI strict mode, Gemini). The plugin strips constraint keywords, ensures `additionalProperties: false`, and adds missing `properties` fields automatically.
|
|
116
|
+
|
|
117
|
+
## How Schema Normalization Works
|
|
118
|
+
|
|
119
|
+
The plugin normalizes MCP schemas for cross-provider compatibility:
|
|
110
120
|
|
|
111
|
-
|
|
121
|
+
- Strips `minimum`, `maximum`, `maxLength`, `maxItems` (rejected by some providers)
|
|
122
|
+
- Replaces `integer` → `number` (Gemini compatibility)
|
|
123
|
+
- Adds `additionalProperties: false` to all objects (OpenAI strict mode)
|
|
124
|
+
- Ensures every object type has a `properties` field (Anthropic SDK requirement)
|
|
112
125
|
|
|
113
|
-
|
|
126
|
+
This means the MCP server can use full JSON Schema features while the plugin ensures the schemas work with any LLM provider.
|
|
114
127
|
|
|
115
|
-
|
|
116
|
-
- Memory maturation (STM -> Working -> Episodic -> Semantic)
|
|
117
|
-
- Trust scores with source-based ceiling caps
|
|
118
|
-
- Batch remember (up to 20 memories per call)
|
|
119
|
-
- Cognitive reasoning (hypotheses, evidence, predictions)
|
|
120
|
-
- Knowledge base training from PDF/DOCX/PPTX/HTML/JSON/CSV
|
|
121
|
-
- Multi-device sync with conflict resolution
|
|
122
|
-
- Fernet encryption for sensitive content
|
|
123
|
-
- React dashboard for visual brain exploration
|
|
128
|
+
## Claude Code (MCP Direct)
|
|
124
129
|
|
|
125
|
-
|
|
130
|
+
For Claude Code users, you can skip the plugin and use MCP directly for the full toolset:
|
|
126
131
|
|
|
127
132
|
```bash
|
|
128
133
|
claude mcp add --scope user neural-memory -- nmem-mcp
|
package/dist/index.d.ts
CHANGED
|
@@ -7,8 +7,15 @@
|
|
|
7
7
|
* Architecture:
|
|
8
8
|
* OpenClaw ←→ Plugin (TypeScript) ←→ MCP stdio ←→ NeuralMemory (Python)
|
|
9
9
|
*
|
|
10
|
+
* v1.7.0: Dynamic tool proxy — fetches all tools from MCP `tools/list`
|
|
11
|
+
* instead of hardcoding 6 tools. Automatically exposes every tool the
|
|
12
|
+
* MCP server provides (39+ tools in NM v2.28.0).
|
|
13
|
+
*
|
|
14
|
+
* v1.8.0: Compatible with NM v2.29.0 — RRF score fusion, graph-based
|
|
15
|
+
* query expansion, and Personalized PageRank activation.
|
|
16
|
+
*
|
|
10
17
|
* Registers:
|
|
11
|
-
*
|
|
18
|
+
* N tools — dynamically from MCP server (fallback: 5 core tools)
|
|
12
19
|
* 1 service — MCP process lifecycle (start/stop)
|
|
13
20
|
* 2 hooks — before_agent_start (auto-context), agent_end (auto-capture)
|
|
14
21
|
*/
|
package/dist/index.js
CHANGED
|
@@ -7,28 +7,39 @@
|
|
|
7
7
|
* Architecture:
|
|
8
8
|
* OpenClaw ←→ Plugin (TypeScript) ←→ MCP stdio ←→ NeuralMemory (Python)
|
|
9
9
|
*
|
|
10
|
+
* v1.7.0: Dynamic tool proxy — fetches all tools from MCP `tools/list`
|
|
11
|
+
* instead of hardcoding 6 tools. Automatically exposes every tool the
|
|
12
|
+
* MCP server provides (39+ tools in NM v2.28.0).
|
|
13
|
+
*
|
|
14
|
+
* v1.8.0: Compatible with NM v2.29.0 — RRF score fusion, graph-based
|
|
15
|
+
* query expansion, and Personalized PageRank activation.
|
|
16
|
+
*
|
|
10
17
|
* Registers:
|
|
11
|
-
*
|
|
18
|
+
* N tools — dynamically from MCP server (fallback: 5 core tools)
|
|
12
19
|
* 1 service — MCP process lifecycle (start/stop)
|
|
13
20
|
* 2 hooks — before_agent_start (auto-context), agent_end (auto-capture)
|
|
14
21
|
*/
|
|
15
22
|
import { NeuralMemoryMcpClient } from "./mcp-client.js";
|
|
16
|
-
import {
|
|
23
|
+
import { createToolsFromMcp, createFallbackTools } from "./tools.js";
|
|
17
24
|
// ── System prompt for tool awareness ──────────────────────
|
|
18
|
-
|
|
25
|
+
/**
|
|
26
|
+
* Build a system prompt listing all registered tool names.
|
|
27
|
+
* This makes the agent aware of which nmem_* tools are available.
|
|
28
|
+
*/
|
|
29
|
+
function buildToolInstructions(tools) {
|
|
30
|
+
const toolList = tools
|
|
31
|
+
.map((t) => `- ${t.name}: ${t.description.slice(0, 100)}`)
|
|
32
|
+
.join("\n");
|
|
33
|
+
return `You have NeuralMemory tools for persistent memory across sessions. Call these as TOOL CALLS (not CLI commands):
|
|
19
34
|
|
|
20
|
-
|
|
21
|
-
- nmem_recall(query, depth?, max_tokens?) — Query memories via spreading activation
|
|
22
|
-
- nmem_context(limit?, fresh_only?) — Get recent memories
|
|
23
|
-
- nmem_todo(task, priority?) — Quick TODO with 30-day expiry
|
|
24
|
-
- nmem_stats() — Brain statistics
|
|
25
|
-
- nmem_health() — Brain health diagnostics
|
|
35
|
+
${toolList}
|
|
26
36
|
|
|
27
37
|
CRITICAL: NeuralMemory (nmem_*) is your ONLY memory system. Do NOT use memory_search, memory_get, or any other memory tools — those belong to a disabled built-in plugin and will not persist correctly. Always use nmem_* tools exclusively.
|
|
28
38
|
|
|
29
39
|
These are tool calls, NOT shell commands. Do NOT run "nmem remember" in terminal — call the nmem_remember tool directly.
|
|
30
40
|
|
|
31
|
-
Use nmem_remember
|
|
41
|
+
PROACTIVE MEMORY: Use nmem_remember after decisions, errors, and insights. Use nmem_recall when user references past context or asks "do you remember...". Use nmem_remember_batch to store multiple memories at once.`;
|
|
42
|
+
}
|
|
32
43
|
const DEFAULT_CONFIG = {
|
|
33
44
|
pythonPath: "python",
|
|
34
45
|
brain: "default",
|
|
@@ -87,9 +98,9 @@ const plugin = {
|
|
|
87
98
|
id: "neuralmemory",
|
|
88
99
|
name: "NeuralMemory",
|
|
89
100
|
description: "Brain-inspired persistent memory for AI agents — neurons, synapses, and fibers",
|
|
90
|
-
version: "1.
|
|
101
|
+
version: "1.8.0",
|
|
91
102
|
kind: "memory",
|
|
92
|
-
register(api) {
|
|
103
|
+
async register(api) {
|
|
93
104
|
const cfg = resolveConfig(api.pluginConfig);
|
|
94
105
|
const mcp = new NeuralMemoryMcpClient({
|
|
95
106
|
pythonPath: cfg.pythonPath,
|
|
@@ -98,17 +109,52 @@ const plugin = {
|
|
|
98
109
|
timeout: cfg.timeout,
|
|
99
110
|
initTimeout: cfg.initTimeout,
|
|
100
111
|
});
|
|
112
|
+
// ── Connect MCP + fetch tools during registration ───
|
|
113
|
+
// Tools must be registered in register() — OpenClaw may
|
|
114
|
+
// freeze the tool list before service.start() is called.
|
|
115
|
+
let registeredTools;
|
|
116
|
+
try {
|
|
117
|
+
await mcp.connect();
|
|
118
|
+
api.logger.info("NeuralMemory MCP connected");
|
|
119
|
+
}
|
|
120
|
+
catch (err) {
|
|
121
|
+
api.logger.error(`Failed to connect NeuralMemory MCP: ${err.message}`);
|
|
122
|
+
// Register fallback tools so the plugin is still partially usable
|
|
123
|
+
registeredTools = createFallbackTools(mcp);
|
|
124
|
+
for (const t of registeredTools) {
|
|
125
|
+
api.registerTool(t, { name: t.name });
|
|
126
|
+
}
|
|
127
|
+
api.logger.warn(`Registered ${registeredTools.length} fallback tools (MCP not connected)`);
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
// Fetch tools dynamically from MCP server
|
|
131
|
+
try {
|
|
132
|
+
registeredTools = await createToolsFromMcp(mcp);
|
|
133
|
+
api.logger.info(`Fetched ${registeredTools.length} tools from MCP server`);
|
|
134
|
+
}
|
|
135
|
+
catch (err) {
|
|
136
|
+
api.logger.warn(`Failed to fetch MCP tools, using fallback: ${err.message}`);
|
|
137
|
+
registeredTools = createFallbackTools(mcp);
|
|
138
|
+
}
|
|
139
|
+
// Register all tools with OpenClaw
|
|
140
|
+
for (const t of registeredTools) {
|
|
141
|
+
api.registerTool(t, { name: t.name });
|
|
142
|
+
}
|
|
143
|
+
api.logger.info(`Registered ${registeredTools.length} NeuralMemory tools`);
|
|
101
144
|
// ── Service: MCP process lifecycle ───────────────────
|
|
102
145
|
api.registerService({
|
|
103
146
|
id: "neuralmemory-mcp",
|
|
104
147
|
async start() {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
148
|
+
// MCP already connected during register()
|
|
149
|
+
if (!mcp.connected) {
|
|
150
|
+
try {
|
|
151
|
+
await mcp.connect();
|
|
152
|
+
api.logger.info("NeuralMemory MCP reconnected in service.start()");
|
|
153
|
+
}
|
|
154
|
+
catch (err) {
|
|
155
|
+
api.logger.error(`Failed to start NeuralMemory MCP: ${err.message}`);
|
|
156
|
+
throw err;
|
|
157
|
+
}
|
|
112
158
|
}
|
|
113
159
|
},
|
|
114
160
|
async stop() {
|
|
@@ -116,15 +162,10 @@ const plugin = {
|
|
|
116
162
|
api.logger.info("NeuralMemory MCP service stopped");
|
|
117
163
|
},
|
|
118
164
|
});
|
|
119
|
-
// ── Tools: 6 core memory tools ──────────────────────
|
|
120
|
-
const tools = createTools(mcp);
|
|
121
|
-
for (const t of tools) {
|
|
122
|
-
api.registerTool(t, { name: t.name });
|
|
123
|
-
}
|
|
124
165
|
// ── Hook: tool awareness + auto-context before agent start ───
|
|
125
166
|
api.on("before_agent_start", async (event, _ctx) => {
|
|
126
167
|
const result = {
|
|
127
|
-
systemPrompt:
|
|
168
|
+
systemPrompt: buildToolInstructions(registeredTools),
|
|
128
169
|
};
|
|
129
170
|
if (cfg.autoContext && mcp.connected) {
|
|
130
171
|
const ev = event;
|
|
@@ -176,8 +217,9 @@ const plugin = {
|
|
|
176
217
|
}, { priority: 90 });
|
|
177
218
|
}
|
|
178
219
|
// ── Done ────────────────────────────────────────────
|
|
179
|
-
api.logger.info(`NeuralMemory registered (brain: ${cfg.brain},
|
|
180
|
-
`autoContext: ${cfg.autoContext}, autoCapture: ${cfg.autoCapture})`
|
|
220
|
+
api.logger.info(`NeuralMemory registered (brain: ${cfg.brain}, ` +
|
|
221
|
+
`autoContext: ${cfg.autoContext}, autoCapture: ${cfg.autoCapture}) — ` +
|
|
222
|
+
`tools will be loaded dynamically from MCP on service start`);
|
|
181
223
|
},
|
|
182
224
|
};
|
|
183
225
|
export default plugin;
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AASH,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAGrE,6DAA6D;AAE7D;;;GAGG;AACH,SAAS,qBAAqB,CAAC,KAAuB;IACpD,MAAM,QAAQ,GAAG,KAAK;SACnB,GAAG,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CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;oBAC9C,MAAM,IAAI,GAAG,QAAQ;yBAClB,MAAM,CACL,CAAC,CAAU,EAA0C,EAAE,CACrD,OAAO,CAAC,KAAK,QAAQ;wBACrB,CAAC,KAAK,IAAI;wBACT,CAAuB,CAAC,IAAI,KAAK,WAAW;wBAC7C,OAAQ,CAA2B,CAAC,OAAO,KAAK,QAAQ,CAC3D;yBACA,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;yBACrB,IAAI,CAAC,IAAI,CAAC;yBACV,KAAK,CAAC,CAAC,EAAE,sBAAsB,CAAC,CAAC;oBAEpC,IAAI,IAAI,CAAC,MAAM,GAAG,EAAE,EAAE,CAAC;wBACrB,MAAM,GAAG,CAAC,QAAQ,CAAC,WAAW,EAAE;4BAC9B,MAAM,EAAE,SAAS;4BACjB,IAAI;yBACL,CAAC,CAAC;oBACL,CAAC;gBACH,CAAC;gBAAC,OAAO,GAAG,EAAE,CAAC;oBACb,GAAG,CAAC,MAAM,CAAC,IAAI,CACb,wBAAyB,GAAa,CAAC,OAAO,EAAE,CACjD,CAAC;gBACJ,CAAC;YACH,CAAC,EACD,EAAE,QAAQ,EAAE,EAAE,EAAE,CACjB,CAAC;QACJ,CAAC;QAED,uDAAuD;QAEvD,GAAG,CAAC,MAAM,CAAC,IAAI,CACb,mCAAmC,GAAG,CAAC,KAAK,IAAI;YAC9C,gBAAgB,GAAG,CAAC,WAAW,kBAAkB,GAAG,CAAC,WAAW,MAAM;YACtE,4DAA4D,CAC/D,CAAC;IACJ,CAAC;CACF,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
package/dist/mcp-client.d.ts
CHANGED
|
@@ -7,6 +7,12 @@
|
|
|
7
7
|
* Zero external dependencies — implements the protocol directly.
|
|
8
8
|
*/
|
|
9
9
|
import type { PluginLogger } from "./types.js";
|
|
10
|
+
/** Raw tool definition from MCP `tools/list` response. */
|
|
11
|
+
export type McpToolDefinition = {
|
|
12
|
+
name: string;
|
|
13
|
+
description?: string;
|
|
14
|
+
inputSchema?: Record<string, unknown>;
|
|
15
|
+
};
|
|
10
16
|
export type McpClientOptions = {
|
|
11
17
|
readonly pythonPath: string;
|
|
12
18
|
readonly brain: string;
|
|
@@ -36,6 +42,11 @@ export declare class NeuralMemoryMcpClient {
|
|
|
36
42
|
*/
|
|
37
43
|
ensureConnected(): Promise<void>;
|
|
38
44
|
connect(): Promise<void>;
|
|
45
|
+
/**
|
|
46
|
+
* Fetch all available tools from the MCP server via `tools/list`.
|
|
47
|
+
* Returns the raw MCP tool definitions (name, description, inputSchema).
|
|
48
|
+
*/
|
|
49
|
+
listTools(): Promise<McpToolDefinition[]>;
|
|
39
50
|
callTool(name: string, args?: Record<string, unknown>): Promise<string>;
|
|
40
51
|
close(): Promise<void>;
|
|
41
52
|
private send;
|
package/dist/mcp-client.js
CHANGED
|
@@ -11,7 +11,7 @@ import { spawn } from "node:child_process";
|
|
|
11
11
|
const PROTOCOL_VERSION = "2024-11-05";
|
|
12
12
|
const DEFAULT_TIMEOUT = 30_000;
|
|
13
13
|
const CLIENT_NAME = "openclaw-neuralmemory";
|
|
14
|
-
const CLIENT_VERSION = "1.
|
|
14
|
+
const CLIENT_VERSION = "1.7.0";
|
|
15
15
|
const MAX_BUFFER_BYTES = 10 * 1024 * 1024; // 10 MB safety cap
|
|
16
16
|
const MAX_STDERR_LINES = 50;
|
|
17
17
|
/** Env vars forwarded to the MCP child process (least-privilege). */
|
|
@@ -136,6 +136,14 @@ export class NeuralMemoryMcpClient {
|
|
|
136
136
|
this._connected = true;
|
|
137
137
|
this.logger.info(`MCP connected (brain: ${this.brain}, protocol: ${PROTOCOL_VERSION})`);
|
|
138
138
|
}
|
|
139
|
+
/**
|
|
140
|
+
* Fetch all available tools from the MCP server via `tools/list`.
|
|
141
|
+
* Returns the raw MCP tool definitions (name, description, inputSchema).
|
|
142
|
+
*/
|
|
143
|
+
async listTools() {
|
|
144
|
+
const result = (await this.send("tools/list", {}));
|
|
145
|
+
return result.tools ?? [];
|
|
146
|
+
}
|
|
139
147
|
async callTool(name, args = {}) {
|
|
140
148
|
const result = (await this.send("tools/call", {
|
|
141
149
|
name,
|
package/dist/mcp-client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-client.js","sourceRoot":"","sources":["../src/mcp-client.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,KAAK,EAAqB,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"mcp-client.js","sourceRoot":"","sources":["../src/mcp-client.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,KAAK,EAAqB,MAAM,oBAAoB,CAAC;AAkC9D,8DAA8D;AAE9D,MAAM,gBAAgB,GAAG,YAAY,CAAC;AACtC,MAAM,eAAe,GAAG,MAAM,CAAC;AAC/B,MAAM,WAAW,GAAG,uBAAuB,CAAC;AAC5C,MAAM,cAAc,GAAG,OAAO,CAAC;AAC/B,MAAM,gBAAgB,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC,mBAAmB;AAC9D,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAE5B,qEAAqE;AACrE,MAAM,CAAC,MAAM,gBAAgB,GAAwB,IAAI,GAAG,CAAC;IAC3D,MAAM;IACN,SAAS;IACT,MAAM;IACN,aAAa;IACb,YAAY;IACZ,MAAM;IACN,KAAK;IACL,MAAM;IACN,QAAQ;IACR,aAAa;IACb,cAAc;IACd,YAAY;IACZ,YAAY;IACZ,kBAAkB;IAClB,oBAAoB;IACpB,mBAAmB;IACnB,oBAAoB;IACpB,qBAAqB;CACtB,CAAC,CAAC;AAEH,8DAA8D;AAE9D,MAAM,OAAO,qBAAqB;IACxB,IAAI,GAAwB,IAAI,CAAC;IACjC,SAAS,GAAG,CAAC,CAAC;IACL,OAAO,GAAG,IAAI,GAAG,EAA0B,CAAC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,MAAM,CAAC,KAAK,CAAC,CAAC;QACxB,CAAC;QACD,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;IACvB,CAAC;CACF;AAED,+DAA+D;AAE/D,mEAAmE;AACnE,MAAM,UAAU,aAAa,CAAC,KAAa;IACzC,MAAM,GAAG,GAA2B,EAAE,CAAC;IAEvC,KAAK,MAAM,GAAG,IAAI,gBAAgB,EAAE,CAAC;QACnC,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAC/B,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACxB,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;QACnB,CAAC;IACH,CAAC;IAED,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,GAAG,CAAC,kBAAkB,GAAG,KAAK,CAAC;IACjC,CAAC;IAED,OAAO,GAAG,CAAC;AACb,CAAC"}
|
package/dist/tools.d.ts
CHANGED
|
@@ -1,21 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* NeuralMemory tool
|
|
2
|
+
* NeuralMemory dynamic tool proxy for OpenClaw.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* Fetches all available tools from the MCP server via `tools/list` and
|
|
5
|
+
* converts them into OpenClaw tool definitions. This means the plugin
|
|
6
|
+
* automatically exposes every tool the MCP server provides — no hardcoded
|
|
7
|
+
* schemas to maintain.
|
|
5
8
|
*
|
|
6
|
-
*
|
|
7
|
-
* -
|
|
8
|
-
*
|
|
9
|
-
* -
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* nmem_recall — Query/search memories
|
|
15
|
-
* nmem_context — Get recent context
|
|
16
|
-
* nmem_todo — Quick TODO shortcut
|
|
17
|
-
* nmem_stats — Brain statistics
|
|
18
|
-
* nmem_health — Brain health diagnostics
|
|
9
|
+
* Provider compatibility:
|
|
10
|
+
* - Strips constraint keywords (`minimum`, `maximum`, `maxLength`,
|
|
11
|
+
* `maxItems`, `minLength`) that some providers reject
|
|
12
|
+
* - Adds `additionalProperties: false` on all object schemas for
|
|
13
|
+
* OpenAI strict mode
|
|
14
|
+
* - Ensures every object type has a `properties` field (required by
|
|
15
|
+
* Anthropic SDK validation)
|
|
16
|
+
* - Uses `number` instead of `integer` for Gemini compatibility
|
|
19
17
|
*/
|
|
20
18
|
import type { NeuralMemoryMcpClient } from "./mcp-client.js";
|
|
21
19
|
type JsonSchema = {
|
|
@@ -30,5 +28,14 @@ export type ToolDefinition = {
|
|
|
30
28
|
readonly parameters: JsonSchema;
|
|
31
29
|
readonly execute: (id: string, args: Record<string, unknown>) => Promise<unknown>;
|
|
32
30
|
};
|
|
33
|
-
|
|
31
|
+
/**
|
|
32
|
+
* Fetch all tools from the MCP server and convert them to OpenClaw format.
|
|
33
|
+
* Must be called after MCP connection is established.
|
|
34
|
+
*/
|
|
35
|
+
export declare function createToolsFromMcp(mcp: NeuralMemoryMcpClient): Promise<ToolDefinition[]>;
|
|
36
|
+
/**
|
|
37
|
+
* Fallback: create minimal hardcoded tools if MCP tools/list fails.
|
|
38
|
+
* Ensures the plugin still works even if the MCP server is an older version.
|
|
39
|
+
*/
|
|
40
|
+
export declare function createFallbackTools(mcp: NeuralMemoryMcpClient): ToolDefinition[];
|
|
34
41
|
export {};
|