diff --git a/src/ModelContextProtocol.Analyzers/Diagnostics.cs b/src/ModelContextProtocol.Analyzers/Diagnostics.cs index e2c70412b..99f868f88 100644 --- a/src/ModelContextProtocol.Analyzers/Diagnostics.cs +++ b/src/ModelContextProtocol.Analyzers/Diagnostics.cs @@ -25,7 +25,7 @@ internal static class Diagnostics title: "MCP method must be partial to generate [Description] attributes", messageFormat: "Method '{0}' has XML documentation that could be used to generate [Description] attributes, but the method is not declared as partial.", category: "mcp", - defaultSeverity: DiagnosticSeverity.Warning, + defaultSeverity: DiagnosticSeverity.Info, isEnabledByDefault: true, description: "Methods with MCP attributes should be declared as partial to allow the source generator to emit Description attributes from XML documentation comments."); } diff --git a/src/ModelContextProtocol.Analyzers/XmlToDescriptionGenerator.cs b/src/ModelContextProtocol.Analyzers/XmlToDescriptionGenerator.cs index a5dff0c70..0110ac018 100644 --- a/src/ModelContextProtocol.Analyzers/XmlToDescriptionGenerator.cs +++ b/src/ModelContextProtocol.Analyzers/XmlToDescriptionGenerator.cs @@ -72,7 +72,7 @@ private static void Execute(Compilation compilation, ImmutableArray methodsToGenerate = new(methods.Length); foreach (var methodModel in methods) { - var xmlDocs = ExtractXmlDocumentation(methodModel.MethodSymbol, context); + var xmlDocs = ExtractXmlDocumentation(methodModel.MethodSymbol, methodModel.MethodDeclaration, context); // Generate implementation for partial methods. if (methodModel.MethodDeclaration.Modifiers.Any(SyntaxKind.PartialKeyword)) @@ -97,7 +97,7 @@ private static void Execute(Compilation compilation, ImmutableArray d.Id == "MCP002"); - Assert.Equal(DiagnosticSeverity.Warning, diagnostic.Severity); + Assert.Equal(DiagnosticSeverity.Info, diagnostic.Severity); Assert.Contains("TestMethod", diagnostic.GetMessage()); Assert.Contains("partial", diagnostic.GetMessage()); } @@ -412,7 +412,7 @@ public static string TestMethod(string input) // Should report MCP002 diagnostic because parameter has documentation var diagnostic = Assert.Single(result.Diagnostics, d => d.Id == "MCP002"); - Assert.Equal(DiagnosticSeverity.Warning, diagnostic.Severity); + Assert.Equal(DiagnosticSeverity.Info, diagnostic.Severity); } [Fact] @@ -441,7 +441,7 @@ public static string TestMethod(string input) // Should report MCP002 diagnostic because return has documentation var diagnostic = Assert.Single(result.Diagnostics, d => d.Id == "MCP002"); - Assert.Equal(DiagnosticSeverity.Warning, diagnostic.Severity); + Assert.Equal(DiagnosticSeverity.Info, diagnostic.Severity); } [Fact] @@ -559,7 +559,7 @@ public static string TestMethod(string input) // Should report MCP002 diagnostic because parameter description would be generated var diagnostic = Assert.Single(result.Diagnostics, d => d.Id == "MCP002"); - Assert.Equal(DiagnosticSeverity.Warning, diagnostic.Severity); + Assert.Equal(DiagnosticSeverity.Info, diagnostic.Severity); } [Fact] @@ -590,7 +590,7 @@ public static string TestPrompt(string input) // Should report MCP002 diagnostic for prompts too var diagnostic = Assert.Single(result.Diagnostics, d => d.Id == "MCP002"); - Assert.Equal(DiagnosticSeverity.Warning, diagnostic.Severity); + Assert.Equal(DiagnosticSeverity.Info, diagnostic.Severity); } [Fact] @@ -621,7 +621,7 @@ public static string TestResource(string input) // Should report MCP002 diagnostic for resources too var diagnostic = Assert.Single(result.Diagnostics, d => d.Id == "MCP002"); - Assert.Equal(DiagnosticSeverity.Warning, diagnostic.Severity); + Assert.Equal(DiagnosticSeverity.Info, diagnostic.Severity); } [Fact]