Class: MCPClient::Resource
- Inherits:
-
Object
- Object
- MCPClient::Resource
- Defined in:
- lib/mcp_client/resource.rb
Overview
Representation of an MCP resource
Instance Attribute Summary collapse
-
#annotations ⇒ Hash?
readonly
Optional annotations that provide hints to clients.
-
#description ⇒ String?
readonly
Optional description.
-
#mime_type ⇒ String?
readonly
Optional MIME type.
-
#name ⇒ String
readonly
The name of the resource.
-
#server ⇒ Object
readonly
Returns the value of attribute server.
-
#size ⇒ Integer?
readonly
Optional size in bytes.
-
#title ⇒ String?
readonly
Optional human-readable name of the resource for display purposes.
-
#uri ⇒ String
readonly
Unique identifier for the resource.
Class Method Summary collapse
-
.from_json(data, server: nil) ⇒ MCPClient::Resource
Create a Resource instance from JSON data.
Instance Method Summary collapse
-
#initialize(uri:, name:, title: nil, description: nil, mime_type: nil, size: nil, annotations: nil, server: nil) ⇒ Resource
constructor
Initialize a new resource.
Constructor Details
#initialize(uri:, name:, title: nil, description: nil, mime_type: nil, size: nil, annotations: nil, server: nil) ⇒ Resource
Initialize a new resource
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/mcp_client/resource.rb', line 33 def initialize(uri:, name:, title: nil, description: nil, mime_type: nil, size: nil, annotations: nil, server: nil) @uri = uri @name = name @title = title @description = description @mime_type = mime_type @size = size @annotations = annotations @server = server end |
Instance Attribute Details
#annotations ⇒ Hash? (readonly)
22 |
# File 'lib/mcp_client/resource.rb', line 22 attr_reader :uri, :name, :title, :description, :mime_type, :size, :annotations, :server |
#description ⇒ String? (readonly)
22 |
# File 'lib/mcp_client/resource.rb', line 22 attr_reader :uri, :name, :title, :description, :mime_type, :size, :annotations, :server |
#mime_type ⇒ String? (readonly)
22 |
# File 'lib/mcp_client/resource.rb', line 22 attr_reader :uri, :name, :title, :description, :mime_type, :size, :annotations, :server |
#name ⇒ String (readonly)
22 |
# File 'lib/mcp_client/resource.rb', line 22 attr_reader :uri, :name, :title, :description, :mime_type, :size, :annotations, :server |
#server ⇒ Object (readonly)
Returns the value of attribute server.
22 |
# File 'lib/mcp_client/resource.rb', line 22 attr_reader :uri, :name, :title, :description, :mime_type, :size, :annotations, :server |
#size ⇒ Integer? (readonly)
22 |
# File 'lib/mcp_client/resource.rb', line 22 attr_reader :uri, :name, :title, :description, :mime_type, :size, :annotations, :server |
#title ⇒ String? (readonly)
22 |
# File 'lib/mcp_client/resource.rb', line 22 attr_reader :uri, :name, :title, :description, :mime_type, :size, :annotations, :server |
#uri ⇒ String (readonly)
22 23 24 |
# File 'lib/mcp_client/resource.rb', line 22 def uri @uri end |
Class Method Details
.from_json(data, server: nil) ⇒ MCPClient::Resource
Create a Resource instance from JSON data
48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/mcp_client/resource.rb', line 48 def self.from_json(data, server: nil) new( uri: data['uri'], name: data['name'], title: data['title'], description: data['description'], mime_type: data['mimeType'], size: data['size'], annotations: data['annotations'], server: server ) end |