@juspay/neurolink 1.6.0 → 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 +193 -7
- package/README.md +100 -17
- 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 +6 -6
- package/dist/cli/commands/config.js +326 -273
- package/dist/cli/commands/mcp.d.ts +2 -1
- package/dist/cli/commands/mcp.js +874 -146
- package/dist/cli/commands/ollama.d.ts +1 -1
- package/dist/cli/commands/ollama.js +153 -143
- package/dist/cli/index.js +589 -323
- 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 +176 -61
- package/dist/core/types.d.ts +4 -2
- package/dist/core/types.js +4 -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 +176 -61
- package/dist/lib/core/types.d.ts +4 -2
- package/dist/lib/core/types.js +4 -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 +204 -65
- package/dist/lib/mcp/servers/ai-providers/ai-core-server.js +142 -102
- 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 +197 -142
- 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 +304 -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 +3 -3
- package/dist/lib/providers/huggingFace.js +70 -63
- package/dist/lib/providers/index.d.ts +11 -11
- package/dist/lib/providers/index.js +18 -18
- 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 +3 -3
- package/dist/lib/providers/mistralAI.js +42 -36
- package/dist/lib/providers/ollama.d.ts +4 -4
- package/dist/lib/providers/ollama.js +113 -98
- 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 +53 -31
- 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 +204 -65
- package/dist/mcp/servers/ai-providers/ai-core-server.js +142 -102
- package/dist/mcp/servers/ai-providers/ai-workflow-tools.d.ts +6 -6
- package/dist/mcp/servers/ai-providers/ai-workflow-tools.js +197 -142
- 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 +304 -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 +3 -3
- package/dist/providers/huggingFace.js +70 -63
- package/dist/providers/index.d.ts +11 -11
- package/dist/providers/index.js +18 -18
- package/dist/providers/mcp-provider.d.ts +62 -0
- package/dist/providers/mcp-provider.js +183 -0
- package/dist/providers/mistralAI.d.ts +3 -3
- package/dist/providers/mistralAI.js +42 -36
- package/dist/providers/ollama.d.ts +4 -4
- package/dist/providers/ollama.js +113 -98
- 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 +53 -31
- package/package.json +175 -161
|
@@ -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) => {
|
|
@@ -146,12 +160,24 @@ aiCoreServer.registerTool({
|
|
|
146
160
|
const selectedProvider = getBestProvider(params.preferred);
|
|
147
161
|
// Get provider capabilities
|
|
148
162
|
const getProviderCapabilities = (provider) => ({
|
|
149
|
-
multimodal: provider ===
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
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",
|
|
155
181
|
});
|
|
156
182
|
const capabilities = getProviderCapabilities(selectedProvider);
|
|
157
183
|
const executionTime = Date.now() - startTime;
|
|
@@ -164,19 +190,19 @@ aiCoreServer.registerTool({
|
|
|
164
190
|
capabilities,
|
|
165
191
|
reason: params.preferred
|
|
166
192
|
? `Preferred provider ${params.preferred} selected`
|
|
167
|
-
:
|
|
168
|
-
selectedAt: new Date().toISOString()
|
|
193
|
+
: "Best available provider selected",
|
|
194
|
+
selectedAt: new Date().toISOString(),
|
|
169
195
|
},
|
|
170
196
|
usage: {
|
|
171
|
-
executionTime
|
|
197
|
+
executionTime,
|
|
172
198
|
},
|
|
173
199
|
metadata: {
|
|
174
|
-
toolName:
|
|
175
|
-
serverId:
|
|
200
|
+
toolName: "select-provider",
|
|
201
|
+
serverId: "neurolink-ai-core",
|
|
176
202
|
sessionId: context.sessionId,
|
|
177
203
|
timestamp: Date.now(),
|
|
178
|
-
executionTime
|
|
179
|
-
}
|
|
204
|
+
executionTime,
|
|
205
|
+
},
|
|
180
206
|
};
|
|
181
207
|
}
|
|
182
208
|
catch (error) {
|
|
@@ -187,60 +213,73 @@ aiCoreServer.registerTool({
|
|
|
187
213
|
success: false,
|
|
188
214
|
error: errorMessage,
|
|
189
215
|
metadata: {
|
|
190
|
-
toolName:
|
|
191
|
-
serverId:
|
|
216
|
+
toolName: "select-provider",
|
|
217
|
+
serverId: "neurolink-ai-core",
|
|
192
218
|
sessionId: context.sessionId,
|
|
193
219
|
timestamp: Date.now(),
|
|
194
|
-
executionTime
|
|
195
|
-
}
|
|
220
|
+
executionTime,
|
|
221
|
+
},
|
|
196
222
|
};
|
|
197
223
|
}
|
|
198
|
-
}
|
|
224
|
+
},
|
|
199
225
|
});
|
|
200
226
|
/**
|
|
201
227
|
* Register Provider Status Tool
|
|
202
228
|
* Check health and availability of AI providers
|
|
203
229
|
*/
|
|
204
230
|
aiCoreServer.registerTool({
|
|
205
|
-
name:
|
|
206
|
-
description:
|
|
207
|
-
category:
|
|
231
|
+
name: "check-provider-status",
|
|
232
|
+
description: "Check the health and availability status of AI providers",
|
|
233
|
+
category: "provider-management",
|
|
208
234
|
inputSchema: z.object({
|
|
209
235
|
provider: z.string().optional(),
|
|
210
|
-
includeCapabilities: z.boolean().default(true)
|
|
236
|
+
includeCapabilities: z.boolean().default(true),
|
|
211
237
|
}),
|
|
212
238
|
isImplemented: true,
|
|
213
239
|
execute: async (params, context) => {
|
|
214
240
|
const startTime = Date.now();
|
|
215
241
|
try {
|
|
216
|
-
logger.debug(`[AI-Core] Checking provider status for: ${params.provider ||
|
|
242
|
+
logger.debug(`[AI-Core] Checking provider status for: ${params.provider || "all providers"}`);
|
|
217
243
|
const availableProviders = getAvailableProviders();
|
|
218
244
|
const providerStatuses = [];
|
|
219
|
-
const providersToCheck = params.provider
|
|
245
|
+
const providersToCheck = params.provider
|
|
246
|
+
? [params.provider]
|
|
247
|
+
: availableProviders;
|
|
220
248
|
for (const provider of providersToCheck) {
|
|
221
249
|
try {
|
|
222
250
|
// Quick health check (can be enhanced with actual API calls)
|
|
223
251
|
const isAvailable = availableProviders.includes(provider);
|
|
224
252
|
providerStatuses.push({
|
|
225
253
|
provider,
|
|
226
|
-
status: isAvailable ?
|
|
227
|
-
capabilities: params.includeCapabilities
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
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(),
|
|
236
275
|
});
|
|
237
276
|
}
|
|
238
277
|
catch (error) {
|
|
239
278
|
providerStatuses.push({
|
|
240
279
|
provider,
|
|
241
|
-
status:
|
|
280
|
+
status: "error",
|
|
242
281
|
error: error instanceof Error ? error.message : String(error),
|
|
243
|
-
lastChecked: new Date().toISOString()
|
|
282
|
+
lastChecked: new Date().toISOString(),
|
|
244
283
|
});
|
|
245
284
|
}
|
|
246
285
|
}
|
|
@@ -252,22 +291,23 @@ aiCoreServer.registerTool({
|
|
|
252
291
|
providers: providerStatuses,
|
|
253
292
|
summary: {
|
|
254
293
|
total: providerStatuses.length,
|
|
255
|
-
available: providerStatuses.filter(p => p.status ===
|
|
256
|
-
|
|
257
|
-
|
|
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,
|
|
258
298
|
},
|
|
259
|
-
checkedAt: new Date().toISOString()
|
|
299
|
+
checkedAt: new Date().toISOString(),
|
|
260
300
|
},
|
|
261
301
|
usage: {
|
|
262
|
-
executionTime
|
|
302
|
+
executionTime,
|
|
263
303
|
},
|
|
264
304
|
metadata: {
|
|
265
|
-
toolName:
|
|
266
|
-
serverId:
|
|
305
|
+
toolName: "check-provider-status",
|
|
306
|
+
serverId: "neurolink-ai-core",
|
|
267
307
|
sessionId: context.sessionId,
|
|
268
308
|
timestamp: Date.now(),
|
|
269
|
-
executionTime
|
|
270
|
-
}
|
|
309
|
+
executionTime,
|
|
310
|
+
},
|
|
271
311
|
};
|
|
272
312
|
}
|
|
273
313
|
catch (error) {
|
|
@@ -278,15 +318,15 @@ aiCoreServer.registerTool({
|
|
|
278
318
|
success: false,
|
|
279
319
|
error: errorMessage,
|
|
280
320
|
metadata: {
|
|
281
|
-
toolName:
|
|
282
|
-
serverId:
|
|
321
|
+
toolName: "check-provider-status",
|
|
322
|
+
serverId: "neurolink-ai-core",
|
|
283
323
|
sessionId: context.sessionId,
|
|
284
324
|
timestamp: Date.now(),
|
|
285
|
-
executionTime
|
|
286
|
-
}
|
|
325
|
+
executionTime,
|
|
326
|
+
},
|
|
287
327
|
};
|
|
288
328
|
}
|
|
289
|
-
}
|
|
329
|
+
},
|
|
290
330
|
});
|
|
291
331
|
/**
|
|
292
332
|
* Register AI Analysis Tools
|
|
@@ -304,4 +344,4 @@ aiCoreServer.registerTool(refactorCodeTool);
|
|
|
304
344
|
aiCoreServer.registerTool(generateDocumentationTool);
|
|
305
345
|
aiCoreServer.registerTool(debugAIOutputTool);
|
|
306
346
|
// Log successful server creation
|
|
307
|
-
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>;
|