@@ -44,7 +44,7 @@ public void WithTools_UsesServerWideOptions_WhenNoExplicitOptionsProvided()
4444 var services = new ServiceCollection ( ) ;
4545 var customOptions = new JsonSerializerOptions ( McpJsonUtilities . DefaultOptions )
4646 {
47- NumberHandling = JsonNumberHandling . AllowNamedFloatingPointLiterals
47+ PropertyNamingPolicy = JsonNamingPolicy . SnakeCaseLower
4848 } ;
4949
5050 services . Configure < McpServerOptions > ( options =>
@@ -54,20 +54,30 @@ public void WithTools_UsesServerWideOptions_WhenNoExplicitOptionsProvided()
5454
5555 var builder = services . AddMcpServer ( ) ;
5656
57- // Act - WithTools should pick up the server-wide options
57+ // Act - WithTools should pick up the server-wide options with snake_case naming policy
5858 builder . WithTools < TestTools > ( ) ;
5959 var serviceProvider = services . BuildServiceProvider ( ) ;
6060
61- // Assert - Verify the tool was registered
61+ // Assert - Verify the tool schema uses snake_case property naming
6262 var tools = serviceProvider . GetServices < McpServerTool > ( ) . ToList ( ) ;
6363 Assert . Single ( tools ) ;
64- Assert . Equal ( "TestTool" , tools [ 0 ] . ProtocolTool . Name ) ;
64+
65+ var tool = tools [ 0 ] ;
66+ Assert . Equal ( "ToolWithParameters" , tool . ProtocolTool . Name ) ;
67+
68+ // Check that the input schema uses snake_case for property names
69+ var inputSchema = tool . ProtocolTool . InputSchema ;
70+
71+ // The schema should have a "properties" object with snake_case property names
72+ var propertiesElement = inputSchema . GetProperty ( "properties" ) ;
73+ Assert . True ( propertiesElement . TryGetProperty ( "my_parameter" , out _ ) , "Schema should have 'my_parameter' property (snake_case)" ) ;
74+ Assert . False ( propertiesElement . TryGetProperty ( "MyParameter" , out _ ) , "Schema should not have 'MyParameter' property (PascalCase)" ) ;
6575 }
6676
6777 [ McpServerToolType ]
6878 private class TestTools
6979 {
7080 [ McpServerTool ]
71- public static string TestTool ( ) => "test" ;
81+ public static string ToolWithParameters ( string myParameter ) => myParameter ;
7282 }
7383}
0 commit comments