@dudamel/mcp-memory 2026.924.1 → 2026.928.1
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/tools/conversations.d.ts.map +1 -1
- package/dist/tools/conversations.js +4 -3
- package/dist/tools/conversations.js.map +1 -1
- package/dist/tools/files.d.ts.map +1 -1
- package/dist/tools/files.js +8 -5
- package/dist/tools/files.js.map +1 -1
- package/dist/tools/memories.d.ts.map +1 -1
- package/dist/tools/memories.js +51 -54
- package/dist/tools/memories.js.map +1 -1
- package/dist/util.d.ts +26 -3
- package/dist/util.d.ts.map +1 -1
- package/dist/util.js +35 -4
- package/dist/util.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversations.d.ts","sourceRoot":"","sources":["../../src/tools/conversations.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG/C,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,SAAS,EACjB,MAAM,EAAE,gBAAgB,EACxB,GAAG,EAAE,WAAW,GACf,IAAI,
|
|
1
|
+
{"version":3,"file":"conversations.d.ts","sourceRoot":"","sources":["../../src/tools/conversations.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG/C,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,SAAS,EACjB,MAAM,EAAE,gBAAgB,EACxB,GAAG,EAAE,WAAW,GACf,IAAI,CAyCN"}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { agentParams, errorResult, jsonResult } from '../util.js';
|
|
2
|
+
import { agentNameInput, agentParams, errorResult, jsonResult } from '../util.js';
|
|
3
3
|
export function registerConversationTools(server, client, ctx) {
|
|
4
4
|
server.registerTool('list-conversations', {
|
|
5
5
|
description: 'List your past conversations. Scoped to the current agent when one is in context; ' +
|
|
6
6
|
'otherwise every conversation you have had, with any agent. Returns conversation ' +
|
|
7
7
|
'metadata including ids, timestamps, and summaries.',
|
|
8
|
+
inputSchema: { ...agentNameInput(ctx) },
|
|
8
9
|
annotations: { readOnlyHint: true },
|
|
9
|
-
}, async () => {
|
|
10
|
+
}, async ({ agentName }) => {
|
|
10
11
|
try {
|
|
11
|
-
const result = await client.get('/api/chat/conversations', agentParams(ctx));
|
|
12
|
+
const result = await client.get('/api/chat/conversations', agentParams(ctx, agentName));
|
|
12
13
|
return jsonResult(result);
|
|
13
14
|
}
|
|
14
15
|
catch (err) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversations.js","sourceRoot":"","sources":["../../src/tools/conversations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"conversations.js","sourceRoot":"","sources":["../../src/tools/conversations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAElF,MAAM,UAAU,yBAAyB,CACvC,MAAiB,EACjB,MAAwB,EACxB,GAAgB;IAEhB,MAAM,CAAC,YAAY,CACjB,oBAAoB,EACpB;QACE,WAAW,EACT,oFAAoF;YACpF,kFAAkF;YAClF,oDAAoD;QACtD,WAAW,EAAE,EAAE,GAAG,cA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EAAE,MAAM,aAAa,CAAC;AAG/C;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,SAAS,EACjB,MAAM,EAAE,gBAAgB,EACxB,GAAG,EAAE,WAAW,GACf,IAAI,
|
|
1
|
+
{"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../../src/tools/files.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG/C;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,SAAS,EACjB,MAAM,EAAE,gBAAgB,EACxB,GAAG,EAAE,WAAW,GACf,IAAI,CA4IN"}
|
package/dist/tools/files.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { agentParams, errorResult, jsonResult } from '../util.js';
|
|
2
|
+
import { agentBody, agentNameInput, agentParams, errorResult, jsonResult } from '../util.js';
|
|
3
3
|
/**
|
|
4
4
|
* File tools (Plan 43 Etapa 5, Decisión 3).
|
|
5
5
|
*
|
|
@@ -9,6 +9,7 @@ import { agentParams, errorResult, jsonResult } from '../util.js';
|
|
|
9
9
|
* object storage and producing garbage nobody asked for.
|
|
10
10
|
*/
|
|
11
11
|
export function registerFileTools(server, client, ctx) {
|
|
12
|
+
const agentInput = agentNameInput(ctx);
|
|
12
13
|
server.registerTool('save-file', {
|
|
13
14
|
description: 'Store a file so it survives this turn. The turn workspace is wiped when the turn ' +
|
|
14
15
|
'ends, so anything you want to keep — a report, a diff, a generated CSV — has to be ' +
|
|
@@ -22,9 +23,10 @@ export function registerFileTools(server, client, ctx) {
|
|
|
22
23
|
.string()
|
|
23
24
|
.optional()
|
|
24
25
|
.describe('Conversation this belongs to. Defaults to the current one.'),
|
|
26
|
+
...agentInput,
|
|
25
27
|
},
|
|
26
28
|
annotations: { readOnlyHint: false, destructiveHint: false },
|
|
27
|
-
}, async ({ fileName, mimeType, contentBase64, conversationId }) => {
|
|
29
|
+
}, async ({ fileName, mimeType, contentBase64, conversationId, agentName }) => {
|
|
28
30
|
try {
|
|
29
31
|
return jsonResult(await client.post('/api/chat/files', {
|
|
30
32
|
fileName,
|
|
@@ -33,7 +35,7 @@ export function registerFileTools(server, client, ctx) {
|
|
|
33
35
|
// The current conversation unless told otherwise, so the common case needs no
|
|
34
36
|
// argument and the file is findable where it was produced.
|
|
35
37
|
conversationId: conversationId ?? ctx.conversationId,
|
|
36
|
-
...(ctx
|
|
38
|
+
...agentBody(ctx, agentName),
|
|
37
39
|
}));
|
|
38
40
|
}
|
|
39
41
|
catch (err) {
|
|
@@ -53,11 +55,12 @@ export function registerFileTools(server, client, ctx) {
|
|
|
53
55
|
.optional()
|
|
54
56
|
.describe("List everything this agent saved, not just this conversation's"),
|
|
55
57
|
limit: z.number().optional().describe('Max files to return (default 50)'),
|
|
58
|
+
...agentInput,
|
|
56
59
|
},
|
|
57
60
|
annotations: { readOnlyHint: true },
|
|
58
|
-
}, async ({ conversationId, allConversations, limit }) => {
|
|
61
|
+
}, async ({ conversationId, allConversations, limit, agentName }) => {
|
|
59
62
|
try {
|
|
60
|
-
const params = agentParams(ctx);
|
|
63
|
+
const params = agentParams(ctx, agentName);
|
|
61
64
|
if (!allConversations) {
|
|
62
65
|
const target = conversationId ?? ctx.conversationId;
|
|
63
66
|
if (target)
|
package/dist/tools/files.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"files.js","sourceRoot":"","sources":["../../src/tools/files.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"files.js","sourceRoot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EAAE;YACX,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,sCAAsC,CAAC;SAChE;QACD,WAAW,EAAE,EAAE,YAAY,EAAE,KAAK,EAAE,eAAe,EAAE,IAAI,EAAE;KAC5D,EACD,KAAK,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE;QACf,IAAI,CAAC;YACH,MAAM,MAAM,CAAC,MAAM,CAAC,mBAAmB,kBAAkB,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;YACjE,OAAO,UAAU,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC;QAC3C,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO,WAAW,CAAC,GAAG,CAAC,CAAC;QAC1B,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memories.d.ts","sourceRoot":"","sources":["../../src/tools/memories.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"memories.d.ts","sourceRoot":"","sources":["../../src/tools/memories.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AA4D/C,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,SAAS,EACjB,MAAM,EAAE,gBAAgB,EACxB,GAAG,EAAE,WAAW,GACf,IAAI,CAgNN"}
|
package/dist/tools/memories.js
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { agentParams, errorResult, jsonResult } from '../util.js';
|
|
2
|
+
import { agentBody, agentNameInput, agentParams, effectiveAgent, errorResult, jsonResult, } from '../util.js';
|
|
3
3
|
// The 4 memory scopes (2×2). The server maps each to (agent_name, user_id) columns.
|
|
4
4
|
//
|
|
5
5
|
// Each line states WHO WILL READ IT, not just what it means. The scopes are not equally
|
|
6
6
|
// consequential — 'org' is visible to every agent and every person in the organisation — and
|
|
7
7
|
// an LLM choosing between four abstract labels has no way to know that unless the description
|
|
8
8
|
// says so. Every scope stays writable: the risk here is an ACCIDENTAL over-share, not a
|
|
9
|
-
// malicious one, and the fix for an accident is a description that names the blast radius
|
|
10
|
-
// (Plan 52 A.1).
|
|
9
|
+
// malicious one, and the fix for an accident is a description that names the blast radius.
|
|
11
10
|
const SCOPE_HEADER = 'Scope of the memory — this is WHO WILL BE ABLE TO READ IT. Pick the NARROWEST that fits:\n';
|
|
12
11
|
const RELATIONAL_LINE = "- 'relational': you (this agent) + this one user. Nobody else. The default for a " +
|
|
13
12
|
'preference or fact about the person you are talking to.\n';
|
|
@@ -18,41 +17,36 @@ const AGENT_LINE = "- 'agent': you (this agent), across ALL users — everyone w
|
|
|
18
17
|
const ORG_LINE = "- 'org': EVERY agent and EVERY user in the organisation. The widest reach there is — only " +
|
|
19
18
|
'for a fact true of the whole organisation that you would be comfortable showing anyone ' +
|
|
20
19
|
'in it.\n';
|
|
21
|
-
function scopeDescription(
|
|
22
|
-
return
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
'
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
'Ask, in order: is this about ONE person (relational/profile) or about nobody in ' +
|
|
35
|
-
'particular (agent/org)? Then: does it really need to be visible beyond this ' +
|
|
36
|
-
'conversation?';
|
|
20
|
+
function scopeDescription(unbound) {
|
|
21
|
+
return (SCOPE_HEADER +
|
|
22
|
+
RELATIONAL_LINE +
|
|
23
|
+
PROFILE_LINE +
|
|
24
|
+
AGENT_LINE +
|
|
25
|
+
ORG_LINE +
|
|
26
|
+
(unbound
|
|
27
|
+
? "'relational' and 'agent' need agentName — without an agent they have no one to " +
|
|
28
|
+
'belong to. '
|
|
29
|
+
: '') +
|
|
30
|
+
'Ask, in order: is this about ONE person (relational/profile) or about nobody in ' +
|
|
31
|
+
'particular (agent/org)? Then: does it really need to be visible beyond this ' +
|
|
32
|
+
'conversation?');
|
|
37
33
|
}
|
|
34
|
+
/** The quadrants that carry an agent column — impossible without one. */
|
|
35
|
+
const AGENT_SCOPES = new Set(['relational', 'agent']);
|
|
38
36
|
export function registerMemoryTools(server, client, ctx) {
|
|
39
|
-
//
|
|
40
|
-
//
|
|
41
|
-
//
|
|
42
|
-
//
|
|
43
|
-
|
|
44
|
-
const
|
|
45
|
-
const
|
|
46
|
-
? z.enum(['profile', 'org'])
|
|
47
|
-
: z.enum(['relational', 'profile', 'agent', 'org']);
|
|
37
|
+
// Unbound (no DUDAMEL_AGENT_NAME: a shared copy on a laptop, or a user's own terminal) the
|
|
38
|
+
// agent comes per call, as `agentName`. The four quadrants are all on the menu; the two that
|
|
39
|
+
// need an agent are refused locally when none was named, before the server says the same
|
|
40
|
+
// (MEMORY_AGENT_REQUIRED) — a schema is a hint, not an enforcement point.
|
|
41
|
+
const unbound = ctx.agentName === null;
|
|
42
|
+
const scopes = z.enum(['relational', 'profile', 'agent', 'org']);
|
|
43
|
+
const agentInput = agentNameInput(ctx);
|
|
48
44
|
// ── Read: list (summaries) ─────────────────────────────────────────────────
|
|
49
45
|
server.registerTool('list-memories', {
|
|
50
46
|
description: 'List memories relevant to the current user (summaries only, NOT full content). ' +
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
: 'Returns the union of everything you know that applies here: your notes on this ' +
|
|
55
|
-
'user, their profile, and your/org general knowledge. ') +
|
|
47
|
+
'Returns the union of everything you know that applies here: your notes on this ' +
|
|
48
|
+
'user, their profile, and your/org general knowledge' +
|
|
49
|
+
(unbound ? ' (without agentName: only their profile and org knowledge). ' : '. ') +
|
|
56
50
|
'Call this at the start of an interaction. ' +
|
|
57
51
|
'You MUST call this before creating a memory. Use get-memory to read a full entry.',
|
|
58
52
|
inputSchema: {
|
|
@@ -60,12 +54,13 @@ export function registerMemoryTools(server, client, ctx) {
|
|
|
60
54
|
.string()
|
|
61
55
|
.optional()
|
|
62
56
|
.describe('Keyword filter over summary + content (omit to list all)'),
|
|
63
|
-
scope:
|
|
57
|
+
scope: scopes.optional().describe('Filter to a single scope'),
|
|
58
|
+
...agentInput,
|
|
64
59
|
},
|
|
65
60
|
annotations: { readOnlyHint: true },
|
|
66
|
-
}, async ({ q, scope }) => {
|
|
61
|
+
}, async ({ q, scope, agentName }) => {
|
|
67
62
|
try {
|
|
68
|
-
const params = agentParams(ctx);
|
|
63
|
+
const params = agentParams(ctx, agentName);
|
|
69
64
|
if (q)
|
|
70
65
|
params['q'] = q;
|
|
71
66
|
if (scope)
|
|
@@ -87,11 +82,11 @@ export function registerMemoryTools(server, client, ctx) {
|
|
|
87
82
|
server.registerTool('get-memory', {
|
|
88
83
|
description: 'Get the full content of a single memory by id. You MUST call this before updating a ' +
|
|
89
84
|
'memory (so you edit its real content, not blindly). Ids come from list-memories.',
|
|
90
|
-
inputSchema: { id: z.string().describe('Memory id (from list-memories)') },
|
|
85
|
+
inputSchema: { id: z.string().describe('Memory id (from list-memories)'), ...agentInput },
|
|
91
86
|
annotations: { readOnlyHint: true },
|
|
92
|
-
}, async ({ id }) => {
|
|
87
|
+
}, async ({ id, agentName }) => {
|
|
93
88
|
try {
|
|
94
|
-
const memory = await client.get(`/api/chat/memories/${id}`, agentParams(ctx));
|
|
89
|
+
const memory = await client.get(`/api/chat/memories/${id}`, agentParams(ctx, agentName));
|
|
95
90
|
if (memory?.id) {
|
|
96
91
|
ctx.fetchedIds.add(memory.id);
|
|
97
92
|
ctx.seenIds.add(memory.id);
|
|
@@ -109,21 +104,22 @@ export function registerMemoryTools(server, client, ctx) {
|
|
|
109
104
|
'multi-line markdown. A one-line summary is generated automatically; if the summary ' +
|
|
110
105
|
'service is unavailable the memory is NOT saved and you should retry later.',
|
|
111
106
|
inputSchema: {
|
|
112
|
-
|
|
113
|
-
// a write that says nothing about reach lands on the user rather than the whole org.
|
|
114
|
-
scope: agentless
|
|
115
|
-
? z.enum(['profile', 'org']).default('profile').describe(scopeDescription(true))
|
|
116
|
-
: z.enum(['relational', 'profile', 'agent', 'org']).describe(scopeDescription(false)),
|
|
107
|
+
scope: scopes.describe(scopeDescription(unbound)),
|
|
117
108
|
content: z.string().describe('Full memory text (multi-line markdown allowed)'),
|
|
109
|
+
...agentInput,
|
|
118
110
|
},
|
|
119
111
|
annotations: { readOnlyHint: false, destructiveHint: false },
|
|
120
|
-
}, async ({ scope, content }) => {
|
|
112
|
+
}, async ({ scope, content, agentName }) => {
|
|
121
113
|
if (!ctx.hasListed) {
|
|
122
114
|
return errorResult(new Error('Call list-memories first (to check for an existing memory to update instead of duplicating).'));
|
|
123
115
|
}
|
|
116
|
+
if (AGENT_SCOPES.has(scope) && !effectiveAgent(ctx, agentName)) {
|
|
117
|
+
return errorResult(new Error(`Scope '${scope}' belongs to an agent: pass agentName (the agent you are acting as), ` +
|
|
118
|
+
"or use 'profile' / 'org'."));
|
|
119
|
+
}
|
|
124
120
|
try {
|
|
125
121
|
const result = await client.post('/api/chat/memories', {
|
|
126
|
-
...(ctx
|
|
122
|
+
...agentBody(ctx, agentName),
|
|
127
123
|
scope,
|
|
128
124
|
content,
|
|
129
125
|
});
|
|
@@ -143,14 +139,15 @@ export function registerMemoryTools(server, client, ctx) {
|
|
|
143
139
|
inputSchema: {
|
|
144
140
|
id: z.string().describe('Memory id to update'),
|
|
145
141
|
content: z.string().describe('New full memory text (replaces the old content)'),
|
|
142
|
+
...agentInput,
|
|
146
143
|
},
|
|
147
144
|
annotations: { readOnlyHint: false, destructiveHint: false },
|
|
148
|
-
}, async ({ id, content }) => {
|
|
145
|
+
}, async ({ id, content, agentName }) => {
|
|
149
146
|
if (!ctx.fetchedIds.has(id)) {
|
|
150
147
|
return errorResult(new Error(`Call get-memory("${id}") first so you update its real content, not a guess.`));
|
|
151
148
|
}
|
|
152
149
|
try {
|
|
153
|
-
const result = await client.put(`/api/chat/memories/${id}`, { content }, agentParams(ctx));
|
|
150
|
+
const result = await client.put(`/api/chat/memories/${id}`, { content }, agentParams(ctx, agentName));
|
|
154
151
|
return jsonResult(result);
|
|
155
152
|
}
|
|
156
153
|
catch (err) {
|
|
@@ -160,14 +157,14 @@ export function registerMemoryTools(server, client, ctx) {
|
|
|
160
157
|
// ── Write: delete ──────────────────────────────────────────────────────────
|
|
161
158
|
server.registerTool('delete-memory', {
|
|
162
159
|
description: 'Delete a memory by id. Requires the id to have been seen via list-memories or get-memory.',
|
|
163
|
-
inputSchema: { id: z.string().describe('Memory id to delete') },
|
|
160
|
+
inputSchema: { id: z.string().describe('Memory id to delete'), ...agentInput },
|
|
164
161
|
annotations: { readOnlyHint: false, destructiveHint: true },
|
|
165
|
-
}, async ({ id }) => {
|
|
162
|
+
}, async ({ id, agentName }) => {
|
|
166
163
|
if (!ctx.seenIds.has(id)) {
|
|
167
164
|
return errorResult(new Error(`Cannot delete ${id}: not seen in a prior list/get. Call list-memories first.`));
|
|
168
165
|
}
|
|
169
166
|
try {
|
|
170
|
-
await client.delete(`/api/chat/memories/${id}`, agentParams(ctx));
|
|
167
|
+
await client.delete(`/api/chat/memories/${id}`, agentParams(ctx, agentName));
|
|
171
168
|
ctx.seenIds.delete(id);
|
|
172
169
|
ctx.fetchedIds.delete(id);
|
|
173
170
|
return jsonResult({ deleted: true, id });
|
|
@@ -180,14 +177,14 @@ export function registerMemoryTools(server, client, ctx) {
|
|
|
180
177
|
server.registerTool('mark-memory-useful', {
|
|
181
178
|
description: 'Mark a memory as useful now (bumps its recency ranking). Requires the id to have been ' +
|
|
182
179
|
'seen via list-memories or get-memory.',
|
|
183
|
-
inputSchema: { id: z.string().describe('Memory id to mark as useful') },
|
|
180
|
+
inputSchema: { id: z.string().describe('Memory id to mark as useful'), ...agentInput },
|
|
184
181
|
annotations: { readOnlyHint: false, destructiveHint: false },
|
|
185
|
-
}, async ({ id }) => {
|
|
182
|
+
}, async ({ id, agentName }) => {
|
|
186
183
|
if (!ctx.seenIds.has(id)) {
|
|
187
184
|
return errorResult(new Error(`Cannot mark ${id}: not seen in a prior list/get. Call list-memories first.`));
|
|
188
185
|
}
|
|
189
186
|
try {
|
|
190
|
-
const result = await client.post(`/api/chat/memories/${id}/useful`, undefined, agentParams(ctx));
|
|
187
|
+
const result = await client.post(`/api/chat/memories/${id}/useful`, undefined, agentParams(ctx, agentName));
|
|
191
188
|
return jsonResult(result);
|
|
192
189
|
}
|
|
193
190
|
catch (err) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memories.js","sourceRoot":"","sources":["../../src/tools/memories.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,
|
|
1
|
+
{"version":3,"file":"memories.js","sourceRoot":"","sources":["../../src/tools/memories.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,EACL,SAAS,EACT,cAAc,EACd,WAAW,EACX,cAAc,EACd,WAAW,EACX,UAAU,GACX,MAAM,YAAY,CAAC;AAEpB,oFAAoF;AACpF,EAAE;AACF,wFAAwF;AACxF,6FAA6F;AAC7F,8FAA8F;AAC9F,wFAAwF;AACxF,2FAA2F;AAC3F,MAAM,YAAY,GAChB,4FAA4F,CAAC;AAE/F,MAAM,eAAe,GACnB,mFAAmF;IACnF,2DAA2D,CAAC;AAC9D,MAAM,YAAY,GAChB,wFAAwF;IACxF,0FAA0F,CAAC;AAC7F,MAAM,UAAU,GACd,yFAAyF;IACzF,8EAA8E,CAAC;AACjF,MAAM,QAAQ,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AE,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,6BAA6B,CAAC,EAAE,GAAG,UAAU,EAAE;QACtF,WAAW,EAAE,EAAE,YAAY,EAAE,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE;KAC7D,EACD,KAAK,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE;QAC1B,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC;YACzB,OAAO,WAAW,CAChB,IAAI,KAAK,CAAC,eAAe,EAAE,2DAA2D,CAAC,CACxF,CAAC;QACJ,CAAC;QACD,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,IAAI,CAC9B,sBAAsB,EAAE,SAAS,EACjC,SAAS,EACT,WAAW,CAAC,GAAG,EAAE,SAAS,CAAC,CAC5B,CAAC;YACF,OAAO,UAAU,CAAC,MAAM,CAAC,CAAC;QAC5B,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO,WAAW,CAAC,GAAG,CAAC,CAAC;QAC1B,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
package/dist/util.d.ts
CHANGED
|
@@ -1,12 +1,34 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
1
2
|
import type { ToolContext } from './types.js';
|
|
3
|
+
declare const AGENT_NAME_FIELD: z.ZodOptional<z.ZodString>;
|
|
4
|
+
/**
|
|
5
|
+
* The `agentName` tool argument — offered ONLY when no agent is bound to this process.
|
|
6
|
+
*
|
|
7
|
+
* A bound process (`DUDAMEL_AGENT_NAME`, set by the runtime for its own agents) already knows
|
|
8
|
+
* whose memory it serves, so the argument would be noise at best and a contradiction at worst.
|
|
9
|
+
* An unbound one is the shared copy a marketplace tools plugin installs on a laptop: several
|
|
10
|
+
* agents talk to the same process, so each one names itself per call.
|
|
11
|
+
*/
|
|
12
|
+
export declare function agentNameInput(ctx: ToolContext): {
|
|
13
|
+
agentName?: typeof AGENT_NAME_FIELD;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* The agent a call acts for: the bound one when there is one — an argument can never override
|
|
17
|
+
* it — otherwise whatever the caller named. null is the legitimate agent-less principal.
|
|
18
|
+
*/
|
|
19
|
+
export declare function effectiveAgent(ctx: ToolContext, requested?: string): string | null;
|
|
2
20
|
/**
|
|
3
21
|
* The `?agent=` query param — PRESENT only when an agent is really in context.
|
|
4
22
|
*
|
|
5
23
|
* Sending `agent=` empty is not the same as omitting it: the server reads an empty name as a
|
|
6
|
-
* request it cannot honour, while an absent one is the legitimate agent-less principal
|
|
7
|
-
*
|
|
24
|
+
* request it cannot honour, while an absent one is the legitimate agent-less principal. Every
|
|
25
|
+
* tool goes through here so the distinction cannot be lost at one site.
|
|
8
26
|
*/
|
|
9
|
-
export declare function agentParams(ctx: ToolContext): Record<string, string>;
|
|
27
|
+
export declare function agentParams(ctx: ToolContext, requested?: string): Record<string, string>;
|
|
28
|
+
/** The `agentName` body field, under the same rule as {@link agentParams}. */
|
|
29
|
+
export declare function agentBody(ctx: ToolContext, requested?: string): {
|
|
30
|
+
agentName?: string;
|
|
31
|
+
};
|
|
10
32
|
export declare function jsonResult(data: unknown): {
|
|
11
33
|
content: {
|
|
12
34
|
type: "text";
|
|
@@ -20,4 +42,5 @@ export declare function errorResult(error: unknown): {
|
|
|
20
42
|
}[];
|
|
21
43
|
isError: boolean;
|
|
22
44
|
};
|
|
45
|
+
export {};
|
|
23
46
|
//# sourceMappingURL=util.d.ts.map
|
package/dist/util.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C,QAAA,MAAM,gBAAgB,4BAOnB,CAAC;AAEJ;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,WAAW,GAAG;IAAE,SAAS,CAAC,EAAE,OAAO,gBAAgB,CAAA;CAAE,CAExF;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,WAAW,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAElF;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,WAAW,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAGxF;AAED,8EAA8E;AAC9E,wBAAgB,SAAS,CAAC,GAAG,EAAE,WAAW,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,CAGtF;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,OAAO;;;;;EAIvC;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO;;;;;;EAWzC"}
|
package/dist/util.js
CHANGED
|
@@ -1,13 +1,44 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
1
2
|
import { DudamelApiError } from './http-client.js';
|
|
3
|
+
const AGENT_NAME_FIELD = z
|
|
4
|
+
.string()
|
|
5
|
+
.optional()
|
|
6
|
+
.describe('The Dudamel agent you are acting as (e.g. "dudamel-expert"). Pass it on every call when ' +
|
|
7
|
+
'you are one — it is what scopes memories, files and conversations to that agent. Omit ' +
|
|
8
|
+
'it only when you are not acting as any Dudamel agent.');
|
|
9
|
+
/**
|
|
10
|
+
* The `agentName` tool argument — offered ONLY when no agent is bound to this process.
|
|
11
|
+
*
|
|
12
|
+
* A bound process (`DUDAMEL_AGENT_NAME`, set by the runtime for its own agents) already knows
|
|
13
|
+
* whose memory it serves, so the argument would be noise at best and a contradiction at worst.
|
|
14
|
+
* An unbound one is the shared copy a marketplace tools plugin installs on a laptop: several
|
|
15
|
+
* agents talk to the same process, so each one names itself per call.
|
|
16
|
+
*/
|
|
17
|
+
export function agentNameInput(ctx) {
|
|
18
|
+
return ctx.agentName === null ? { agentName: AGENT_NAME_FIELD } : {};
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* The agent a call acts for: the bound one when there is one — an argument can never override
|
|
22
|
+
* it — otherwise whatever the caller named. null is the legitimate agent-less principal.
|
|
23
|
+
*/
|
|
24
|
+
export function effectiveAgent(ctx, requested) {
|
|
25
|
+
return ctx.agentName ?? (requested?.trim() || null);
|
|
26
|
+
}
|
|
2
27
|
/**
|
|
3
28
|
* The `?agent=` query param — PRESENT only when an agent is really in context.
|
|
4
29
|
*
|
|
5
30
|
* Sending `agent=` empty is not the same as omitting it: the server reads an empty name as a
|
|
6
|
-
* request it cannot honour, while an absent one is the legitimate agent-less principal
|
|
7
|
-
*
|
|
31
|
+
* request it cannot honour, while an absent one is the legitimate agent-less principal. Every
|
|
32
|
+
* tool goes through here so the distinction cannot be lost at one site.
|
|
8
33
|
*/
|
|
9
|
-
export function agentParams(ctx) {
|
|
10
|
-
|
|
34
|
+
export function agentParams(ctx, requested) {
|
|
35
|
+
const agent = effectiveAgent(ctx, requested);
|
|
36
|
+
return agent ? { agent } : {};
|
|
37
|
+
}
|
|
38
|
+
/** The `agentName` body field, under the same rule as {@link agentParams}. */
|
|
39
|
+
export function agentBody(ctx, requested) {
|
|
40
|
+
const agent = effectiveAgent(ctx, requested);
|
|
41
|
+
return agent ? { agentName: agent } : {};
|
|
11
42
|
}
|
|
12
43
|
export function jsonResult(data) {
|
|
13
44
|
return {
|
package/dist/util.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.js","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAGnD;;;;;;GAMG;AACH,MAAM,UAAU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,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC;KAC1E,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,KAAc;IACxC,MAAM,OAAO,GACX,KAAK,YAAY,eAAe;QAC9B,CAAC,CAAC,aAAa,KAAK,CAAC,MAAM,KAAK,KAAK,CAAC,IAAI,EAAE;QAC5C,CAAC,CAAC,KAAK,YAAY,KAAK;YACtB,CAAC,CAAC,KAAK,CAAC,OAAO;YACf,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACtB,OAAO;QACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;QACnD,OAAO,EAAE,IAAI;KACd,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dudamel/mcp-memory",
|
|
3
|
-
"version": "2026.
|
|
3
|
+
"version": "2026.928.1",
|
|
4
4
|
"description": "Dudamel Memory MCP — stdio client for an org's Dudamel memory (agent/user knowledge) over its REST API.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"type": "module",
|