Class: ActionMCP::Client::Server
- Inherits:
-
Object
- Object
- ActionMCP::Client::Server
- Defined in:
- lib/action_mcp/client/server.rb
Instance Attribute Summary collapse
-
#capabilities ⇒ Object
readonly
Returns the value of attribute capabilities.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#server_info ⇒ Object
readonly
Returns the value of attribute server_info.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Instance Method Summary collapse
-
#dynamic_resources? ⇒ Boolean
Check if resources have a dynamic state based on listChanged flag.
-
#dynamic_tools? ⇒ Boolean
Check if tools have a dynamic state based on listChanged flag.
-
#initialize(data) ⇒ Server
constructor
A new instance of Server.
- #inspect ⇒ Object (also: #to_s)
-
#logging? ⇒ Boolean
Check if logging capability exists.
-
#prompts? ⇒ Boolean
Check if ‘prompts’ capability is present.
-
#resources? ⇒ Boolean
Check if resources capability exists.
-
#tools? ⇒ Boolean
Check if ‘tools’ capability is present.
Constructor Details
#initialize(data) ⇒ Server
Returns a new instance of Server.
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/action_mcp/client/server.rb', line 8 def initialize(data) # Store protocol version if needed for later use @protocol_version = data["protocolVersion"] # Extract server information @server_info = data["serverInfo"] || {} @name = server_info["name"] @version = server_info["version"] # Store capabilities for dynamic checking @capabilities = data["capabilities"] || {} end |
Instance Attribute Details
#capabilities ⇒ Object (readonly)
Returns the value of attribute capabilities.
6 7 8 |
# File 'lib/action_mcp/client/server.rb', line 6 def capabilities @capabilities end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/action_mcp/client/server.rb', line 6 def name @name end |
#server_info ⇒ Object (readonly)
Returns the value of attribute server_info.
6 7 8 |
# File 'lib/action_mcp/client/server.rb', line 6 def server_info @server_info end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
6 7 8 |
# File 'lib/action_mcp/client/server.rb', line 6 def version @version end |
Instance Method Details
#dynamic_resources? ⇒ Boolean
Check if resources have a dynamic state based on listChanged flag
48 49 50 51 |
# File 'lib/action_mcp/client/server.rb', line 48 def dynamic_resources? resources_cap = @capabilities["resources"] || {} resources_cap["listChanged"] == true end |
#dynamic_tools? ⇒ Boolean
Check if tools have a dynamic state based on listChanged flag
32 33 34 35 |
# File 'lib/action_mcp/client/server.rb', line 32 def dynamic_tools? tool_cap = @capabilities["tools"] || {} tool_cap["listChanged"] == true end |
#inspect ⇒ Object Also known as: to_s
53 54 55 |
# File 'lib/action_mcp/client/server.rb', line 53 def inspect "#<#{self.class.name} name: #{name}, version: #{version} with resources: #{resources?}, tools: #{tools?}, prompts: #{prompts?}, logging: #{logging?}>" end |
#logging? ⇒ Boolean
Check if logging capability exists
38 39 40 |
# File 'lib/action_mcp/client/server.rb', line 38 def logging? @capabilities.key?("logging") end |
#prompts? ⇒ Boolean
Check if ‘prompts’ capability is present
27 28 29 |
# File 'lib/action_mcp/client/server.rb', line 27 def prompts? @capabilities.key?("prompts") end |
#resources? ⇒ Boolean
Check if resources capability exists
43 44 45 |
# File 'lib/action_mcp/client/server.rb', line 43 def resources? @capabilities.key?("resources") end |
#tools? ⇒ Boolean
Check if ‘tools’ capability is present
22 23 24 |
# File 'lib/action_mcp/client/server.rb', line 22 def tools? @capabilities.key?("tools") end |