UNPKG

@flexabrain/mcp-server

Version:

Advanced electrical schematic analysis MCP server with rail engineering expertise

720 lines 28 kB
/** * FlexaBrain MCP Server - Enhanced PDF Schematic Processing Tools * * MCP tools definition for railway traction generator monitoring control systems. * Provides comprehensive API endpoints for PDF schematic analysis, component extraction, * and FlexaBrain AI agent integration. */ export const FLEXABRAIN_SCHEMATIC_TOOLS = [ { name: "analyze-pdf-schematic", description: "Upload and analyze a PDF schematic document for railway traction generator monitoring systems. Extracts components, generates cross-page references, and initiates AI agent analysis.", inputSchema: { type: "object", properties: { file_path: { type: "string", description: "Path to the PDF schematic file to analyze" }, document_type: { type: "string", enum: ["traction_control", "generator_monitoring", "power_distribution", "general"], description: "Type of schematic document for optimized processing" }, processing_options: { type: "object", properties: { extract_images: { type: "boolean", default: true, description: "Extract and enhance schematic images" }, enhance_quality: { type: "boolean", default: true, description: "Apply image quality enhancement" }, detect_rotation: { type: "boolean", default: true, description: "Automatically detect and correct page rotation" }, extract_cross_references: { type: "boolean", default: true, description: "Detect cross-page component references" }, enable_line_detection: { type: "boolean", default: true, description: "Detect electrical connection lines" }, processing_dpi: { type: "number", default: 300, description: "DPI for image processing (150-600)" }, ocr_language: { type: "string", default: "eng", description: "OCR language code" }, component_confidence_threshold: { type: "number", default: 0.7, description: "Minimum confidence threshold for component detection (0.0-1.0)" } } }, rail_system_type: { type: "string", description: "Type of railway system (e.g., 'freight', 'passenger', 'metro')" }, voltage_system: { type: "string", description: "System voltage specification (e.g., '25kV AC', '1.5kV DC')" }, priority: { type: "string", enum: ["low", "medium", "high", "urgent"], default: "medium", description: "Processing priority level" }, enable_ai_analysis: { type: "boolean", default: true, description: "Enable analysis by FlexaBrain AI agents (Oracle, Sentinel, Sage)" } }, required: ["file_path", "document_type"] } }, { name: "get-schematic-data", description: "Retrieve processed schematic data including components, cross-references, and AI analysis results.", inputSchema: { type: "object", properties: { document_id: { type: "string", description: "Unique identifier of the processed schematic document" }, include_components: { type: "boolean", default: true, description: "Include extracted component data" }, include_cross_references: { type: "boolean", default: true, description: "Include cross-page references" }, include_ai_analysis: { type: "boolean", default: true, description: "Include AI agent analysis results" }, component_type_filter: { type: "array", items: { type: "string" }, description: "Filter components by type (e.g., ['generator', 'circuit_breaker'])" }, confidence_threshold: { type: "number", default: 0.0, description: "Minimum confidence threshold for returned components" }, page_range: { type: "object", properties: { start_page: { type: "number", minimum: 1 }, end_page: { type: "number", minimum: 1 } }, description: "Limit results to specific page range" } }, required: ["document_id"] } }, { name: "get-processing-status", description: "Check the processing status of a schematic document and get progress information.", inputSchema: { type: "object", properties: { document_id: { type: "string", description: "Unique identifier of the schematic document" }, include_logs: { type: "boolean", default: false, description: "Include processing logs and error details" }, include_statistics: { type: "boolean", default: true, description: "Include processing statistics" } }, required: ["document_id"] } }, { name: "search-components", description: "Search for specific components across processed schematic documents.", inputSchema: { type: "object", properties: { search_query: { type: "string", description: "Search term for component identification or type" }, document_id: { type: "string", description: "Limit search to specific document (optional)" }, component_types: { type: "array", items: { type: "string" }, description: "Filter by component types" }, safety_levels: { type: "array", items: { type: "string", enum: ["safe", "low", "medium", "high", "critical"] }, description: "Filter by safety levels" }, compliance_status: { type: "array", items: { type: "string", enum: ["compliant", "non_compliant", "requires_review", "unknown"] }, description: "Filter by compliance status" }, confidence_range: { type: "object", properties: { min: { type: "number", minimum: 0, maximum: 1 }, max: { type: "number", minimum: 0, maximum: 1 } }, description: "Filter by confidence score range" }, limit: { type: "number", default: 100, minimum: 1, maximum: 1000, description: "Maximum number of results to return" } }, required: ["search_query"] } }, { name: "get-ai-analysis-results", description: "Retrieve AI analysis results from FlexaBrain agents (Oracle, Sentinel, Sage) for components or documents.", inputSchema: { type: "object", properties: { document_id: { type: "string", description: "Document identifier" }, component_id: { type: "string", description: "Specific component identifier (optional)" }, agent_name: { type: "string", enum: ["oracle", "sentinel", "sage"], description: "Filter by specific AI agent" }, analysis_types: { type: "array", items: { type: "string" }, description: "Filter by analysis types (e.g., ['predictive_maintenance', 'anomaly_detection'])" }, time_range: { type: "object", properties: { start_date: { type: "string", format: "date-time", description: "Start date for analysis results" }, end_date: { type: "string", format: "date-time", description: "End date for analysis results" } }, description: "Filter by analysis date range" }, confidence_threshold: { type: "number", default: 0.0, minimum: 0, maximum: 1, description: "Minimum confidence threshold for analysis results" }, include_expired: { type: "boolean", default: false, description: "Include expired predictions and time-sensitive analyses" } }, required: ["document_id"] } }, { name: "trigger-ai-analysis", description: "Manually trigger AI analysis for specific components or entire documents using FlexaBrain agents.", inputSchema: { type: "object", properties: { document_id: { type: "string", description: "Document identifier" }, component_ids: { type: "array", items: { type: "string" }, description: "Specific component identifiers (optional, analyzes all if not provided)" }, agents: { type: "array", items: { type: "string", enum: ["oracle", "sentinel", "sage"] }, default: ["oracle", "sentinel", "sage"], description: "AI agents to use for analysis" }, analysis_types: { type: "array", items: { type: "string" }, description: "Specific analysis types to perform" }, priority: { type: "string", enum: ["low", "medium", "high", "urgent"], default: "medium", description: "Analysis priority level" }, force_reanalysis: { type: "boolean", default: false, description: "Force re-analysis even if recent results exist" } }, required: ["document_id"] } }, { name: "update-component-data", description: "Update component data with manual corrections, annotations, or additional specifications.", inputSchema: { type: "object", properties: { component_id: { type: "string", description: "Component identifier to update" }, updates: { type: "object", properties: { component_type: { type: "string", description: "Corrected component type" }, component_category: { type: "string", description: "Component category" }, specifications: { type: "object", description: "Technical specifications (voltage, current, power, etc.)" }, safety_level: { type: "string", enum: ["safe", "low", "medium", "high", "critical"], description: "Safety level assessment" }, compliance_status: { type: "string", enum: ["compliant", "non_compliant", "requires_review", "unknown"], description: "Compliance status" }, rail_system_context: { type: "object", description: "Railway system specific context and parameters" } }, description: "Component data updates" }, annotation: { type: "object", properties: { annotation_type: { type: "string", enum: ["correction", "note", "verification", "enhancement", "flag"], description: "Type of annotation" }, annotation_text: { type: "string", description: "Annotation text" }, created_by: { type: "string", description: "User making the annotation" } }, description: "Optional annotation for the update" }, verification: { type: "object", properties: { verified: { type: "boolean", description: "Mark component as verified" }, verified_by: { type: "string", description: "User who verified the component" }, verification_method: { type: "string", enum: ["manual", "auto", "ai_agent"], description: "Verification method" } }, description: "Verification information" } }, required: ["component_id", "updates"] } }, { name: "create-collaboration-session", description: "Create a real-time collaboration session for multi-user schematic analysis and annotation.", inputSchema: { type: "object", properties: { document_id: { type: "string", description: "Document identifier for collaboration" }, session_name: { type: "string", description: "Name for the collaboration session" }, created_by: { type: "string", description: "User creating the session" }, session_type: { type: "string", enum: ["analysis", "review", "maintenance_planning", "training"], default: "analysis", description: "Type of collaboration session" }, permissions: { type: "object", properties: { allow_annotations: { type: "boolean", default: true, description: "Allow participants to add annotations" }, allow_data_updates: { type: "boolean", default: false, description: "Allow participants to update component data" }, allow_ai_triggers: { type: "boolean", default: true, description: "Allow participants to trigger AI analysis" } }, description: "Session permissions" }, expiration: { type: "string", format: "date-time", description: "Session expiration time (optional)" } }, required: ["document_id", "session_name", "created_by"] } }, { name: "join-collaboration-session", description: "Join an existing collaboration session for real-time schematic analysis.", inputSchema: { type: "object", properties: { session_id: { type: "string", description: "Collaboration session identifier" }, user_id: { type: "string", description: "User identifier joining the session" }, user_role: { type: "string", enum: ["viewer", "analyst", "engineer", "supervisor"], default: "analyst", description: "User role in the session" } }, required: ["session_id", "user_id"] } }, { name: "get-collaboration-status", description: "Get status and activity of collaboration sessions.", inputSchema: { type: "object", properties: { session_id: { type: "string", description: "Specific session identifier (optional)" }, document_id: { type: "string", description: "Get sessions for specific document (optional)" }, user_id: { type: "string", description: "Get sessions for specific user (optional)" }, status_filter: { type: "array", items: { type: "string", enum: ["active", "paused", "closed"] }, description: "Filter by session status" }, include_events: { type: "boolean", default: false, description: "Include recent collaboration events" } } } }, { name: "export-schematic-data", description: "Export processed schematic data in various formats for integration with other systems.", inputSchema: { type: "object", properties: { document_id: { type: "string", description: "Document identifier to export" }, export_format: { type: "string", enum: ["json", "xml", "csv", "pdf_report", "cad_import"], default: "json", description: "Export format" }, include_data: { type: "object", properties: { components: { type: "boolean", default: true }, cross_references: { type: "boolean", default: true }, ai_analysis: { type: "boolean", default: true }, images: { type: "boolean", default: false }, annotations: { type: "boolean", default: true } }, description: "Data to include in export" }, filter_options: { type: "object", properties: { component_types: { type: "array", items: { type: "string" }, description: "Filter by component types" }, confidence_threshold: { type: "number", minimum: 0, maximum: 1, description: "Minimum confidence threshold" }, safety_levels: { type: "array", items: { type: "string" }, description: "Filter by safety levels" } }, description: "Export filtering options" }, output_path: { type: "string", description: "Output file path (optional)" } }, required: ["document_id"] } }, { name: "get-system-statistics", description: "Get comprehensive statistics about schematic processing, AI analysis, and system performance.", inputSchema: { type: "object", properties: { time_range: { type: "object", properties: { start_date: { type: "string", format: "date-time" }, end_date: { type: "string", format: "date-time" } }, description: "Time range for statistics" }, include_sections: { type: "array", items: { type: "string", enum: [ "document_processing", "component_extraction", "ai_analysis", "collaboration_activity", "system_performance", "error_analysis" ] }, default: ["document_processing", "component_extraction", "ai_analysis"], description: "Statistics sections to include" }, document_types: { type: "array", items: { type: "string" }, description: "Filter by document types" } } } }, { name: "manage-processing-queue", description: "Manage the schematic processing queue - view status, pause, resume, or prioritize tasks.", inputSchema: { type: "object", properties: { action: { type: "string", enum: ["status", "pause", "resume", "clear", "prioritize"], description: "Queue management action" }, document_id: { type: "string", description: "Specific document to manage (for prioritize action)" }, new_priority: { type: "string", enum: ["low", "medium", "high", "urgent"], description: "New priority level (for prioritize action)" }, filter_by_status: { type: "array", items: { type: "string", enum: ["pending", "processing", "completed", "failed"] }, description: "Filter queue by processing status" } }, required: ["action"] } } ]; export const TOOL_CATEGORIES = { PROCESSING: [ "analyze-pdf-schematic", "get-processing-status", "manage-processing-queue" ], DATA_RETRIEVAL: [ "get-schematic-data", "search-components", "export-schematic-data" ], AI_ANALYSIS: [ "get-ai-analysis-results", "trigger-ai-analysis" ], DATA_MANAGEMENT: [ "update-component-data" ], COLLABORATION: [ "create-collaboration-session", "join-collaboration-session", "get-collaboration-status" ], SYSTEM: [ "get-system-statistics" ] }; export default FLEXABRAIN_SCHEMATIC_TOOLS; //# sourceMappingURL=mcp-tools-definition.js.map