Class: ActionMCP::Content::ResourceLink
- Defined in:
- lib/action_mcp/content/resource_link.rb
Overview
ResourceLink represents a link to a resource that the server is capable of reading. It’s included in a prompt or tool call result. Note: resource links returned by tools are not guaranteed to appear in resources/list requests.
Instance Attribute Summary collapse
- #description ⇒ String? readonly
- #mime_type ⇒ String? readonly
- #name ⇒ String? readonly
- #uri ⇒ String? readonly
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(uri, name: nil, description: nil, mime_type: nil, annotations: nil) ⇒ ResourceLink
constructor
Initializes a new ResourceLink content.
-
#to_h ⇒ Hash
Returns a hash representation of the resource link content.
Methods inherited from Base
Constructor Details
#initialize(uri, name: nil, description: nil, mime_type: nil, annotations: nil) ⇒ ResourceLink
Initializes a new ResourceLink content.
22 23 24 25 26 27 28 |
# File 'lib/action_mcp/content/resource_link.rb', line 22 def initialize(uri, name: nil, description: nil, mime_type: nil, annotations: nil) super("resource_link", annotations: annotations) @uri = uri @name = name @description = description @mime_type = mime_type end |
Instance Attribute Details
#description ⇒ String? (readonly)
13 14 15 |
# File 'lib/action_mcp/content/resource_link.rb', line 13 def description @description end |
#mime_type ⇒ String? (readonly)
13 14 15 |
# File 'lib/action_mcp/content/resource_link.rb', line 13 def mime_type @mime_type end |
#name ⇒ String? (readonly)
13 14 15 |
# File 'lib/action_mcp/content/resource_link.rb', line 13 def name @name end |
#uri ⇒ String? (readonly)
13 14 15 |
# File 'lib/action_mcp/content/resource_link.rb', line 13 def uri @uri end |
Instance Method Details
#to_h ⇒ Hash
Returns a hash representation of the resource link content.
33 34 35 36 37 38 39 |
# File 'lib/action_mcp/content/resource_link.rb', line 33 def to_h result = super.merge(uri: @uri) result[:name] = @name if @name result[:description] = @description if @description result[:mimeType] = @mime_type if @mime_type result end |