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.
-
#mime_type ⇒ String?
readonly
Optional MIME type of the resource.
-
#name ⇒ String
readonly
The name of the linked resource.
-
#size ⇒ Object
readonly
Returns the value of attribute size.
-
#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) ⇒ ResourceLink
constructor
Initialize a resource link.
-
#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) ⇒ ResourceLink
Initialize a resource link
32 33 34 35 36 37 38 39 40 |
# File 'lib/mcp_client/resource_link.rb', line 32 def initialize(uri:, name:, description: nil, mime_type: nil, annotations: nil, title: nil, size: nil) @uri = uri @name = name @description = description @mime_type = mime_type @annotations = annotations @title = title @size = size end |
Instance Attribute Details
#annotations ⇒ Hash? (readonly)
Returns optional annotations that provide hints to clients.
22 |
# File 'lib/mcp_client/resource_link.rb', line 22 attr_reader :uri, :name, :description, :mime_type, :annotations, :title, :size |
#description ⇒ String? (readonly)
Returns optional human-readable description.
22 |
# File 'lib/mcp_client/resource_link.rb', line 22 attr_reader :uri, :name, :description, :mime_type, :annotations, :title, :size |
#mime_type ⇒ String? (readonly)
Returns optional MIME type of the resource.
22 |
# File 'lib/mcp_client/resource_link.rb', line 22 attr_reader :uri, :name, :description, :mime_type, :annotations, :title, :size |
#name ⇒ String (readonly)
Returns the name of the linked resource.
22 |
# File 'lib/mcp_client/resource_link.rb', line 22 attr_reader :uri, :name, :description, :mime_type, :annotations, :title, :size |
#size ⇒ Object (readonly)
Returns the value of attribute size.
22 |
# File 'lib/mcp_client/resource_link.rb', line 22 attr_reader :uri, :name, :description, :mime_type, :annotations, :title, :size |
#title ⇒ String? (readonly)
Returns optional display title for the resource.
22 |
# File 'lib/mcp_client/resource_link.rb', line 22 attr_reader :uri, :name, :description, :mime_type, :annotations, :title, :size |
#uri ⇒ String (readonly)
Returns URI of the linked resource.
22 23 24 |
# File 'lib/mcp_client/resource_link.rb', line 22 def uri @uri end |
Class Method Details
.from_json(data) ⇒ MCPClient::ResourceLink
Create a ResourceLink instance from JSON data
45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/mcp_client/resource_link.rb', line 45 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'] ) end |
Instance Method Details
#type ⇒ String
The content type identifier for this content type
59 60 61 |
# File 'lib/mcp_client/resource_link.rb', line 59 def type 'resource_link' end |