Class: MCPClient::ResourceLink
- Inherits:
-
Object
- Object
- MCPClient::ResourceLink
- Defined in:
- lib/mcp_client/resource_link.rb
Overview
Representation of an MCP resource link in tool result content A resource link references a server resource that can be read separately. Used in tool results to point clients to available resources (MCP 2025-11-25).
Instance Attribute Summary collapse
-
#annotations ⇒ Hash?
readonly
Optional annotations that provide hints to clients.
-
#description ⇒ String?
readonly
Optional human-readable description.
-
#icons ⇒ Array<Hash>?
readonly
Optional icons for display in user interfaces (MCP 2025-11-25, SEP-973).
-
#meta ⇒ Object
readonly
Returns the value of attribute meta.
-
#mime_type ⇒ String?
readonly
Optional MIME type of the resource.
-
#name ⇒ String
readonly
The name of the linked resource.
-
#size ⇒ Integer?
readonly
Optional size of the resource in bytes.
-
#title ⇒ String?
readonly
Optional display title for the resource.
-
#uri ⇒ String
readonly
URI of the linked resource.
Class Method Summary collapse
-
.from_json(data) ⇒ MCPClient::ResourceLink
Create a ResourceLink instance from JSON data.
Instance Method Summary collapse
-
#initialize(uri:, name:, description: nil, mime_type: nil, annotations: nil, title: nil, size: nil, icons: nil, meta: nil) ⇒ ResourceLink
constructor
Initialize a resource link rubocop:disable Metrics/ParameterLists.
-
#type ⇒ String
The content type identifier for this content type.
Constructor Details
#initialize(uri:, name:, description: nil, mime_type: nil, annotations: nil, title: nil, size: nil, icons: nil, meta: nil) ⇒ ResourceLink
Initialize a resource link rubocop:disable Metrics/ParameterLists
39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/mcp_client/resource_link.rb', line 39 def initialize(uri:, name:, description: nil, mime_type: nil, annotations: nil, title: nil, size: nil, icons: nil, meta: nil) @uri = uri @name = name @description = description @mime_type = mime_type @annotations = annotations @title = title @size = size @icons = icons @meta = end |
Instance Attribute Details
#annotations ⇒ Hash? (readonly)
Returns optional annotations that provide hints to clients.
26 |
# File 'lib/mcp_client/resource_link.rb', line 26 attr_reader :uri, :name, :description, :mime_type, :annotations, :title, :size, :icons, :meta |
#description ⇒ String? (readonly)
Returns optional human-readable description.
26 |
# File 'lib/mcp_client/resource_link.rb', line 26 attr_reader :uri, :name, :description, :mime_type, :annotations, :title, :size, :icons, :meta |
#icons ⇒ Array<Hash>? (readonly)
Returns optional icons for display in user interfaces (MCP 2025-11-25, SEP-973).
26 |
# File 'lib/mcp_client/resource_link.rb', line 26 attr_reader :uri, :name, :description, :mime_type, :annotations, :title, :size, :icons, :meta |
#meta ⇒ Object (readonly)
Returns the value of attribute meta.
26 |
# File 'lib/mcp_client/resource_link.rb', line 26 attr_reader :uri, :name, :description, :mime_type, :annotations, :title, :size, :icons, :meta |
#mime_type ⇒ String? (readonly)
Returns optional MIME type of the resource.
26 |
# File 'lib/mcp_client/resource_link.rb', line 26 attr_reader :uri, :name, :description, :mime_type, :annotations, :title, :size, :icons, :meta |
#name ⇒ String (readonly)
Returns the name of the linked resource.
26 |
# File 'lib/mcp_client/resource_link.rb', line 26 attr_reader :uri, :name, :description, :mime_type, :annotations, :title, :size, :icons, :meta |
#size ⇒ Integer? (readonly)
Returns optional size of the resource in bytes.
26 |
# File 'lib/mcp_client/resource_link.rb', line 26 attr_reader :uri, :name, :description, :mime_type, :annotations, :title, :size, :icons, :meta |
#title ⇒ String? (readonly)
Returns optional display title for the resource.
26 |
# File 'lib/mcp_client/resource_link.rb', line 26 attr_reader :uri, :name, :description, :mime_type, :annotations, :title, :size, :icons, :meta |
#uri ⇒ String (readonly)
Returns URI of the linked resource.
26 27 28 |
# File 'lib/mcp_client/resource_link.rb', line 26 def uri @uri end |
Class Method Details
.from_json(data) ⇒ MCPClient::ResourceLink
Create a ResourceLink instance from JSON data
56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/mcp_client/resource_link.rb', line 56 def self.from_json(data) new( uri: data['uri'], name: data['name'], description: data['description'], mime_type: data['mimeType'], annotations: data['annotations'], title: data['title'], size: data['size'], icons: data['icons'], meta: data['_meta'] ) end |
Instance Method Details
#type ⇒ String
The content type identifier for this content type
72 73 74 |
# File 'lib/mcp_client/resource_link.rb', line 72 def type 'resource_link' end |