@mrxkun/mcfast-mcp 4.0.3 → 4.0.4
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 +15 -3
- package/package.json +2 -2
- package/src/index.js +379 -0
package/README.md
CHANGED
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
</p>
|
|
15
15
|
|
|
16
16
|
<p align="center">
|
|
17
|
-
<strong>🧠 NEW in v4.0.
|
|
18
|
-
|
|
17
|
+
<strong>🧠 NEW in v4.0.4: Intelligence Layer</strong><br>
|
|
18
|
+
ML-powered pattern detection | Adaptive strategy selection | Predictive suggestions
|
|
19
19
|
</p>
|
|
20
20
|
|
|
21
21
|
---
|
|
@@ -623,7 +623,14 @@ Read API (Total: 6ms)
|
|
|
623
623
|
|
|
624
624
|
## 📝 Changelog
|
|
625
625
|
|
|
626
|
-
### v4.0.
|
|
626
|
+
### v4.0.4 (2026-02-16) 🎉 Phase 4 Complete - MCP Tools Added
|
|
627
|
+
|
|
628
|
+
- 🔧 **MCP Tools Registration**
|
|
629
|
+
- `memory_search` - Semantic code search with 90-95% accuracy
|
|
630
|
+
- `memory_get` - Retrieve stored memories and intelligence stats
|
|
631
|
+
- `detect_patterns` - Detect code patterns from edit history
|
|
632
|
+
- `get_suggestions` - Get intelligent code suggestions
|
|
633
|
+
- `select_strategy` - ML-based strategy selection
|
|
627
634
|
|
|
628
635
|
- 🧠 **Pattern Recognition**
|
|
629
636
|
- Detect frequent renames (naming inconsistencies)
|
|
@@ -660,6 +667,11 @@ Read API (Total: 6ms)
|
|
|
660
667
|
- Pattern detection: >90% accuracy
|
|
661
668
|
- Auto-apply success: >90%
|
|
662
669
|
|
|
670
|
+
### v4.0.3 (2026-02-16) 🎉 Phase 4 Core Implementation
|
|
671
|
+
- Initial Phase 4 implementation (PatternDetector, SuggestionEngine, StrategySelector)
|
|
672
|
+
- Dashboard analytics endpoints
|
|
673
|
+
- SQL migration for Phase 4 tables
|
|
674
|
+
|
|
663
675
|
### v4.0.2 (2026-02-16) 🎉 Phase 3 Complete
|
|
664
676
|
- ✨ **Enhanced Edit Tool** with Memory Context
|
|
665
677
|
- Automatic context retrieval from codebase memory
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mrxkun/mcfast-mcp",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.4",
|
|
4
4
|
"description": "Ultra-fast code editing with WASM acceleration, fuzzy patching, multi-layer caching, and 8 unified tools. Optimized for AI code assistants with 80-98% latency reduction. Phase 4: ML Intelligence Layer.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"@babel/types": "^7.29.0",
|
|
48
48
|
"@modelcontextprotocol/sdk": "^0.6.0",
|
|
49
49
|
"better-sqlite3": "^11.10.0",
|
|
50
|
-
"chokidar": "^4.0.
|
|
50
|
+
"chokidar": "^4.0.4",
|
|
51
51
|
"fast-glob": "^3.3.3",
|
|
52
52
|
"ignore": "^7.0.5",
|
|
53
53
|
"tree-sitter-c-sharp": "^0.23.1",
|
package/src/index.js
CHANGED
|
@@ -432,6 +432,69 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
|
432
432
|
},
|
|
433
433
|
required: ["instruction", "files"]
|
|
434
434
|
}
|
|
435
|
+
},
|
|
436
|
+
// MEMORY TOOL 1: memory_search
|
|
437
|
+
{
|
|
438
|
+
name: "memory_search",
|
|
439
|
+
description: "🧠 Semantic code search using local embeddings (90-95% accuracy). Finds code by meaning, not just keywords. Returns relevant code chunks from your codebase.",
|
|
440
|
+
inputSchema: {
|
|
441
|
+
type: "object",
|
|
442
|
+
properties: {
|
|
443
|
+
query: { type: "string", description: "Natural language search query (e.g., 'find authentication code', 'error handling patterns')" },
|
|
444
|
+
type: { type: "string", enum: ["all", "facts", "history", "code"], description: "Filter by type (default: all)" },
|
|
445
|
+
maxResults: { type: "number", description: "Maximum results to return (default: 6)" },
|
|
446
|
+
minScore: { type: "number", description: "Minimum relevance score 0-1 (default: 0.35)" }
|
|
447
|
+
},
|
|
448
|
+
required: ["query"]
|
|
449
|
+
}
|
|
450
|
+
},
|
|
451
|
+
// MEMORY TOOL 2: memory_get
|
|
452
|
+
{
|
|
453
|
+
name: "memory_get",
|
|
454
|
+
description: "📚 Get stored memories: today's log, curated memories, or intelligence stats. Use to review recent changes or long-term knowledge.",
|
|
455
|
+
inputSchema: {
|
|
456
|
+
type: "object",
|
|
457
|
+
properties: {
|
|
458
|
+
type: { type: "string", enum: ["today_log", "curated", "stats", "intelligence"], description: "Type of memory to retrieve" }
|
|
459
|
+
},
|
|
460
|
+
required: ["type"]
|
|
461
|
+
}
|
|
462
|
+
},
|
|
463
|
+
// INTELLIGENCE TOOL 1: detect_patterns
|
|
464
|
+
{
|
|
465
|
+
name: "detect_patterns",
|
|
466
|
+
description: "🔍 Detect code patterns from edit history: naming inconsistencies, recurring bugs, hot files, frequent sequences. Returns actionable insights.",
|
|
467
|
+
inputSchema: {
|
|
468
|
+
type: "object",
|
|
469
|
+
properties: {},
|
|
470
|
+
required: []
|
|
471
|
+
}
|
|
472
|
+
},
|
|
473
|
+
// INTELLIGENCE TOOL 2: get_suggestions
|
|
474
|
+
{
|
|
475
|
+
name: "get_suggestions",
|
|
476
|
+
description: "💡 Get intelligent code suggestions based on current context: naming fixes, long functions, missing tests, unused imports, duplicate code.",
|
|
477
|
+
inputSchema: {
|
|
478
|
+
type: "object",
|
|
479
|
+
properties: {
|
|
480
|
+
currentFile: { type: "string", description: "Current file being edited" },
|
|
481
|
+
currentLine: { type: "number", description: "Current line number" }
|
|
482
|
+
},
|
|
483
|
+
required: []
|
|
484
|
+
}
|
|
485
|
+
},
|
|
486
|
+
// INTELLIGENCE TOOL 3: select_strategy
|
|
487
|
+
{
|
|
488
|
+
name: "select_strategy",
|
|
489
|
+
description: "🎯 ML-based strategy selection for optimal edit performance. Analyzes instruction and context to choose best strategy (deterministic/cached/llm).",
|
|
490
|
+
inputSchema: {
|
|
491
|
+
type: "object",
|
|
492
|
+
properties: {
|
|
493
|
+
instruction: { type: "string", description: "Edit instruction to analyze" },
|
|
494
|
+
files: { type: "array", items: { type: "string" }, description: "Files involved in the edit" }
|
|
495
|
+
},
|
|
496
|
+
required: ["instruction"]
|
|
497
|
+
}
|
|
435
498
|
}
|
|
436
499
|
],
|
|
437
500
|
};
|
|
@@ -609,6 +672,31 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
609
672
|
result = await handleReapply(args);
|
|
610
673
|
summary = 'Retry edit applied';
|
|
611
674
|
}
|
|
675
|
+
// MEMORY TOOL 1: memory_search
|
|
676
|
+
else if (name === "memory_search") {
|
|
677
|
+
result = await handleMemorySearch(args);
|
|
678
|
+
summary = 'Memory search completed';
|
|
679
|
+
}
|
|
680
|
+
// MEMORY TOOL 2: memory_get
|
|
681
|
+
else if (name === "memory_get") {
|
|
682
|
+
result = await handleMemoryGet(args);
|
|
683
|
+
summary = 'Memory retrieved';
|
|
684
|
+
}
|
|
685
|
+
// INTELLIGENCE TOOL 1: detect_patterns
|
|
686
|
+
else if (name === "detect_patterns") {
|
|
687
|
+
result = await handleDetectPatterns(args);
|
|
688
|
+
summary = 'Patterns detected';
|
|
689
|
+
}
|
|
690
|
+
// INTELLIGENCE TOOL 2: get_suggestions
|
|
691
|
+
else if (name === "get_suggestions") {
|
|
692
|
+
result = await handleGetSuggestions(args);
|
|
693
|
+
summary = 'Suggestions generated';
|
|
694
|
+
}
|
|
695
|
+
// INTELLIGENCE TOOL 3: select_strategy
|
|
696
|
+
else if (name === "select_strategy") {
|
|
697
|
+
result = await handleSelectStrategy(args);
|
|
698
|
+
summary = 'Strategy selected';
|
|
699
|
+
}
|
|
612
700
|
else {
|
|
613
701
|
throw new Error(`Tool not found: ${name}`);
|
|
614
702
|
}
|
|
@@ -2625,6 +2713,297 @@ async function handleReferencesInDirectory({ path: dirPath, symbol }) {
|
|
|
2625
2713
|
}
|
|
2626
2714
|
}
|
|
2627
2715
|
|
|
2716
|
+
// ============================================
|
|
2717
|
+
// PHASE 4: INTELLIGENCE LAYER HANDLERS
|
|
2718
|
+
// ============================================
|
|
2719
|
+
|
|
2720
|
+
/**
|
|
2721
|
+
* INTELLIGENCE HANDLER 1: handleMemorySearch
|
|
2722
|
+
* Semantic code search using MemoryEngine
|
|
2723
|
+
*/
|
|
2724
|
+
async function handleMemorySearch({ query, type = 'all', maxResults = 6, minScore = 0.35 }) {
|
|
2725
|
+
const start = Date.now();
|
|
2726
|
+
try {
|
|
2727
|
+
const engine = await getMemoryEngine();
|
|
2728
|
+
let results = [];
|
|
2729
|
+
|
|
2730
|
+
if (type === 'facts') {
|
|
2731
|
+
const facts = await engine.searchFacts(query, maxResults);
|
|
2732
|
+
results = facts.map(fact => ({
|
|
2733
|
+
type: 'fact',
|
|
2734
|
+
content: `${fact.type}: ${fact.name}${fact.signature ? ` (${fact.signature})` : ''}`,
|
|
2735
|
+
file: fact.file_id,
|
|
2736
|
+
score: fact.confidence || 0.8
|
|
2737
|
+
}));
|
|
2738
|
+
} else if (type === 'code') {
|
|
2739
|
+
const searchResult = await engine.ultraSearch(query, { limit: maxResults });
|
|
2740
|
+
results = searchResult.results.map(result => ({
|
|
2741
|
+
type: 'chunk',
|
|
2742
|
+
content: result.code || result.content,
|
|
2743
|
+
file: result.filePath || result.path,
|
|
2744
|
+
score: result.finalScore || result.score
|
|
2745
|
+
}));
|
|
2746
|
+
} else {
|
|
2747
|
+
const searchResult = await engine.intelligentSearch(query, { limit: maxResults });
|
|
2748
|
+
results = searchResult.results.map(result => ({
|
|
2749
|
+
type: 'chunk',
|
|
2750
|
+
content: result.code || result.content,
|
|
2751
|
+
file: result.filePath || result.path,
|
|
2752
|
+
score: result.finalScore || result.score,
|
|
2753
|
+
method: searchResult.metadata?.method
|
|
2754
|
+
}));
|
|
2755
|
+
}
|
|
2756
|
+
|
|
2757
|
+
results = results.filter(r => r.score >= minScore).slice(0, maxResults);
|
|
2758
|
+
|
|
2759
|
+
let output = `🧠 Memory Search Results\n`;
|
|
2760
|
+
output += `Query: "${query}"\n`;
|
|
2761
|
+
output += `Found: ${results.length} results (${Date.now() - start}ms)\n\n`;
|
|
2762
|
+
|
|
2763
|
+
for (const result of results) {
|
|
2764
|
+
output += `📁 ${result.file}\n`;
|
|
2765
|
+
output += ` Score: ${(result.score * 100).toFixed(0)}%`;
|
|
2766
|
+
if (result.method) output += ` • ${result.method}`;
|
|
2767
|
+
output += `\n ${result.content?.substring(0, 100)}${result.content?.length > 100 ? '...' : ''}\n\n`;
|
|
2768
|
+
}
|
|
2769
|
+
|
|
2770
|
+
reportAudit({
|
|
2771
|
+
tool: 'memory_search',
|
|
2772
|
+
instruction: query,
|
|
2773
|
+
status: 'success',
|
|
2774
|
+
latency_ms: Date.now() - start,
|
|
2775
|
+
files_count: results.length
|
|
2776
|
+
});
|
|
2777
|
+
|
|
2778
|
+
return { content: [{ type: "text", text: output }] };
|
|
2779
|
+
|
|
2780
|
+
} catch (error) {
|
|
2781
|
+
reportAudit({
|
|
2782
|
+
tool: 'memory_search',
|
|
2783
|
+
instruction: query,
|
|
2784
|
+
status: 'error',
|
|
2785
|
+
error_message: error.message,
|
|
2786
|
+
latency_ms: Date.now() - start
|
|
2787
|
+
});
|
|
2788
|
+
|
|
2789
|
+
return {
|
|
2790
|
+
content: [{ type: "text", text: `❌ Memory search error: ${error.message}` }],
|
|
2791
|
+
isError: true
|
|
2792
|
+
};
|
|
2793
|
+
}
|
|
2794
|
+
}
|
|
2795
|
+
|
|
2796
|
+
/**
|
|
2797
|
+
* INTELLIGENCE HANDLER 2: handleMemoryGet
|
|
2798
|
+
* Get stored memories and intelligence stats
|
|
2799
|
+
*/
|
|
2800
|
+
async function handleMemoryGet({ type }) {
|
|
2801
|
+
const start = Date.now();
|
|
2802
|
+
try {
|
|
2803
|
+
const engine = await getMemoryEngine();
|
|
2804
|
+
let output = '';
|
|
2805
|
+
|
|
2806
|
+
if (type === 'today_log') {
|
|
2807
|
+
const log = await engine.getTodayLog();
|
|
2808
|
+
output = `📚 Today's Log\n`;
|
|
2809
|
+
output += `Date: ${new Date().toISOString().split('T')[0]}\n\n`;
|
|
2810
|
+
output += log || 'No entries yet today.';
|
|
2811
|
+
} else if (type === 'curated') {
|
|
2812
|
+
const memories = await engine.getCuratedMemories();
|
|
2813
|
+
output = `📚 Curated Memories\n\n`;
|
|
2814
|
+
output += memories || 'No curated memories yet.';
|
|
2815
|
+
} else if (type === 'stats') {
|
|
2816
|
+
const stats = await engine.getStats();
|
|
2817
|
+
output = `📊 Memory Stats\n\n`;
|
|
2818
|
+
output += `Total chunks: ${stats.totalChunks || 0}\n`;
|
|
2819
|
+
output += `Total facts: ${stats.totalFacts || 0}\n`;
|
|
2820
|
+
output += `Index size: ${stats.indexSize || 0}\n`;
|
|
2821
|
+
output += `Last indexed: ${stats.lastIndexed || 'Never'}`;
|
|
2822
|
+
} else if (type === 'intelligence') {
|
|
2823
|
+
const intelStats = engine.getIntelligenceStats();
|
|
2824
|
+
output = `🧠 Intelligence Stats\n\n`;
|
|
2825
|
+
output += `Enabled: ${intelStats.enabled}\n`;
|
|
2826
|
+
if (intelStats.enabled) {
|
|
2827
|
+
output += `\nPattern Detector:\n`;
|
|
2828
|
+
output += ` Total patterns: ${intelStats.patternDetector?.totalPatterns || 0}\n`;
|
|
2829
|
+
output += `\nSuggestion Engine:\n`;
|
|
2830
|
+
output += ` Min confidence: ${intelStats.suggestionEngine?.minConfidence || 0.7}\n`;
|
|
2831
|
+
output += `\nStrategy Selector:\n`;
|
|
2832
|
+
output += ` Learning rate: ${intelStats.strategySelector?.learningRate || 0.1}\n`;
|
|
2833
|
+
}
|
|
2834
|
+
}
|
|
2835
|
+
|
|
2836
|
+
reportAudit({
|
|
2837
|
+
tool: 'memory_get',
|
|
2838
|
+
instruction: type,
|
|
2839
|
+
status: 'success',
|
|
2840
|
+
latency_ms: Date.now() - start
|
|
2841
|
+
});
|
|
2842
|
+
|
|
2843
|
+
return { content: [{ type: "text", text: output }] };
|
|
2844
|
+
|
|
2845
|
+
} catch (error) {
|
|
2846
|
+
reportAudit({
|
|
2847
|
+
tool: 'memory_get',
|
|
2848
|
+
instruction: type,
|
|
2849
|
+
status: 'error',
|
|
2850
|
+
error_message: error.message,
|
|
2851
|
+
latency_ms: Date.now() - start
|
|
2852
|
+
});
|
|
2853
|
+
|
|
2854
|
+
return {
|
|
2855
|
+
content: [{ type: "text", text: `❌ Memory get error: ${error.message}` }],
|
|
2856
|
+
isError: true
|
|
2857
|
+
};
|
|
2858
|
+
}
|
|
2859
|
+
}
|
|
2860
|
+
|
|
2861
|
+
/**
|
|
2862
|
+
* INTELLIGENCE HANDLER 3: handleDetectPatterns
|
|
2863
|
+
* Detect code patterns from edit history
|
|
2864
|
+
*/
|
|
2865
|
+
async function handleDetectPatterns() {
|
|
2866
|
+
const start = Date.now();
|
|
2867
|
+
try {
|
|
2868
|
+
const engine = await getMemoryEngine();
|
|
2869
|
+
const patterns = await engine.detectPatterns();
|
|
2870
|
+
|
|
2871
|
+
let output = `🔍 Detected Patterns\n`;
|
|
2872
|
+
output += `Found: ${patterns.length} patterns\n\n`;
|
|
2873
|
+
|
|
2874
|
+
for (const pattern of patterns) {
|
|
2875
|
+
output += `📌 ${pattern.type.toUpperCase()}\n`;
|
|
2876
|
+
output += ` Confidence: ${(pattern.confidence * 100).toFixed(0)}%\n`;
|
|
2877
|
+
output += ` Severity: ${pattern.severity || 'medium'}\n`;
|
|
2878
|
+
output += ` Occurrences: ${pattern.occurrences || 'N/A'}\n`;
|
|
2879
|
+
output += ` Suggestion: ${pattern.suggestion}\n\n`;
|
|
2880
|
+
}
|
|
2881
|
+
|
|
2882
|
+
reportAudit({
|
|
2883
|
+
tool: 'detect_patterns',
|
|
2884
|
+
instruction: '',
|
|
2885
|
+
status: 'success',
|
|
2886
|
+
latency_ms: Date.now() - start,
|
|
2887
|
+
files_count: patterns.length
|
|
2888
|
+
});
|
|
2889
|
+
|
|
2890
|
+
return { content: [{ type: "text", text: output }] };
|
|
2891
|
+
|
|
2892
|
+
} catch (error) {
|
|
2893
|
+
reportAudit({
|
|
2894
|
+
tool: 'detect_patterns',
|
|
2895
|
+
instruction: '',
|
|
2896
|
+
status: 'error',
|
|
2897
|
+
error_message: error.message,
|
|
2898
|
+
latency_ms: Date.now() - start
|
|
2899
|
+
});
|
|
2900
|
+
|
|
2901
|
+
return {
|
|
2902
|
+
content: [{ type: "text", text: `❌ Pattern detection error: ${error.message}` }],
|
|
2903
|
+
isError: true
|
|
2904
|
+
};
|
|
2905
|
+
}
|
|
2906
|
+
}
|
|
2907
|
+
|
|
2908
|
+
/**
|
|
2909
|
+
* INTELLIGENCE HANDLER 4: handleGetSuggestions
|
|
2910
|
+
* Get intelligent code suggestions
|
|
2911
|
+
*/
|
|
2912
|
+
async function handleGetSuggestions({ currentFile, currentLine }) {
|
|
2913
|
+
const start = Date.now();
|
|
2914
|
+
try {
|
|
2915
|
+
const engine = await getMemoryEngine();
|
|
2916
|
+
const suggestions = await engine.getSuggestions({
|
|
2917
|
+
currentFile,
|
|
2918
|
+
currentLine
|
|
2919
|
+
});
|
|
2920
|
+
|
|
2921
|
+
let output = `💡 Intelligent Suggestions\n`;
|
|
2922
|
+
output += `Found: ${suggestions.length} suggestions\n\n`;
|
|
2923
|
+
|
|
2924
|
+
for (const suggestion of suggestions) {
|
|
2925
|
+
output += `🎯 ${suggestion.type.toUpperCase()}\n`;
|
|
2926
|
+
output += ` Category: ${suggestion.category || 'general'}\n`;
|
|
2927
|
+
output += ` Confidence: ${(suggestion.confidence * 100).toFixed(0)}%\n`;
|
|
2928
|
+
output += ` Description: ${suggestion.description}\n`;
|
|
2929
|
+
if (suggestion.autoApply) {
|
|
2930
|
+
output += ` ✅ Auto-apply available\n`;
|
|
2931
|
+
}
|
|
2932
|
+
output += `\n`;
|
|
2933
|
+
}
|
|
2934
|
+
|
|
2935
|
+
reportAudit({
|
|
2936
|
+
tool: 'get_suggestions',
|
|
2937
|
+
instruction: currentFile || '',
|
|
2938
|
+
status: 'success',
|
|
2939
|
+
latency_ms: Date.now() - start,
|
|
2940
|
+
files_count: suggestions.length
|
|
2941
|
+
});
|
|
2942
|
+
|
|
2943
|
+
return { content: [{ type: "text", text: output }] };
|
|
2944
|
+
|
|
2945
|
+
} catch (error) {
|
|
2946
|
+
reportAudit({
|
|
2947
|
+
tool: 'get_suggestions',
|
|
2948
|
+
instruction: currentFile || '',
|
|
2949
|
+
status: 'error',
|
|
2950
|
+
error_message: error.message,
|
|
2951
|
+
latency_ms: Date.now() - start
|
|
2952
|
+
});
|
|
2953
|
+
|
|
2954
|
+
return {
|
|
2955
|
+
content: [{ type: "text", text: `❌ Suggestion error: ${error.message}` }],
|
|
2956
|
+
isError: true
|
|
2957
|
+
};
|
|
2958
|
+
}
|
|
2959
|
+
}
|
|
2960
|
+
|
|
2961
|
+
/**
|
|
2962
|
+
* INTELLIGENCE HANDLER 5: handleSelectStrategy
|
|
2963
|
+
* ML-based strategy selection
|
|
2964
|
+
*/
|
|
2965
|
+
async function handleSelectStrategy({ instruction, files = [] }) {
|
|
2966
|
+
const start = Date.now();
|
|
2967
|
+
try {
|
|
2968
|
+
const engine = await getMemoryEngine();
|
|
2969
|
+
const result = await engine.selectStrategy(instruction, { files });
|
|
2970
|
+
|
|
2971
|
+
let output = `🎯 Strategy Selection\n\n`;
|
|
2972
|
+
output += `Instruction: "${instruction.substring(0, 100)}${instruction.length > 100 ? '...' : ''}"\n\n`;
|
|
2973
|
+
output += `Selected Strategy: ${result.strategy.toUpperCase()}\n`;
|
|
2974
|
+
output += `Confidence: ${(result.confidence * 100).toFixed(0)}%\n`;
|
|
2975
|
+
output += `Reason: ${result.reason}\n\n`;
|
|
2976
|
+
output += `Scores:\n`;
|
|
2977
|
+
for (const [strat, score] of Object.entries(result.scores || {})) {
|
|
2978
|
+
output += ` ${strat}: ${(score * 100).toFixed(0)}%\n`;
|
|
2979
|
+
}
|
|
2980
|
+
|
|
2981
|
+
reportAudit({
|
|
2982
|
+
tool: 'select_strategy',
|
|
2983
|
+
instruction: instruction,
|
|
2984
|
+
status: 'success',
|
|
2985
|
+
latency_ms: Date.now() - start,
|
|
2986
|
+
strategy: result.strategy
|
|
2987
|
+
});
|
|
2988
|
+
|
|
2989
|
+
return { content: [{ type: "text", text: output }] };
|
|
2990
|
+
|
|
2991
|
+
} catch (error) {
|
|
2992
|
+
reportAudit({
|
|
2993
|
+
tool: 'select_strategy',
|
|
2994
|
+
instruction: instruction,
|
|
2995
|
+
status: 'error',
|
|
2996
|
+
error_message: error.message,
|
|
2997
|
+
latency_ms: Date.now() - start
|
|
2998
|
+
});
|
|
2999
|
+
|
|
3000
|
+
return {
|
|
3001
|
+
content: [{ type: "text", text: `❌ Strategy selection error: ${error.message}` }],
|
|
3002
|
+
isError: true
|
|
3003
|
+
};
|
|
3004
|
+
}
|
|
3005
|
+
}
|
|
3006
|
+
|
|
2628
3007
|
/**
|
|
2629
3008
|
* Start Server
|
|
2630
3009
|
*/
|