sharplens-mcp
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| ROSLYN_LOG_LEVEL | No | Logging verbosity: Trace, Debug, Information, Warning, Error. | Information |
| DOTNET_SOLUTION_PATH | No | Path to .sln or .slnx file to auto-load on startup. If not set, you must call the load_solution tool before using other tools. | None |
| ROSLYN_MAX_DIAGNOSTICS | No | Maximum diagnostics to return. | 100 |
| ROSLYN_TIMEOUT_SECONDS | No | Timeout for long-running operations. | 30 |
| SHARPLENS_ABSOLUTE_PATHS | No | Use absolute paths instead of relative (relative paths save tokens). | false |
| ROSLYN_ENABLE_SEMANTIC_CACHE | No | Enable semantic model caching. | true |
Instructions
Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.
This server publishes no instructions, or was last inspected before Glama recorded them.
Capabilities
Features and capabilities supported by this server
Protocol revision2025-11-25
| Capability | Details |
|---|---|
| tools | {} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| roslyn:health_checkA | Check the health and status of the Roslyn MCP server and workspace. Returns: server status, solution loaded state, project count, and memory usage. Call this first to verify the server is ready. |
| roslyn:load_solutionA | Load a .NET solution for analysis. MUST be called before using any other analysis tools. Returns: projectCount, documentCount, and load time. Use health_check to verify current state. |
| roslyn:sync_documentsA | Synchronize document changes from disk into the loaded solution. Call this after using Edit/Write tools to ensure Roslyn has fresh content. USAGE:
WHEN TO CALL:
HANDLES: Modified files (updates content), new files (adds to solution), deleted files (removes from solution). Much faster than load_solution - only updates documents, doesn't re-parse projects. |
| roslyn:get_symbol_infoA | Get detailed semantic information about a symbol at a specific position. IMPORTANT: Uses ZERO-BASED coordinates. If your editor shows 'Line 14, Column 5', pass line=13, column=4. Returns symbol kind, type, namespace, documentation, and location. |
| roslyn:go_to_definitionA | Fast navigation to symbol definition. Returns the definition location without finding all references. IMPORTANT: Uses ZERO-BASED coordinates (editor line 10 = pass line 9). |
| roslyn:find_referencesA | Find all references to a symbol across the entire solution. Returns file paths, line numbers, and code context for each reference. IMPORTANT: Uses ZERO-BASED coordinates (editor line 10 = pass line 9). |
| roslyn:find_implementationsA | Find all implementations of an interface or abstract class. Returns implementing types with their locations. IMPORTANT: Uses ZERO-BASED coordinates (editor line - 1). |
| roslyn:get_type_hierarchyA | Get the inheritance hierarchy (base types and derived types) for a type. Returns baseTypes chain and derivedTypes list. IMPORTANT: Uses ZERO-BASED coordinates (editor line - 1). |
| roslyn:search_symbolsA | Search for types, methods, properties, etc. by name across the solution. Supports glob patterns (e.g., 'Handler' finds classes ending with 'Handler', 'Get' finds symbols starting with 'Get'). Use ? for single character wildcard. PAGINATION: Returns totalCount and hasMore. Use offset to paginate through results. |
| roslyn:semantic_queryA | Advanced semantic code query with multiple filters. Find symbols based on their semantic properties. EXAMPLES:
FILTERS: All specified filters are combined with AND logic. Omit a filter to skip it. Returns symbol details with locations. |
| roslyn:get_diagnosticsA | Get compiler errors, warnings, and info messages for a file or entire project. Returns: list of diagnostics with id, message, severity, and location. Use before committing to catch issues. |
| roslyn:get_code_fixesA | Get available code fixes for a specific diagnostic. Returns list of fix titles and descriptions. WORKFLOW: (1) get_diagnostics to find issues, (2) get_code_fixes to see options, (3) apply_code_fix to fix. |
| roslyn:apply_code_fixA | Apply automated code fix for a diagnostic. WORKFLOW: (1) Call with no fixIndex to list available fixes, (2) Call with fixIndex and preview=true to preview changes, (3) Call with preview=false to apply. IMPORTANT: Uses ZERO-BASED coordinates. |
| roslyn:get_project_structureA | Get solution/project structure. IMPORTANT: For large solutions (100+ projects), use summaryOnly=true or projectNamePattern to avoid token limit errors. Maximum output is limited to 25,000 tokens. |
| roslyn:organize_usingsA | Sort and remove unused using directives in a file. Returns the modified file content. Automatically removes unused usings and sorts alphabetically. |
| roslyn:organize_usings_batchA | Organize using directives for multiple files in a project. Supports file pattern filtering (e.g., '.cs', 'Services/.cs'). PREVIEW mode by default - set preview=false to apply changes. |
| roslyn:format_document_batchB | Format multiple documents in a project using Roslyn's NormalizeWhitespace. Ensures consistent indentation, spacing, and line breaks. PREVIEW mode by default - set preview=false to apply changes. |
| roslyn:get_method_overloadsA | Get all overloads of a method. Returns list of signatures with parameter details. Use when you need to choose between overloads. IMPORTANT: Uses ZERO-BASED coordinates (editor line - 1). |
| roslyn:get_containing_memberA | Get information about the containing method/property/class at a position. Returns the enclosing symbol's name, kind, and signature. Useful for understanding context. IMPORTANT: Uses ZERO-BASED coordinates (editor line - 1). |
| roslyn:find_callersA | Find all methods/properties that call or reference a specific symbol (inverse of find_references). Essential for impact analysis: 'If I change this method, what code will be affected?' IMPORTANT: Uses ZERO-BASED coordinates. |
| roslyn:find_unused_codeA | Find unused types, methods, properties, and fields in a project or entire solution. Returns symbols with zero references (excluding their declaration). USAGE: find_unused_code() for entire solution, or find_unused_code(projectName="MyProject") for specific project. OUTPUT: List of unused symbols with location, kind, and accessibility. Default limit: 50 results. |
| roslyn:rename_symbolA | Safely rename a symbol (type, method, property, etc.) across the entire solution. Uses Roslyn's semantic analysis to ensure all references are updated. SUPPORTS PREVIEW MODE - always preview first! IMPORTANT: Uses ZERO-BASED coordinates. Default shows first 20 files with summary verbosity. |
| roslyn:extract_interfaceA | Generate an interface from a class or struct. Extracts all public instance members (methods, properties, events). USAGE: Position on class declaration, provide interfaceName="IMyService". OUTPUT: Generated interface code ready to insert. Useful for dependency injection and testability. IMPORTANT: Uses ZERO-BASED coordinates (editor line - 1). |
| roslyn:dependency_graphA | Visualize project dependencies as a graph. Shows which projects reference which, detects circular dependencies. OUTPUT: format="json" returns structured data with nodes/edges. format="mermaid" returns diagram syntax. USE CASE: Understand solution architecture, find circular dependencies, plan refactoring. |
| roslyn:get_type_membersA | Get all members (methods, properties, fields, events) of a type BY NAME. USAGE PATTERNS:
WORKS WITH: Fully-qualified ("MyNamespace.MyClass"), simple ("MyClass"), or partial names. |
| roslyn:get_method_signatureB | Get detailed method signature BY NAME including parameters, return type, nullability, and modifiers. USAGE: get_method_signature("MyClass", "ProcessData") or with overload selection: get_method_signature("MyClass", "ProcessData", overloadIndex=1) |
| roslyn:get_attributesB | Find all symbols with specific attributes. USAGE:
|
| roslyn:get_derived_typesA | Find all types inheriting from a base type BY NAME. USAGE:
|
| roslyn:get_base_typesA | Get full inheritance chain BY NAME. USAGE: get_base_types("MyService") returns: MyService → BaseService → ... → Object |
| roslyn:analyze_data_flowB | Analyze variable assignments and usage in a code region. Returns: variablesDeclared, alwaysAssigned, dataFlowsIn/Out, readInside/Outside, writtenInside/Outside, captured. USAGE: analyze_data_flow("path/to/file.cs", startLine=10, endLine=25) |
| roslyn:analyze_control_flowA | Analyze branching and reachability in a code region. Returns: entryPoints, exitPoints, returnStatements, endPointIsReachable. USAGE: analyze_control_flow("path/to/file.cs", startLine=10, endLine=25) |
| roslyn:get_type_overviewA | Get comprehensive type overview in ONE CALL: type info + base types (first 3) + member counts. USAGE: get_type_overview("MyService") - returns everything you need to understand a type quickly. |
| roslyn:analyze_methodA | Get comprehensive method analysis in ONE CALL: signature + callers + outgoing calls + location. USAGE: analyze_method("MyService", "ProcessData") or analyze_method("MyClass", "Calculate", includeCallers=true, includeOutgoingCalls=true) |
| roslyn:get_file_overviewA | Get comprehensive file overview in ONE CALL: diagnostics summary + type declarations + namespace + line count. USAGE: get_file_overview("path/to/MyClass.cs") |
| roslyn:get_missing_membersA | Get all interface and abstract members that must be implemented for a type. USAGE: Position on a class that implements interfaces or extends abstract classes. OUTPUT: List of missing members with exact signatures ready to copy. Use before implementing interfaces. IMPORTANT: Uses ZERO-BASED coordinates (editor line - 1). |
| roslyn:get_outgoing_callsA | Get all methods and properties that a method calls. Helps understand method dependencies and behavior. Returns list of called symbols with locations. IMPORTANT: Uses ZERO-BASED coordinates (editor line - 1). |
| roslyn:validate_codeA | Check if code would compile without writing to disk. Use to validate generated code before applying. USAGE: validate_code(code="public void Foo() {}", contextFilePath="path/to/file.cs") to check with existing usings. OUTPUT: compiles (bool), errors list with line numbers. Essential before inserting AI-generated code. |
| roslyn:check_type_compatibilityA | Check if one type can be assigned to another. Use before generating assignments or casts. USAGE: check_type_compatibility(sourceType="MyDerivedClass", targetType="MyBaseClass") OUTPUT: compatible (bool), requiresCast (bool), conversionKind, and explanation of why/why not. |
| roslyn:get_instantiation_optionsA | Get all ways to create an instance of a type: constructors, factory methods, and builder patterns. USAGE: get_instantiation_options(typeName="HttpClient") OUTPUT: List of constructors with signatures, static factory methods, and hints (e.g., "implements IDisposable"). |
| roslyn:analyze_change_impactA | Analyze what would break if you change a symbol. Identifies breaking changes before you make them. USAGE: analyze_change_impact(filePath, line, column, changeType="rename|changeType|addParameter|removeParameter") OUTPUT: List of impacted locations, whether change is safe, and specific issues at each location. IMPORTANT: Uses ZERO-BASED coordinates (editor line - 1). |
| roslyn:get_method_sourceA | Get the actual source code of a method by type and method name. Eliminates need for file Read. USAGE: get_method_source(typeName="MyService", methodName="ProcessData") OUTPUT: Full method source including signature, body, location (file + line numbers), and line count. |
| roslyn:get_method_source_batchA | Get source code for multiple methods in a single call (batch optimization). USAGE: get_method_source_batch(methods: [{typeName: 'ServiceA', methodName: 'Process'}, {typeName: 'ServiceB', methodName: 'Handle'}]) OUTPUT: Results array with source for each method, plus errors array for any that failed. BENEFIT: One call instead of multiple - reduces round trips when tracing code flows. |
| roslyn:generate_constructorA | Generate a constructor from fields and/or properties of a type. USAGE: Position on class/struct declaration. Use includeProperties=true for auto-properties. OUTPUT: constructorCode string ready to paste, parameter list, and field assignments. IMPORTANT: Uses ZERO-BASED coordinates (editor line - 1). |
| roslyn:change_signatureA | Change a method signature and preview impact on all call sites. ACTIONS: add (new param), remove, rename, reorder parameters. WORKFLOW: (1) Call with preview=true (default) to see affected call sites, (2) Review changes, (3) Call with preview=false to apply. OUTPUT: oldSignature, newSignature, list of call sites needing updates. IMPORTANT: Uses ZERO-BASED coordinates (editor line - 1). |
| roslyn:extract_methodA | Extract selected statements into a new method. Uses data flow analysis to determine parameters and return type. USAGE: Specify startLine/endLine range containing complete statements inside a method. OUTPUT: extractedCode (the new method), replacementCode (the call to insert), detected parameters and return type. WORKFLOW: (1) Preview with preview=true, (2) Apply with preview=false. IMPORTANT: Uses ZERO-BASED coordinates (editor line - 1). |
| roslyn:get_code_actions_at_positionA | Get ALL available code actions (fixes + refactorings) at a position. This is the master tool that exposes 100+ Roslyn refactorings. USAGE: get_code_actions_at_position(filePath, line, column) or with selection: add endLine, endColumn OUTPUT: List of actions with title, kind (fix/refactoring), equivalenceKey WORKFLOW: (1) Call this to see available actions, (2) Use apply_code_action_by_title to apply one IMPORTANT: Uses ZERO-BASED coordinates (editor line - 1). |
| roslyn:apply_code_action_by_titleA | Apply a code action by its title. Supports exact and partial matching. USAGE: apply_code_action_by_title(filePath, line, column, title) OUTPUT: Changed files with preview or applied changes WORKFLOW: (1) Call get_code_actions_at_position first, (2) Apply with preview=true, (3) Apply with preview=false IMPORTANT: Uses ZERO-BASED coordinates (editor line - 1). |
| roslyn:implement_missing_membersA | Generate stub implementations for interface/abstract members. USAGE: Position cursor on class declaration that implements interface or extends abstract class. OUTPUT: Generated stub code for all missing members. IMPORTANT: Uses ZERO-BASED coordinates (editor line - 1). |
| roslyn:encapsulate_fieldA | Convert a field to a property with getter/setter. USAGE: Position cursor on a field declaration. OUTPUT: Generated property wrapping the field. IMPORTANT: Uses ZERO-BASED coordinates (editor line - 1). |
| roslyn:inline_variableA | Inline a variable, replacing all usages with its value. USAGE: Position cursor on a variable declaration or usage. OUTPUT: Variable removed and all usages replaced with the expression. IMPORTANT: Uses ZERO-BASED coordinates (editor line - 1). |
| roslyn:extract_variableA | Extract an expression to a local variable. USAGE: Position cursor on or select an expression. OUTPUT: Expression extracted to a new local variable. IMPORTANT: Uses ZERO-BASED coordinates (editor line - 1). |
| roslyn:get_complexity_metricsA | Get complexity metrics for a method or entire file. METRICS: cyclomatic (decision points), nesting (max depth), loc (lines), parameters (count), cognitive (Sonar-style) USAGE: get_complexity_metrics(filePath) for file, or add line/column for specific method OUTPUT: Per-method breakdown with all requested metrics IMPORTANT: Uses ZERO-BASED coordinates (editor line - 1). |
| roslyn:add_null_checksA | Add ArgumentNullException.ThrowIfNull guard clauses for nullable parameters. USAGE: Position cursor on a method with reference type parameters. OUTPUT: Generated guard clauses inserted at method start. IMPORTANT: Uses ZERO-BASED coordinates (editor line - 1). |
| roslyn:generate_equality_membersA | Generate Equals, GetHashCode, and == / != operators for a type. USAGE: Position cursor on a class or struct declaration. OUTPUT: Generated equality members comparing all instance fields and properties. IMPORTANT: Uses ZERO-BASED coordinates (editor line - 1). |
| roslyn:get_type_members_batchA | Get members for multiple types in a single call (batch optimization). USAGE: get_type_members_batch(typeNames: ['ServiceA', 'ServiceB', 'ControllerC']) OUTPUT: Results for each type with members, or error if type not found BENEFIT: One call instead of multiple - reduces context usage for AI agents |
| roslyn:find_attribute_usagesA | Find all types and members decorated with a specific attribute. USAGE: find_attribute_usages(attributeName: "Authorize") USAGE: find_attribute_usages(attributeName: "HttpGet", projectName: "MyApi") OUTPUT: List of symbols with the attribute, their kind, arguments, and source location. Use for: finding all API endpoints, authorization points, serialization config, test fixtures. |
| roslyn:get_di_registrationsA | Scan for dependency injection service registrations (AddScoped, AddTransient, AddSingleton, etc.). USAGE: get_di_registrations() USAGE: get_di_registrations(projectName: "MyApi") OUTPUT: List of DI registrations with lifetime, service type, implementation type, and location. Use for: understanding service wiring, finding missing registrations, auditing lifetimes. |
| roslyn:find_reflection_usageA | Detect dynamic/reflection-based type and method usage that is invisible to static reference searches. USAGE: find_reflection_usage() USAGE: find_reflection_usage(projectName: "MyApp", maxResults: 50) OUTPUT: List of reflection API calls with the API used, context, and location. Use for: finding hidden dependencies before refactoring, security audits, understanding dynamic behavior. |
| roslyn:find_circular_dependenciesA | Detect cycles in project or namespace dependency graphs. USAGE: find_circular_dependencies() — project-level cycles USAGE: find_circular_dependencies(level: "namespace") — namespace-level cycles OUTPUT: Dependency graph with any detected cycles listed. Use for: architecture analysis, identifying tightly coupled components. |
| roslyn:get_nuget_dependenciesA | List NuGet package references per project with versions. USAGE: get_nuget_dependencies() USAGE: get_nuget_dependencies(projectName: "MyApp") OUTPUT: List of projects with their NuGet packages, versions, and asset settings. Use for: dependency audits, version checks, understanding external dependencies. |
| roslyn:get_source_generatorsA | List active source generators and their generated output per project. USAGE: get_source_generators() USAGE: get_source_generators(projectName: "MyApp") OUTPUT: List of generators with their assembly info and generated files. Use for: understanding generated code, debugging generator issues. |
| roslyn:get_generated_codeA | View the source code produced by a source generator. USAGE: get_generated_code(projectName: "MyApp", generatedFileName: "MyType.g.cs") OUTPUT: Full source code of the generated file. Use get_source_generators first to discover available generated files. |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
No prompts | |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
No resources | |
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/pzalutski-pixel/sharplens-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server