@jungjaehoon/mama-server 1.10.1 → 1.11.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/package.json +1 -1
- package/src/server.js +25 -8
package/package.json
CHANGED
package/src/server.js
CHANGED
|
@@ -28,9 +28,9 @@ const {
|
|
|
28
28
|
} = require('@modelcontextprotocol/sdk/types.js');
|
|
29
29
|
const path = require('path');
|
|
30
30
|
|
|
31
|
-
// Import MAMA tools
|
|
32
|
-
|
|
33
|
-
const
|
|
31
|
+
// Import all MAMA tools from src/tools/ — single source of truth for tool definitions
|
|
32
|
+
const { createMemoryTools } = require('./tools/index.js');
|
|
33
|
+
const memoryTools = createMemoryTools();
|
|
34
34
|
const mama = require('@jungjaehoon/mama-core/mama-api');
|
|
35
35
|
|
|
36
36
|
// Import core modules from mama-core
|
|
@@ -446,6 +446,14 @@ Returns: summary (4-section), next_steps (DoD + commands), open_files
|
|
|
446
446
|
properties: {},
|
|
447
447
|
},
|
|
448
448
|
},
|
|
449
|
+
// === v2 tools from src/tools/ ===
|
|
450
|
+
...Object.values(memoryTools)
|
|
451
|
+
.filter((t) => t.name && t.inputSchema)
|
|
452
|
+
.map((t) => ({
|
|
453
|
+
name: t.name,
|
|
454
|
+
description: t.description,
|
|
455
|
+
inputSchema: t.inputSchema,
|
|
456
|
+
})),
|
|
449
457
|
],
|
|
450
458
|
}));
|
|
451
459
|
|
|
@@ -472,10 +480,15 @@ Returns: summary (4-section), next_steps (DoD + commands), open_files
|
|
|
472
480
|
result = await this.handleSearchDecisionsAndContracts(args);
|
|
473
481
|
break;
|
|
474
482
|
case 'load_checkpoint':
|
|
475
|
-
result = await
|
|
483
|
+
result = await memoryTools.load_checkpoint.handler(args);
|
|
476
484
|
break;
|
|
477
485
|
default:
|
|
478
|
-
|
|
486
|
+
// Route to src/tools/ handlers
|
|
487
|
+
if (memoryTools[name] && typeof memoryTools[name].handler === 'function') {
|
|
488
|
+
result = await memoryTools[name].handler(args);
|
|
489
|
+
} else {
|
|
490
|
+
throw new Error(`Unknown tool: ${name}`);
|
|
491
|
+
}
|
|
479
492
|
}
|
|
480
493
|
|
|
481
494
|
const shouldInjectLegacyNotice =
|
|
@@ -610,9 +623,13 @@ Returns: summary (4-section), next_steps (DoD + commands), open_files
|
|
|
610
623
|
);
|
|
611
624
|
}
|
|
612
625
|
|
|
613
|
-
//
|
|
614
|
-
|
|
615
|
-
const
|
|
626
|
+
// Decisions are already sorted by similarity from suggest().
|
|
627
|
+
// Only sort checkpoints by time. Keep decisions first (relevance), checkpoints after (recency).
|
|
628
|
+
const decisions = results.filter((r) => r._type === 'decision');
|
|
629
|
+
const checkpoints = results
|
|
630
|
+
.filter((r) => r._type === 'checkpoint')
|
|
631
|
+
.sort((a, b) => (b.created_at || 0) - (a.created_at || 0));
|
|
632
|
+
const limited = [...decisions, ...checkpoints].slice(0, limit);
|
|
616
633
|
|
|
617
634
|
return {
|
|
618
635
|
success: true,
|