@@ -31,11 +31,12 @@ def initialize(method_name)
3131
3232 include Instrumentation
3333
34- attr_accessor :name , :version , :tools , :prompts , :resources , :server_context , :configuration , :capabilities , :transport
34+ attr_accessor :name , :version , :instructions , : tools, :prompts , :resources , :server_context , :configuration , :capabilities , :transport
3535
3636 def initialize (
3737 name : "model_context_protocol" ,
3838 version : DEFAULT_VERSION ,
39+ instructions : nil ,
3940 tools : [ ] ,
4041 prompts : [ ] ,
4142 resources : [ ] ,
@@ -47,13 +48,20 @@ def initialize(
4748 )
4849 @name = name
4950 @version = version
51+ @instructions = instructions
5052 @tools = tools . to_h { |t | [ t . name_value , t ] }
5153 @prompts = prompts . to_h { |p | [ p . name_value , p ] }
5254 @resources = resources
5355 @resource_templates = resource_templates
5456 @resource_index = index_resources_by_uri ( resources )
5557 @server_context = server_context
5658 @configuration = MCP . configuration . merge ( configuration )
59+
60+ if @configuration . protocol_version == "2024-11-05" && @instructions
61+ message = "`instructions` supported by protocol version 2025-03-26 or higher"
62+ raise ArgumentError , message
63+ end
64+
5765 @capabilities = capabilities || default_capabilities
5866
5967 @handlers = {
@@ -218,7 +226,8 @@ def init(request)
218226 protocolVersion : configuration . protocol_version ,
219227 capabilities : capabilities ,
220228 serverInfo : server_info ,
221- }
229+ instructions : instructions ,
230+ } . compact
222231 end
223232
224233 def list_tools ( request )
0 commit comments