@juspay/neurolink
Version:
Universal AI Development Platform with working MCP integration, multi-provider support, voice (TTS/STT/realtime), and professional CLI. 58+ external MCP servers discoverable, multimodal file processing, RAG pipelines. Build, test, and deploy AI applicatio
76 lines (75 loc) • 2.68 kB
JavaScript
/**
* Tool Utilities - Centralized tool configuration access
*
* Consolidates environment variable access to avoid scattered process.env calls
*/
/**
* Check if built-in tools should be disabled
* Centralized function to replace direct process.env access
*
* @param toolConfig - Optional tool configuration (if available from config)
* @returns true if built-in tools should be disabled
*/
export function shouldDisableBuiltinTools(toolConfig) {
// Priority: explicit config > environment variable > default (false)
if (toolConfig?.disableBuiltinTools !== undefined) {
return toolConfig.disableBuiltinTools;
}
// Single source of truth for environment variable access
return process.env.NEUROLINK_DISABLE_BUILTIN_TOOLS === "true";
}
/**
* Check if custom tools should be allowed
* @param toolConfig - Optional tool configuration
* @returns true if custom tools should be allowed
*/
export function shouldAllowCustomTools(toolConfig) {
if (toolConfig?.allowCustomTools !== undefined) {
return toolConfig.allowCustomTools;
}
return process.env.NEUROLINK_DISABLE_CUSTOM_TOOLS !== "true";
}
/**
* Check if MCP tools should be enabled
* @param toolConfig - Optional tool configuration
* @returns true if MCP tools should be enabled
*/
export function shouldEnableMCPTools(toolConfig) {
if (toolConfig?.enableMCPTools !== undefined) {
return toolConfig.enableMCPTools;
}
return process.env.NEUROLINK_DISABLE_MCP_TOOLS !== "true";
}
/**
* Check if the bash command execution tool should be enabled.
* This is opt-in only (defaults to false) for security reasons.
*
* @param toolConfig - Optional tool configuration (if available from config)
* @returns true if the bash tool should be enabled
*/
export function shouldEnableBashTool(toolConfig) {
// Priority: explicit config > environment variable > default (false)
if (toolConfig?.enableBashTool !== undefined) {
return toolConfig.enableBashTool;
}
// Single source of truth for environment variable access
return process.env.NEUROLINK_ENABLE_BASH_TOOL === "true";
}
/**
* Get maximum tools per provider
* @param toolConfig - Optional tool configuration
* @returns maximum number of tools per provider
*/
export function getMaxToolsPerProvider(toolConfig) {
if (toolConfig?.maxToolsPerProvider !== undefined) {
return toolConfig.maxToolsPerProvider;
}
const envMax = process.env.NEUROLINK_MAX_TOOLS_PER_PROVIDER;
if (envMax) {
const parsed = parseInt(envMax, 10);
if (!isNaN(parsed) && parsed > 0) {
return parsed;
}
}
return 100; // Default
}