UNPKG

@gork-labs/secondbrain-mcp

Version:

Second Brain MCP Server - Agent team orchestration with dynamic tool discovery

110 lines (109 loc) 3.49 kB
export declare class SecondBrainServer { private server; private sessionManager; private subagentLoader; private qualityValidator; private refinementManager; private analyticsManager; private mlEngine; private mcpClientManager; constructor(); private setupHandlers; private handleSpawnAgentsParallel; /** * Validate task description to ensure it doesn't contain tool call mentions * Sub-agents have different tool capabilities, so tool names shouldn't be specified in tasks */ private validateTaskForToolMentions; private handleSpawnAgent; private handleListSubagents; private handleValidateOutput; /** * Create a validation error response when JSON parsing fails */ private createValidationErrorResponse; /** * Create a valid SubAgentResponse from partially parsed data */ private createValidSubAgentResponse; private handleGetSessionStats; private handleGetMCPServerStats; /** * REAL SUB-AGENT SPAWNING - Implementing Approved Architecture v3.0.0 * Replaces simulation with actual specialist agent delegation */ private spawnRealAgent; /** * Create sub-agent wrapper as per approved architecture v3.0.0 * Implements universal wrapper with selective tool access control * Uses well-optimized subagent content directly (no runtime optimization needed) */ private createSubAgentWrapper; /** * Execute real sub-agent using AI model with chatmode expertise * Implements actual AI delegation rather than simulation */ private executeRealSubAgent; /** * Execute sub-agent with OpenRouter using function calling for tool access */ private executeWithOpenRouter; /** * Parse sub-agent response from AI model output with retry support */ private parseSubAgentResponse; /** * Create example arguments from JSON schema for tool documentation */ private createExampleFromSchema; /** * Check if tool is a SecondBrain MCP tool (blocked for sub-agents) */ private isSecondBrainMCPTool; /** * Create helpful error message for tool failures */ private createToolErrorMessage; /** * Create enhanced tool documentation with common patterns and examples */ private createEnhancedToolDocumentation; /** * Calculate string similarity between two strings (0-1 scale) */ private calculateStringSimilarity; /** * Calculate Levenshtein distance between two strings */ private levenshteinDistance; /** * Create a legacy-compatible quality assessment for backward compatibility */ private createLegacyAssessment; /** * Handle quality analytics requests */ private handleGetQualityAnalytics; /** * Handle performance analytics requests */ private handleGetPerformanceAnalytics; /** * Handle system health requests */ private handleGetSystemHealth; /** * Handle analytics report generation requests */ private handleGenerateAnalyticsReport; private handlePredictQualityScore; private handlePredictRefinementSuccess; private handleGetMLInsights; private handleGetOptimizationSuggestions; initialize(): Promise<void>; /** * Convert MCP input schema to OpenAI function parameters schema */ private convertMCPSchemaToOpenAI; start(): Promise<void>; }