@juspay/neurolink 1.5.3 → 1.9.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/CHANGELOG.md +241 -1
- package/README.md +113 -20
- package/dist/agent/direct-tools.d.ts +1203 -0
- package/dist/agent/direct-tools.js +387 -0
- package/dist/cli/commands/agent-generate.d.ts +2 -0
- package/dist/cli/commands/agent-generate.js +70 -0
- package/dist/cli/commands/config.d.ts +76 -9
- package/dist/cli/commands/config.js +358 -233
- package/dist/cli/commands/mcp.d.ts +2 -1
- package/dist/cli/commands/mcp.js +874 -146
- package/dist/cli/commands/ollama.d.ts +8 -0
- package/dist/cli/commands/ollama.js +333 -0
- package/dist/cli/index.js +591 -327
- package/dist/cli/utils/complete-setup.d.ts +19 -0
- package/dist/cli/utils/complete-setup.js +81 -0
- package/dist/cli/utils/env-manager.d.ts +44 -0
- package/dist/cli/utils/env-manager.js +226 -0
- package/dist/cli/utils/interactive-setup.d.ts +48 -0
- package/dist/cli/utils/interactive-setup.js +302 -0
- package/dist/core/dynamic-models.d.ts +208 -0
- package/dist/core/dynamic-models.js +250 -0
- package/dist/core/factory.d.ts +13 -6
- package/dist/core/factory.js +180 -50
- package/dist/core/types.d.ts +8 -3
- package/dist/core/types.js +7 -4
- package/dist/index.d.ts +16 -16
- package/dist/index.js +16 -16
- package/dist/lib/agent/direct-tools.d.ts +1203 -0
- package/dist/lib/agent/direct-tools.js +387 -0
- package/dist/lib/core/dynamic-models.d.ts +208 -0
- package/dist/lib/core/dynamic-models.js +250 -0
- package/dist/lib/core/factory.d.ts +13 -6
- package/dist/lib/core/factory.js +180 -50
- package/dist/lib/core/types.d.ts +8 -3
- package/dist/lib/core/types.js +7 -4
- package/dist/lib/index.d.ts +16 -16
- package/dist/lib/index.js +16 -16
- package/dist/lib/mcp/auto-discovery.d.ts +120 -0
- package/dist/lib/mcp/auto-discovery.js +793 -0
- package/dist/lib/mcp/client.d.ts +66 -0
- package/dist/lib/mcp/client.js +245 -0
- package/dist/lib/mcp/config.d.ts +31 -0
- package/dist/lib/mcp/config.js +74 -0
- package/dist/lib/mcp/context-manager.d.ts +4 -4
- package/dist/lib/mcp/context-manager.js +24 -18
- package/dist/lib/mcp/factory.d.ts +28 -11
- package/dist/lib/mcp/factory.js +36 -29
- package/dist/lib/mcp/function-calling.d.ts +51 -0
- package/dist/lib/mcp/function-calling.js +510 -0
- package/dist/lib/mcp/index.d.ts +190 -0
- package/dist/lib/mcp/index.js +156 -0
- package/dist/lib/mcp/initialize-tools.d.ts +28 -0
- package/dist/lib/mcp/initialize-tools.js +209 -0
- package/dist/lib/mcp/initialize.d.ts +17 -0
- package/dist/lib/mcp/initialize.js +51 -0
- package/dist/lib/mcp/logging.d.ts +71 -0
- package/dist/lib/mcp/logging.js +183 -0
- package/dist/lib/mcp/manager.d.ts +67 -0
- package/dist/lib/mcp/manager.js +176 -0
- package/dist/lib/mcp/neurolink-mcp-client.d.ts +96 -0
- package/dist/lib/mcp/neurolink-mcp-client.js +417 -0
- package/dist/lib/mcp/orchestrator.d.ts +3 -3
- package/dist/lib/mcp/orchestrator.js +46 -43
- package/dist/lib/mcp/registry.d.ts +2 -2
- package/dist/lib/mcp/registry.js +42 -33
- package/dist/lib/mcp/servers/ai-providers/ai-analysis-tools.d.ts +1 -1
- package/dist/lib/mcp/servers/ai-providers/ai-analysis-tools.js +205 -66
- package/dist/lib/mcp/servers/ai-providers/ai-core-server.js +143 -99
- package/dist/lib/mcp/servers/ai-providers/ai-workflow-tools.d.ts +6 -6
- package/dist/lib/mcp/servers/ai-providers/ai-workflow-tools.js +404 -251
- package/dist/lib/mcp/servers/utilities/utility-server.d.ts +8 -0
- package/dist/lib/mcp/servers/utilities/utility-server.js +326 -0
- package/dist/lib/mcp/tool-integration.d.ts +67 -0
- package/dist/lib/mcp/tool-integration.js +179 -0
- package/dist/lib/mcp/unified-registry.d.ts +269 -0
- package/dist/lib/mcp/unified-registry.js +1411 -0
- package/dist/lib/neurolink.d.ts +68 -6
- package/dist/lib/neurolink.js +314 -42
- package/dist/lib/providers/agent-enhanced-provider.d.ts +59 -0
- package/dist/lib/providers/agent-enhanced-provider.js +242 -0
- package/dist/lib/providers/amazonBedrock.d.ts +3 -3
- package/dist/lib/providers/amazonBedrock.js +54 -50
- package/dist/lib/providers/anthropic.d.ts +2 -2
- package/dist/lib/providers/anthropic.js +92 -84
- package/dist/lib/providers/azureOpenAI.d.ts +2 -2
- package/dist/lib/providers/azureOpenAI.js +97 -86
- package/dist/lib/providers/function-calling-provider.d.ts +70 -0
- package/dist/lib/providers/function-calling-provider.js +359 -0
- package/dist/lib/providers/googleAIStudio.d.ts +10 -5
- package/dist/lib/providers/googleAIStudio.js +60 -38
- package/dist/lib/providers/googleVertexAI.d.ts +3 -3
- package/dist/lib/providers/googleVertexAI.js +96 -86
- package/dist/lib/providers/huggingFace.d.ts +31 -0
- package/dist/lib/providers/huggingFace.js +362 -0
- package/dist/lib/providers/index.d.ts +14 -8
- package/dist/lib/providers/index.js +18 -12
- package/dist/lib/providers/mcp-provider.d.ts +62 -0
- package/dist/lib/providers/mcp-provider.js +183 -0
- package/dist/lib/providers/mistralAI.d.ts +32 -0
- package/dist/lib/providers/mistralAI.js +223 -0
- package/dist/lib/providers/ollama.d.ts +51 -0
- package/dist/lib/providers/ollama.js +508 -0
- package/dist/lib/providers/openAI.d.ts +7 -3
- package/dist/lib/providers/openAI.js +45 -33
- package/dist/lib/utils/logger.js +2 -2
- package/dist/lib/utils/providerUtils.js +59 -22
- package/dist/mcp/auto-discovery.d.ts +120 -0
- package/dist/mcp/auto-discovery.js +794 -0
- package/dist/mcp/client.d.ts +66 -0
- package/dist/mcp/client.js +245 -0
- package/dist/mcp/config.d.ts +31 -0
- package/dist/mcp/config.js +74 -0
- package/dist/mcp/context-manager.d.ts +4 -4
- package/dist/mcp/context-manager.js +24 -18
- package/dist/mcp/factory.d.ts +28 -11
- package/dist/mcp/factory.js +36 -29
- package/dist/mcp/function-calling.d.ts +51 -0
- package/dist/mcp/function-calling.js +510 -0
- package/dist/mcp/index.d.ts +190 -0
- package/dist/mcp/index.js +156 -0
- package/dist/mcp/initialize-tools.d.ts +28 -0
- package/dist/mcp/initialize-tools.js +210 -0
- package/dist/mcp/initialize.d.ts +17 -0
- package/dist/mcp/initialize.js +51 -0
- package/dist/mcp/logging.d.ts +71 -0
- package/dist/mcp/logging.js +183 -0
- package/dist/mcp/manager.d.ts +67 -0
- package/dist/mcp/manager.js +176 -0
- package/dist/mcp/neurolink-mcp-client.d.ts +96 -0
- package/dist/mcp/neurolink-mcp-client.js +417 -0
- package/dist/mcp/orchestrator.d.ts +3 -3
- package/dist/mcp/orchestrator.js +46 -43
- package/dist/mcp/registry.d.ts +2 -2
- package/dist/mcp/registry.js +42 -33
- package/dist/mcp/servers/ai-providers/ai-analysis-tools.d.ts +1 -1
- package/dist/mcp/servers/ai-providers/ai-analysis-tools.js +205 -66
- package/dist/mcp/servers/ai-providers/ai-core-server.js +143 -99
- package/dist/mcp/servers/ai-providers/ai-workflow-tools.d.ts +6 -6
- package/dist/mcp/servers/ai-providers/ai-workflow-tools.js +404 -253
- package/dist/mcp/servers/utilities/utility-server.d.ts +8 -0
- package/dist/mcp/servers/utilities/utility-server.js +326 -0
- package/dist/mcp/tool-integration.d.ts +67 -0
- package/dist/mcp/tool-integration.js +179 -0
- package/dist/mcp/unified-registry.d.ts +269 -0
- package/dist/mcp/unified-registry.js +1411 -0
- package/dist/neurolink.d.ts +68 -6
- package/dist/neurolink.js +314 -42
- package/dist/providers/agent-enhanced-provider.d.ts +59 -0
- package/dist/providers/agent-enhanced-provider.js +242 -0
- package/dist/providers/amazonBedrock.d.ts +3 -3
- package/dist/providers/amazonBedrock.js +54 -50
- package/dist/providers/anthropic.d.ts +2 -2
- package/dist/providers/anthropic.js +92 -84
- package/dist/providers/azureOpenAI.d.ts +2 -2
- package/dist/providers/azureOpenAI.js +97 -86
- package/dist/providers/function-calling-provider.d.ts +70 -0
- package/dist/providers/function-calling-provider.js +359 -0
- package/dist/providers/googleAIStudio.d.ts +10 -5
- package/dist/providers/googleAIStudio.js +60 -38
- package/dist/providers/googleVertexAI.d.ts +3 -3
- package/dist/providers/googleVertexAI.js +96 -86
- package/dist/providers/huggingFace.d.ts +31 -0
- package/dist/providers/huggingFace.js +362 -0
- package/dist/providers/index.d.ts +14 -8
- package/dist/providers/index.js +18 -12
- package/dist/providers/mcp-provider.d.ts +62 -0
- package/dist/providers/mcp-provider.js +183 -0
- package/dist/providers/mistralAI.d.ts +32 -0
- package/dist/providers/mistralAI.js +223 -0
- package/dist/providers/ollama.d.ts +51 -0
- package/dist/providers/ollama.js +508 -0
- package/dist/providers/openAI.d.ts +7 -3
- package/dist/providers/openAI.js +45 -33
- package/dist/utils/logger.js +2 -2
- package/dist/utils/providerUtils.js +59 -22
- package/package.json +28 -4
|
@@ -3,67 +3,81 @@
|
|
|
3
3
|
* Wraps existing AI provider functionality as MCP tools for orchestration
|
|
4
4
|
* Integrates AIProviderFactory with Factory-First MCP architecture
|
|
5
5
|
*/
|
|
6
|
-
import { z } from
|
|
7
|
-
import { createMCPServer } from
|
|
8
|
-
import { AIProviderFactory } from
|
|
9
|
-
import { getBestProvider, getAvailableProviders } from
|
|
10
|
-
import { logger } from
|
|
11
|
-
import { analyzeAIUsageTool, benchmarkProviderPerformanceTool, optimizePromptParametersTool } from
|
|
12
|
-
import { generateTestCasesTool, refactorCodeTool, generateDocumentationTool, debugAIOutputTool } from
|
|
6
|
+
import { z } from "zod";
|
|
7
|
+
import { createMCPServer } from "../../factory.js";
|
|
8
|
+
import { AIProviderFactory } from "../../../core/factory.js";
|
|
9
|
+
import { getBestProvider, getAvailableProviders, } from "../../../utils/providerUtils.js";
|
|
10
|
+
import { logger } from "../../../utils/logger.js";
|
|
11
|
+
import { analyzeAIUsageTool, benchmarkProviderPerformanceTool, optimizePromptParametersTool, } from "./ai-analysis-tools.js";
|
|
12
|
+
import { generateTestCasesTool, refactorCodeTool, generateDocumentationTool, debugAIOutputTool, } from "./ai-workflow-tools.js";
|
|
13
13
|
/**
|
|
14
14
|
* AI Core Server - Central hub for AI provider tools
|
|
15
15
|
* Provides text generation, provider selection, AI analysis, and development workflow tools
|
|
16
16
|
*/
|
|
17
17
|
export const aiCoreServer = createMCPServer({
|
|
18
|
-
id:
|
|
19
|
-
title:
|
|
20
|
-
description:
|
|
21
|
-
category:
|
|
22
|
-
version:
|
|
18
|
+
id: "neurolink-ai-core",
|
|
19
|
+
title: "NeuroLink AI Core",
|
|
20
|
+
description: "Core AI provider tools with automatic fallback, analysis capabilities, and development workflow enhancement",
|
|
21
|
+
category: "ai-providers",
|
|
22
|
+
version: "1.2.0",
|
|
23
23
|
capabilities: [
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
]
|
|
24
|
+
"text-generation",
|
|
25
|
+
"provider-selection",
|
|
26
|
+
"automatic-fallback",
|
|
27
|
+
"usage-tracking",
|
|
28
|
+
"multi-provider-support",
|
|
29
|
+
"ai-analysis",
|
|
30
|
+
"test-generation",
|
|
31
|
+
"code-refactoring",
|
|
32
|
+
"documentation-generation",
|
|
33
|
+
"ai-debugging",
|
|
34
|
+
],
|
|
35
35
|
});
|
|
36
36
|
/**
|
|
37
37
|
* Text Generation Input Schema
|
|
38
38
|
*/
|
|
39
39
|
const TextGenerationSchema = z.object({
|
|
40
|
-
prompt: z.string().min(1,
|
|
41
|
-
provider: z
|
|
40
|
+
prompt: z.string().min(1, "Prompt is required"),
|
|
41
|
+
provider: z
|
|
42
|
+
.enum([
|
|
43
|
+
"openai",
|
|
44
|
+
"bedrock",
|
|
45
|
+
"vertex",
|
|
46
|
+
"anthropic",
|
|
47
|
+
"google-ai",
|
|
48
|
+
"azure",
|
|
49
|
+
"huggingface",
|
|
50
|
+
"ollama",
|
|
51
|
+
"mistral",
|
|
52
|
+
])
|
|
53
|
+
.optional(),
|
|
42
54
|
model: z.string().optional(),
|
|
43
55
|
temperature: z.number().min(0).max(2).optional(),
|
|
44
56
|
maxTokens: z.number().positive().optional(),
|
|
45
|
-
systemPrompt: z.string().optional()
|
|
57
|
+
systemPrompt: z.string().optional(),
|
|
46
58
|
});
|
|
47
59
|
/**
|
|
48
60
|
* Provider Selection Input Schema
|
|
49
61
|
*/
|
|
50
62
|
const ProviderSelectionSchema = z.object({
|
|
51
63
|
preferred: z.string().optional(),
|
|
52
|
-
requirements: z
|
|
64
|
+
requirements: z
|
|
65
|
+
.object({
|
|
53
66
|
multimodal: z.boolean().optional(),
|
|
54
67
|
streaming: z.boolean().optional(),
|
|
55
68
|
maxTokens: z.number().optional(),
|
|
56
|
-
costEfficient: z.boolean().optional()
|
|
57
|
-
})
|
|
69
|
+
costEfficient: z.boolean().optional(),
|
|
70
|
+
})
|
|
71
|
+
.optional(),
|
|
58
72
|
});
|
|
59
73
|
/**
|
|
60
74
|
* Register Text Generation Tool
|
|
61
75
|
* Core tool that leverages existing AIProviderFactory for text generation
|
|
62
76
|
*/
|
|
63
77
|
aiCoreServer.registerTool({
|
|
64
|
-
name:
|
|
65
|
-
description:
|
|
66
|
-
category:
|
|
78
|
+
name: "generate-text",
|
|
79
|
+
description: "Generate text using AI providers with automatic fallback and provider selection",
|
|
80
|
+
category: "text-generation",
|
|
67
81
|
inputSchema: TextGenerationSchema,
|
|
68
82
|
isImplemented: true,
|
|
69
83
|
execute: async (params, context) => {
|
|
@@ -72,17 +86,17 @@ aiCoreServer.registerTool({
|
|
|
72
86
|
logger.debug(`[AI-Core] Starting text generation: "${params.prompt.substring(0, 50)}..."`);
|
|
73
87
|
// Use existing AIProviderFactory with best provider selection
|
|
74
88
|
const selectedProvider = params.provider || getBestProvider(params.provider);
|
|
75
|
-
const provider = AIProviderFactory.createBestProvider(selectedProvider);
|
|
89
|
+
const provider = await AIProviderFactory.createBestProvider(selectedProvider);
|
|
76
90
|
// Generate text using existing NeuroLink patterns
|
|
77
91
|
const result = await provider.generateText({
|
|
78
92
|
prompt: params.prompt,
|
|
79
93
|
model: params.model,
|
|
80
94
|
temperature: params.temperature,
|
|
81
95
|
maxTokens: params.maxTokens,
|
|
82
|
-
systemPrompt: params.systemPrompt
|
|
96
|
+
systemPrompt: params.systemPrompt,
|
|
83
97
|
});
|
|
84
98
|
if (!result) {
|
|
85
|
-
throw new Error(
|
|
99
|
+
throw new Error("AI provider returned null result");
|
|
86
100
|
}
|
|
87
101
|
const executionTime = Date.now() - startTime;
|
|
88
102
|
logger.debug(`[AI-Core] Text generation successful in ${executionTime}ms using ${selectedProvider}`);
|
|
@@ -90,23 +104,23 @@ aiCoreServer.registerTool({
|
|
|
90
104
|
success: true,
|
|
91
105
|
data: {
|
|
92
106
|
text: result.text,
|
|
93
|
-
model: params.model ||
|
|
107
|
+
model: params.model || "default",
|
|
94
108
|
provider: selectedProvider,
|
|
95
|
-
generatedAt: new Date().toISOString()
|
|
109
|
+
generatedAt: new Date().toISOString(),
|
|
96
110
|
},
|
|
97
111
|
usage: {
|
|
98
112
|
tokens: result.usage?.totalTokens,
|
|
99
113
|
provider: selectedProvider,
|
|
100
|
-
model: params.model ||
|
|
101
|
-
executionTime
|
|
114
|
+
model: params.model || "default",
|
|
115
|
+
executionTime,
|
|
102
116
|
},
|
|
103
117
|
metadata: {
|
|
104
|
-
toolName:
|
|
105
|
-
serverId:
|
|
118
|
+
toolName: "generate-text",
|
|
119
|
+
serverId: "neurolink-ai-core",
|
|
106
120
|
sessionId: context.sessionId,
|
|
107
121
|
timestamp: Date.now(),
|
|
108
|
-
executionTime
|
|
109
|
-
}
|
|
122
|
+
executionTime,
|
|
123
|
+
},
|
|
110
124
|
};
|
|
111
125
|
}
|
|
112
126
|
catch (error) {
|
|
@@ -117,24 +131,24 @@ aiCoreServer.registerTool({
|
|
|
117
131
|
success: false,
|
|
118
132
|
error: errorMessage,
|
|
119
133
|
metadata: {
|
|
120
|
-
toolName:
|
|
121
|
-
serverId:
|
|
134
|
+
toolName: "generate-text",
|
|
135
|
+
serverId: "neurolink-ai-core",
|
|
122
136
|
sessionId: context.sessionId,
|
|
123
137
|
timestamp: Date.now(),
|
|
124
|
-
executionTime
|
|
125
|
-
}
|
|
138
|
+
executionTime,
|
|
139
|
+
},
|
|
126
140
|
};
|
|
127
141
|
}
|
|
128
|
-
}
|
|
142
|
+
},
|
|
129
143
|
});
|
|
130
144
|
/**
|
|
131
145
|
* Register Provider Selection Tool
|
|
132
146
|
* Intelligent provider selection based on requirements and availability
|
|
133
147
|
*/
|
|
134
148
|
aiCoreServer.registerTool({
|
|
135
|
-
name:
|
|
136
|
-
description:
|
|
137
|
-
category:
|
|
149
|
+
name: "select-provider",
|
|
150
|
+
description: "Select the best available AI provider based on requirements and availability",
|
|
151
|
+
category: "provider-management",
|
|
138
152
|
inputSchema: ProviderSelectionSchema,
|
|
139
153
|
isImplemented: true,
|
|
140
154
|
execute: async (params, context) => {
|
|
@@ -144,12 +158,26 @@ aiCoreServer.registerTool({
|
|
|
144
158
|
// Use existing provider selection logic
|
|
145
159
|
const availableProviders = getAvailableProviders();
|
|
146
160
|
const selectedProvider = getBestProvider(params.preferred);
|
|
147
|
-
// Get provider capabilities
|
|
161
|
+
// Get provider capabilities
|
|
148
162
|
const getProviderCapabilities = (provider) => ({
|
|
149
|
-
multimodal: provider ===
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
163
|
+
multimodal: provider === "openai" ||
|
|
164
|
+
provider === "vertex" ||
|
|
165
|
+
provider === "google-ai",
|
|
166
|
+
streaming: provider === "openai" ||
|
|
167
|
+
provider === "anthropic" ||
|
|
168
|
+
provider === "azure" ||
|
|
169
|
+
provider === "mistral",
|
|
170
|
+
maxTokens: provider === "anthropic"
|
|
171
|
+
? 100000
|
|
172
|
+
: provider === "huggingface"
|
|
173
|
+
? 2048
|
|
174
|
+
: 4000,
|
|
175
|
+
costEfficient: provider === "google-ai" ||
|
|
176
|
+
provider === "vertex" ||
|
|
177
|
+
provider === "huggingface" ||
|
|
178
|
+
provider === "ollama",
|
|
179
|
+
localExecution: provider === "ollama",
|
|
180
|
+
openSource: provider === "huggingface" || provider === "ollama",
|
|
153
181
|
});
|
|
154
182
|
const capabilities = getProviderCapabilities(selectedProvider);
|
|
155
183
|
const executionTime = Date.now() - startTime;
|
|
@@ -162,19 +190,19 @@ aiCoreServer.registerTool({
|
|
|
162
190
|
capabilities,
|
|
163
191
|
reason: params.preferred
|
|
164
192
|
? `Preferred provider ${params.preferred} selected`
|
|
165
|
-
:
|
|
166
|
-
selectedAt: new Date().toISOString()
|
|
193
|
+
: "Best available provider selected",
|
|
194
|
+
selectedAt: new Date().toISOString(),
|
|
167
195
|
},
|
|
168
196
|
usage: {
|
|
169
|
-
executionTime
|
|
197
|
+
executionTime,
|
|
170
198
|
},
|
|
171
199
|
metadata: {
|
|
172
|
-
toolName:
|
|
173
|
-
serverId:
|
|
200
|
+
toolName: "select-provider",
|
|
201
|
+
serverId: "neurolink-ai-core",
|
|
174
202
|
sessionId: context.sessionId,
|
|
175
203
|
timestamp: Date.now(),
|
|
176
|
-
executionTime
|
|
177
|
-
}
|
|
204
|
+
executionTime,
|
|
205
|
+
},
|
|
178
206
|
};
|
|
179
207
|
}
|
|
180
208
|
catch (error) {
|
|
@@ -185,58 +213,73 @@ aiCoreServer.registerTool({
|
|
|
185
213
|
success: false,
|
|
186
214
|
error: errorMessage,
|
|
187
215
|
metadata: {
|
|
188
|
-
toolName:
|
|
189
|
-
serverId:
|
|
216
|
+
toolName: "select-provider",
|
|
217
|
+
serverId: "neurolink-ai-core",
|
|
190
218
|
sessionId: context.sessionId,
|
|
191
219
|
timestamp: Date.now(),
|
|
192
|
-
executionTime
|
|
193
|
-
}
|
|
220
|
+
executionTime,
|
|
221
|
+
},
|
|
194
222
|
};
|
|
195
223
|
}
|
|
196
|
-
}
|
|
224
|
+
},
|
|
197
225
|
});
|
|
198
226
|
/**
|
|
199
227
|
* Register Provider Status Tool
|
|
200
228
|
* Check health and availability of AI providers
|
|
201
229
|
*/
|
|
202
230
|
aiCoreServer.registerTool({
|
|
203
|
-
name:
|
|
204
|
-
description:
|
|
205
|
-
category:
|
|
231
|
+
name: "check-provider-status",
|
|
232
|
+
description: "Check the health and availability status of AI providers",
|
|
233
|
+
category: "provider-management",
|
|
206
234
|
inputSchema: z.object({
|
|
207
235
|
provider: z.string().optional(),
|
|
208
|
-
includeCapabilities: z.boolean().default(true)
|
|
236
|
+
includeCapabilities: z.boolean().default(true),
|
|
209
237
|
}),
|
|
210
238
|
isImplemented: true,
|
|
211
239
|
execute: async (params, context) => {
|
|
212
240
|
const startTime = Date.now();
|
|
213
241
|
try {
|
|
214
|
-
logger.debug(`[AI-Core] Checking provider status for: ${params.provider ||
|
|
242
|
+
logger.debug(`[AI-Core] Checking provider status for: ${params.provider || "all providers"}`);
|
|
215
243
|
const availableProviders = getAvailableProviders();
|
|
216
244
|
const providerStatuses = [];
|
|
217
|
-
const providersToCheck = params.provider
|
|
245
|
+
const providersToCheck = params.provider
|
|
246
|
+
? [params.provider]
|
|
247
|
+
: availableProviders;
|
|
218
248
|
for (const provider of providersToCheck) {
|
|
219
249
|
try {
|
|
220
250
|
// Quick health check (can be enhanced with actual API calls)
|
|
221
251
|
const isAvailable = availableProviders.includes(provider);
|
|
222
252
|
providerStatuses.push({
|
|
223
253
|
provider,
|
|
224
|
-
status: isAvailable ?
|
|
225
|
-
capabilities: params.includeCapabilities
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
254
|
+
status: isAvailable ? "available" : "unavailable",
|
|
255
|
+
capabilities: params.includeCapabilities
|
|
256
|
+
? {
|
|
257
|
+
textGeneration: true,
|
|
258
|
+
multimodal: provider === "openai" ||
|
|
259
|
+
provider === "vertex" ||
|
|
260
|
+
provider === "google-ai",
|
|
261
|
+
streaming: provider === "openai" ||
|
|
262
|
+
provider === "anthropic" ||
|
|
263
|
+
provider === "azure" ||
|
|
264
|
+
provider === "mistral",
|
|
265
|
+
maxTokens: provider === "anthropic"
|
|
266
|
+
? 100000
|
|
267
|
+
: provider === "huggingface"
|
|
268
|
+
? 2048
|
|
269
|
+
: 4000,
|
|
270
|
+
localExecution: provider === "ollama",
|
|
271
|
+
openSource: provider === "huggingface" || provider === "ollama",
|
|
272
|
+
}
|
|
273
|
+
: undefined,
|
|
274
|
+
lastChecked: new Date().toISOString(),
|
|
232
275
|
});
|
|
233
276
|
}
|
|
234
277
|
catch (error) {
|
|
235
278
|
providerStatuses.push({
|
|
236
279
|
provider,
|
|
237
|
-
status:
|
|
280
|
+
status: "error",
|
|
238
281
|
error: error instanceof Error ? error.message : String(error),
|
|
239
|
-
lastChecked: new Date().toISOString()
|
|
282
|
+
lastChecked: new Date().toISOString(),
|
|
240
283
|
});
|
|
241
284
|
}
|
|
242
285
|
}
|
|
@@ -248,22 +291,23 @@ aiCoreServer.registerTool({
|
|
|
248
291
|
providers: providerStatuses,
|
|
249
292
|
summary: {
|
|
250
293
|
total: providerStatuses.length,
|
|
251
|
-
available: providerStatuses.filter(p => p.status ===
|
|
252
|
-
|
|
253
|
-
|
|
294
|
+
available: providerStatuses.filter((p) => p.status === "available")
|
|
295
|
+
.length,
|
|
296
|
+
unavailable: providerStatuses.filter((p) => p.status === "unavailable").length,
|
|
297
|
+
errors: providerStatuses.filter((p) => p.status === "error").length,
|
|
254
298
|
},
|
|
255
|
-
checkedAt: new Date().toISOString()
|
|
299
|
+
checkedAt: new Date().toISOString(),
|
|
256
300
|
},
|
|
257
301
|
usage: {
|
|
258
|
-
executionTime
|
|
302
|
+
executionTime,
|
|
259
303
|
},
|
|
260
304
|
metadata: {
|
|
261
|
-
toolName:
|
|
262
|
-
serverId:
|
|
305
|
+
toolName: "check-provider-status",
|
|
306
|
+
serverId: "neurolink-ai-core",
|
|
263
307
|
sessionId: context.sessionId,
|
|
264
308
|
timestamp: Date.now(),
|
|
265
|
-
executionTime
|
|
266
|
-
}
|
|
309
|
+
executionTime,
|
|
310
|
+
},
|
|
267
311
|
};
|
|
268
312
|
}
|
|
269
313
|
catch (error) {
|
|
@@ -274,15 +318,15 @@ aiCoreServer.registerTool({
|
|
|
274
318
|
success: false,
|
|
275
319
|
error: errorMessage,
|
|
276
320
|
metadata: {
|
|
277
|
-
toolName:
|
|
278
|
-
serverId:
|
|
321
|
+
toolName: "check-provider-status",
|
|
322
|
+
serverId: "neurolink-ai-core",
|
|
279
323
|
sessionId: context.sessionId,
|
|
280
324
|
timestamp: Date.now(),
|
|
281
|
-
executionTime
|
|
282
|
-
}
|
|
325
|
+
executionTime,
|
|
326
|
+
},
|
|
283
327
|
};
|
|
284
328
|
}
|
|
285
|
-
}
|
|
329
|
+
},
|
|
286
330
|
});
|
|
287
331
|
/**
|
|
288
332
|
* Register AI Analysis Tools
|
|
@@ -300,4 +344,4 @@ aiCoreServer.registerTool(refactorCodeTool);
|
|
|
300
344
|
aiCoreServer.registerTool(generateDocumentationTool);
|
|
301
345
|
aiCoreServer.registerTool(debugAIOutputTool);
|
|
302
346
|
// Log successful server creation
|
|
303
|
-
logger.debug(
|
|
347
|
+
logger.debug("[AI-Core] NeuroLink AI Core Server v1.2.0 created with 10 tools:", Object.keys(aiCoreServer.tools));
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* AI Development Workflow Tools
|
|
3
3
|
* Phase 1.2 Implementation - 4 specialized tools for AI development lifecycle
|
|
4
4
|
*/
|
|
5
|
-
import { z } from
|
|
6
|
-
import type { NeuroLinkMCPTool } from
|
|
5
|
+
import { z } from "zod";
|
|
6
|
+
import type { NeuroLinkMCPTool } from "../../factory.js";
|
|
7
7
|
/**
|
|
8
8
|
* Generate test cases for code functions
|
|
9
9
|
*/
|
|
@@ -22,7 +22,7 @@ export declare const generateDocumentationTool: NeuroLinkMCPTool;
|
|
|
22
22
|
export declare const debugAIOutputTool: NeuroLinkMCPTool;
|
|
23
23
|
export declare const aiWorkflowTools: NeuroLinkMCPTool[];
|
|
24
24
|
export declare const workflowToolSchemas: {
|
|
25
|
-
|
|
25
|
+
"generate-test-cases": z.ZodObject<{
|
|
26
26
|
codeFunction: z.ZodString;
|
|
27
27
|
testTypes: z.ZodDefault<z.ZodArray<z.ZodEnum<["unit", "integration", "edge-cases", "performance", "security"]>, "many">>;
|
|
28
28
|
framework: z.ZodDefault<z.ZodEnum<["jest", "mocha", "vitest", "pytest", "unittest", "rspec"]>>;
|
|
@@ -41,7 +41,7 @@ export declare const workflowToolSchemas: {
|
|
|
41
41
|
coverageTarget?: number | undefined;
|
|
42
42
|
includeAsyncTests?: boolean | undefined;
|
|
43
43
|
}>;
|
|
44
|
-
|
|
44
|
+
"refactor-code": z.ZodObject<{
|
|
45
45
|
code: z.ZodString;
|
|
46
46
|
language: z.ZodDefault<z.ZodString>;
|
|
47
47
|
objectives: z.ZodDefault<z.ZodArray<z.ZodEnum<["readability", "performance", "maintainability", "testability", "modularity", "dry-principle", "solid-principles"]>, "many">>;
|
|
@@ -60,7 +60,7 @@ export declare const workflowToolSchemas: {
|
|
|
60
60
|
preserveFunctionality?: boolean | undefined;
|
|
61
61
|
styleGuide?: string | undefined;
|
|
62
62
|
}>;
|
|
63
|
-
|
|
63
|
+
"generate-documentation": z.ZodObject<{
|
|
64
64
|
code: z.ZodString;
|
|
65
65
|
language: z.ZodDefault<z.ZodString>;
|
|
66
66
|
documentationType: z.ZodDefault<z.ZodEnum<["jsdoc", "markdown", "sphinx", "doxygen", "readme"]>>;
|
|
@@ -79,7 +79,7 @@ export declare const workflowToolSchemas: {
|
|
|
79
79
|
includeExamples?: boolean | undefined;
|
|
80
80
|
detailLevel?: "minimal" | "standard" | "comprehensive" | undefined;
|
|
81
81
|
}>;
|
|
82
|
-
|
|
82
|
+
"debug-ai-output": z.ZodObject<{
|
|
83
83
|
aiOutput: z.ZodString;
|
|
84
84
|
expectedBehavior: z.ZodString;
|
|
85
85
|
context: z.ZodOptional<z.ZodString>;
|