@@ -133,7 +133,7 @@ class ServerTest < ActiveSupport::TestCase
133133 jsonrpc : "2.0" ,
134134 id : 1 ,
135135 result : {
136- protocolVersion : "2025-06-18" ,
136+ protocolVersion : Configuration :: DRAFT_PROTOCOL_VERSION ,
137137 capabilities : {
138138 prompts : { listChanged : true } ,
139139 resources : { listChanged : true } ,
@@ -776,7 +776,7 @@ def call(message:, server_context: nil)
776776 }
777777
778778 response = @server . handle ( request )
779- assert_equal Configuration ::DEFAULT_PROTOCOL_VERSION , response [ :result ] [ :protocolVersion ]
779+ assert_equal Configuration ::DRAFT_PROTOCOL_VERSION , response [ :result ] [ :protocolVersion ]
780780 end
781781
782782 test "server response does not include title when not configured" do
@@ -852,6 +852,67 @@ def call(message:, server_context: nil)
852852 assert_equal ( "Error occurred in defined_tool. `annotations` are supported by protocol version 2025-03-26 or higher" , exception . message )
853853 end
854854
855+ test "raises error if `title` of `server_info` is used with protocol version 2025-03-26" do
856+ configuration = Configuration . new ( protocol_version : "2025-03-26" )
857+
858+ exception = assert_raises ( ArgumentError ) do
859+ Server . new ( name : "test_server" , title : "Example Server Display Name" , configuration : configuration )
860+ end
861+ assert_equal ( "Error occurred in server_info. `title` is not supported in protocol version 2025-03-26 or earlier" , exception . message )
862+ end
863+
864+ test "raises error if `title` of tool is used with protocol version 2025-03-26" do
865+ configuration = Configuration . new ( protocol_version : "2025-03-26" )
866+ server = Server . new ( name : "test_server" , configuration : configuration )
867+
868+ exception = assert_raises ( ArgumentError ) do
869+ server . define_tool (
870+ title : "Test tool" ,
871+ )
872+ end
873+ assert_equal ( "Error occurred in Test tool. `title` is not supported in protocol version 2025-03-26 or earlier" , exception . message )
874+ end
875+
876+ test "raises error if `title` of prompt is used with protocol version 2025-03-26" do
877+ configuration = Configuration . new ( protocol_version : "2025-03-26" )
878+ server = Server . new ( name : "test_server" , configuration : configuration )
879+
880+ exception = assert_raises ( ArgumentError ) do
881+ server . define_prompt (
882+ title : "Test prompt" ,
883+ )
884+ end
885+ assert_equal ( "Error occurred in Test prompt. `title` is not supported in protocol version 2025-03-26 or earlier" , exception . message )
886+ end
887+
888+ test "raises error if `title` of resource is used with protocol version 2025-03-26" do
889+ configuration = Configuration . new ( protocol_version : "2025-03-26" )
890+
891+ resource = Resource . new (
892+ uri : "https://test_resource.invalid" ,
893+ name : "test-resource" ,
894+ title : "Test resource" ,
895+ )
896+ exception = assert_raises ( ArgumentError ) do
897+ Server . new ( name : "test_server" , resources : [ resource ] , configuration : configuration )
898+ end
899+ assert_equal ( "Error occurred in Test resource. `title` is not supported in protocol version 2025-03-26 or earlier" , exception . message )
900+ end
901+
902+ test "raises error if `title` of resource template is used with protocol version 2025-03-26" do
903+ configuration = Configuration . new ( protocol_version : "2025-03-26" )
904+
905+ resource = Resource . new (
906+ uri : "https://test_resource.invalid" ,
907+ name : "test-resource" ,
908+ title : "Test resource template" ,
909+ )
910+ exception = assert_raises ( ArgumentError ) do
911+ Server . new ( name : "test_server" , resources : [ resource ] , configuration : configuration )
912+ end
913+ assert_equal ( "Error occurred in Test resource template. `title` is not supported in protocol version 2025-03-26 or earlier" , exception . message )
914+ end
915+
855916 test "#define_tool adds a tool to the server" do
856917 @server . define_tool (
857918 name : "defined_tool" ,
0 commit comments