Merge branch 'main' into auto-determine-capabilities
This commit is contained in:
commit
00e1ed8fec
2 changed files with 25 additions and 3 deletions
|
|
@ -6,6 +6,8 @@ require_relative "methods"
|
|||
|
||||
module ModelContextProtocol
|
||||
class Server
|
||||
DEFAULT_VERSION = "0.1.0"
|
||||
|
||||
class RequestHandlerError < StandardError
|
||||
attr_reader :error_type
|
||||
attr_reader :original_error
|
||||
|
|
@ -20,11 +22,13 @@ module ModelContextProtocol
|
|||
|
||||
include Instrumentation
|
||||
|
||||
|
||||
attr_writer :capabilities
|
||||
attr_accessor :name, :tools, :prompts, :resources, :server_context, :configuration
|
||||
attr_accessor :name, :version, :tools, :prompts, :resources, :server_context, :configuration
|
||||
|
||||
def initialize(
|
||||
name: "model_context_protocol",
|
||||
version: DEFAULT_VERSION,
|
||||
tools: [],
|
||||
prompts: [],
|
||||
resources: [],
|
||||
|
|
@ -34,6 +38,7 @@ module ModelContextProtocol
|
|||
capabilities: nil
|
||||
)
|
||||
@name = name
|
||||
@version = version
|
||||
@tools = tools.to_h { |t| [t.name_value, t] }
|
||||
@prompts = prompts.to_h { |p| [p.name_value, p] }
|
||||
@resources = resources
|
||||
|
|
@ -169,7 +174,7 @@ module ModelContextProtocol
|
|||
def server_info
|
||||
@server_info ||= {
|
||||
name:,
|
||||
version: ModelContextProtocol::VERSION,
|
||||
version:,
|
||||
}
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@ module ModelContextProtocol
|
|||
def initialize(server)
|
||||
@server = server
|
||||
@open = false
|
||||
$stdin.set_encoding("UTF-8")
|
||||
$stdout.set_encoding("UTF-8")
|
||||
super
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue