This document details the comprehensive features implemented in the FSharp.MCP.DevKit solution, with emphasis on the advanced documentation generation, code analysis, and safe code manipulation capabilities.
A comprehensive documentation generation system powered by .NET reflection, F# Compiler Services, and intelligent markdown generation.
-
GeneratePackageDocumentation- Generate comprehensive API documentation for NuGet packages- Extracts types, methods, properties, and XML documentation
- Creates organized markdown files with navigation
- Supports version information and assembly analysis
- Performance: 0.22 seconds for complex packages like System.Text.Json
-
GenerateProjectDocumentation- Bulk documentation generation for entire F# projects- Analyzes all referenced packages in project files
- Generates unified documentation structure
- Supports multi-project solutions
-
SearchDocumentation- Context-aware search through generated documentation- Full-text search across markdown files
- Returns structured results with context
- Supports filtering by type, namespace, and category
- Example: 157 matches for "JsonSerializer" across 21 files
-
ListCachedPackages- Browse and discover available NuGet packages- Scans local NuGet cache for packages
- Supports search filtering by package name
- Shows version information and availability
-
ShowPackageInfo- Detailed package information and metadata- Version history and assembly information
- XML documentation availability
- Package path and modification dates
-
SetDocumentationOutputDirectory- Runtime configuration management- Dynamic output directory configuration
- Persistent settings across sessions
-
ShowDocumentationConfig- Display current documentation settings- Output directory configuration
- XML documentation inclusion settings
- NuGet cache location and format options
Recent performance benchmarks:
- System.Text.Json: 243 types, 2844 methods, 789 properties in 0.22 seconds
- Search Performance: 157 matches across 21 files with detailed context
- Package Discovery: 150+ packages with filtering in under 1 second
type DocumentationEntry = {
Name: string; FullName: string; Category: string
Signature: string; XmlDocumentation: string option
SourceLocation: string option; Assembly: string option
Namespace: string option; Parameters: (string * string * string option) array
ReturnType: string option; Examples: string array; Tags: string array
}
type DocumentationResult = {
TotalEntries: int; Categories: Map<string, int>
Entries: DocumentationEntry array; GeneratedAt: DateTime
SourceFiles: string array; ReferencedAssemblies: string array
}Advanced code manipulation system with AST validation, atomic operations, and comprehensive safety checks.
-
InsertCode- Unified code insertion with pre-format, validation, post-format, and atomic write operations- Pre-formatting with Fantomas integration
- AST validation and syntax checking
- Column positioning and indentation handling
- Atomic file operations with backup/rollback
- Context validation and warning system
-
PreviewCodeInjection- Preview code changes before applying them- Shows exactly how code will look after insertion
- Validates insertion points and context
- Supports column positioning preview
FormatFile- Format entire F# script files using FantomasDeleteLines- Delete specific lines from F# files with validationReplaceTextRange- Replace text in specific line ranges with new contentSearchAndReplace- Search and replace text patterns with occurrence countingMoveCodeBlock- Move code blocks between locations within filesGetLines- Extract specific lines for inspection with line numberingCountLines- Count total lines and characters in filesSearchInFile- Search for text patterns with line numbers and context
ParseSourceToAST- Parse source code to Abstract Syntax Tree for analysisAnalyzeCodeStructure- Examine F# code structure and dependenciesParseAndCheckFSharpCode- Comprehensive F# syntax and type validation
- AST Validation: All code insertions are validated against F# syntax rules
- Context Analysis: Insertion points are analyzed for safety (e.g., avoiding mid-type insertion)
- Atomic Operations: File operations use temporary files with backup/rollback
- Type Checking: Integration with F# Compiler Services for type validation
- Format Integration: Automatic code formatting to maintain consistency
Comprehensive FSI session management with persistent state and robust error handling.
CheckFSIServerStatus- Check FSI server status and availabilityResetFSISession- Reset FSI session clearing all bindings and stateRestartFSISession- Restart FSI session (stop and start fresh, better than reset)GetFSIState- Get current FSI state and bindings with detailed information
ExecuteFSharpCode- Execute F# code with comprehensive error handlingExecuteFSharpCodeDetailed- Execute F# code with detailed error information and diagnosticsEvaluateFSharpExpression- Evaluate F# expressions with type informationLoadFSharpScript- Load F# script files using #load directiveReferenceAssembly- Reference .NET assemblies using #r directiveReferenceNuGetPackage- Reference NuGet packages using #r "nuget:" directiveAddSearchPath- Add directories to F# search path using #I directive
- Persistent Sessions: FSI state maintained across multiple tool invocations
- Concurrent Safety: Thread-safe operations with proper synchronization
- Error Recovery: Comprehensive error handling and diagnostic reporting
- Performance Monitoring: Execution timing and resource usage tracking
Sophisticated code analysis capabilities powered by F# Compiler Services and custom symbol detection.
- Symbol Detection: Advanced symbol detection and resolution with position sensitivity
- Type Analysis: Comprehensive type information extraction and validation
- Dependency Tracking: Track and analyze code dependencies and relationships
- Scope Analysis: Analyze variable scope and binding contexts
- Structure Analysis: Examine F# code organization and architecture patterns
- Context-Aware Analysis: Analysis based on cursor position and surrounding code
- Smart Insertion Points: Intelligent detection of safe code insertion locations
- Shadowing Detection: Identify variable shadowing and scope conflicts
- Type Inference: Leverage F# type inference for enhanced analysis
KillAll- Kill all MCP server processes for clean restarts- Identifies running FSharp.MCP.DevKit processes
- Handles both direct and dotnet-hosted processes
- Provides detailed cleanup reporting
- Dynamic Configuration: Runtime configuration changes without restart
- Persistent Settings: Configuration persisted across sessions
- Environment Detection: Automatic detection of platform-specific settings
- Validation: Configuration validation with helpful error messages
- 30+ Specialized Tools: Comprehensive toolkit for F# development workflows
- Stdio Transport: Standard input/output transport for universal compatibility
- JSON-RPC Protocol: Standard MCP JSON-RPC protocol implementation
- Error Handling: Comprehensive error reporting and recovery
- Async Operations: Non-blocking operations with proper task management
- Named Pipes: High-performance IPC for FSI communication
- Concurrent Processing: Multi-threaded operations with proper synchronization
- Request Routing: Intelligent routing of MCP requests to appropriate handlers
- State Management: Proper state management across tool invocations
- Fast Documentation Generation: Complex packages documented in under 1 second
- Efficient Search: Full-text search across large documentation sets
- Low Memory Footprint: Optimized memory usage for large codebases
- Concurrent Operations: Support for multiple simultaneous operations
- Error Recovery: Graceful error handling and recovery mechanisms
- Atomic Operations: All-or-nothing file operations with rollback
- Validation: Comprehensive validation at multiple levels
- Monitoring: Built-in monitoring and diagnostic capabilities