Class: MCPClient::ResourceTemplate
- Inherits:
-
Object
- Object
- MCPClient::ResourceTemplate
- Defined in:
- lib/mcp_client/resource_template.rb
Overview
Representation of an MCP resource template Resource templates allow servers to expose parameterized resources using URI templates
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 for resources created from this template.
-
#name ⇒ String
readonly
The name of the resource template.
-
#server ⇒ Object
readonly
Returns the value of attribute server.
-
#title ⇒ String?
readonly
Optional human-readable name for display purposes.
-
#uri_template ⇒ String
readonly
URI template following RFC 6570.
Class Method Summary collapse
-
.from_json(data, server: nil) ⇒ MCPClient::ResourceTemplate
Create a ResourceTemplate instance from JSON data.
Instance Method Summary collapse
-
#initialize(uri_template:, name:, title: nil, description: nil, mime_type: nil, annotations: nil, server: nil) ⇒ ResourceTemplate
constructor
Initialize a new resource template.
Constructor Details
#initialize(uri_template:, name:, title: nil, description: nil, mime_type: nil, annotations: nil, server: nil) ⇒ ResourceTemplate
Initialize a new resource template
31 32 33 34 35 36 37 38 39 |
# File 'lib/mcp_client/resource_template.rb', line 31 def initialize(uri_template:, name:, title: nil, description: nil, mime_type: nil, annotations: nil, server: nil) @uri_template = uri_template @name = name @title = title @description = description @mime_type = mime_type @annotations = annotations @server = server end |
Instance Attribute Details
#annotations ⇒ Hash? (readonly)
Returns optional annotations that provide hints to clients.
21 |
# File 'lib/mcp_client/resource_template.rb', line 21 attr_reader :uri_template, :name, :title, :description, :mime_type, :annotations, :server |
#description ⇒ String? (readonly)
Returns optional description.
21 |
# File 'lib/mcp_client/resource_template.rb', line 21 attr_reader :uri_template, :name, :title, :description, :mime_type, :annotations, :server |
#mime_type ⇒ String? (readonly)
Returns optional MIME type for resources created from this template.
21 |
# File 'lib/mcp_client/resource_template.rb', line 21 attr_reader :uri_template, :name, :title, :description, :mime_type, :annotations, :server |
#name ⇒ String (readonly)
Returns the name of the resource template.
21 |
# File 'lib/mcp_client/resource_template.rb', line 21 attr_reader :uri_template, :name, :title, :description, :mime_type, :annotations, :server |
#server ⇒ Object (readonly)
Returns the value of attribute server.
21 |
# File 'lib/mcp_client/resource_template.rb', line 21 attr_reader :uri_template, :name, :title, :description, :mime_type, :annotations, :server |
#title ⇒ String? (readonly)
Returns optional human-readable name for display purposes.
21 |
# File 'lib/mcp_client/resource_template.rb', line 21 attr_reader :uri_template, :name, :title, :description, :mime_type, :annotations, :server |
#uri_template ⇒ String (readonly)
Returns URI template following RFC 6570.
21 22 23 |
# File 'lib/mcp_client/resource_template.rb', line 21 def uri_template @uri_template end |
Class Method Details
.from_json(data, server: nil) ⇒ MCPClient::ResourceTemplate
Create a ResourceTemplate instance from JSON data
45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/mcp_client/resource_template.rb', line 45 def self.from_json(data, server: nil) new( uri_template: data['uriTemplate'], name: data['name'], title: data['title'], description: data['description'], mime_type: data['mimeType'], annotations: data['annotations'], server: server ) end |