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.
-
#icons ⇒ Array<Hash>?
readonly
Optional icons for display in user interfaces (MCP 2025-11-25, SEP-973).
-
#meta ⇒ Hash?
readonly
Optional
_metametadata attached to the resource template (MCP 2025-11-25). -
#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, icons: nil, meta: nil, server: nil) ⇒ ResourceTemplate
constructor
Initialize a new resource template rubocop:disable Metrics/ParameterLists.
Constructor Details
#initialize(uri_template:, name:, title: nil, description: nil, mime_type: nil, annotations: nil, icons: nil, meta: nil, server: nil) ⇒ ResourceTemplate
Initialize a new resource template rubocop:disable Metrics/ParameterLists
38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/mcp_client/resource_template.rb', line 38 def initialize(uri_template:, name:, title: nil, description: nil, mime_type: nil, annotations: nil, icons: nil, meta: nil, server: nil) @uri_template = uri_template @name = name @title = title @description = description @mime_type = mime_type @annotations = annotations @icons = icons @meta = @server = server end |
Instance Attribute Details
#annotations ⇒ Hash? (readonly)
Returns optional annotations that provide hints to clients.
25 |
# File 'lib/mcp_client/resource_template.rb', line 25 attr_reader :uri_template, :name, :title, :description, :mime_type, :annotations, :icons, :meta, :server |
#description ⇒ String? (readonly)
Returns optional description.
25 |
# File 'lib/mcp_client/resource_template.rb', line 25 attr_reader :uri_template, :name, :title, :description, :mime_type, :annotations, :icons, :meta, :server |
#icons ⇒ Array<Hash>? (readonly)
Returns optional icons for display in user interfaces (MCP 2025-11-25, SEP-973).
25 |
# File 'lib/mcp_client/resource_template.rb', line 25 attr_reader :uri_template, :name, :title, :description, :mime_type, :annotations, :icons, :meta, :server |
#meta ⇒ Hash? (readonly)
Returns optional _meta metadata attached to the resource template (MCP 2025-11-25).
25 |
# File 'lib/mcp_client/resource_template.rb', line 25 attr_reader :uri_template, :name, :title, :description, :mime_type, :annotations, :icons, :meta, :server |
#mime_type ⇒ String? (readonly)
Returns optional MIME type for resources created from this template.
25 |
# File 'lib/mcp_client/resource_template.rb', line 25 attr_reader :uri_template, :name, :title, :description, :mime_type, :annotations, :icons, :meta, :server |
#name ⇒ String (readonly)
Returns the name of the resource template.
25 |
# File 'lib/mcp_client/resource_template.rb', line 25 attr_reader :uri_template, :name, :title, :description, :mime_type, :annotations, :icons, :meta, :server |
#server ⇒ Object (readonly)
Returns the value of attribute server.
25 |
# File 'lib/mcp_client/resource_template.rb', line 25 attr_reader :uri_template, :name, :title, :description, :mime_type, :annotations, :icons, :meta, :server |
#title ⇒ String? (readonly)
Returns optional human-readable name for display purposes.
25 |
# File 'lib/mcp_client/resource_template.rb', line 25 attr_reader :uri_template, :name, :title, :description, :mime_type, :annotations, :icons, :meta, :server |
#uri_template ⇒ String (readonly)
Returns URI template following RFC 6570.
25 26 27 |
# File 'lib/mcp_client/resource_template.rb', line 25 def uri_template @uri_template end |
Class Method Details
.from_json(data, server: nil) ⇒ MCPClient::ResourceTemplate
Create a ResourceTemplate instance from JSON data
56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/mcp_client/resource_template.rb', line 56 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'], icons: data['icons'], meta: data['_meta'], server: server ) end |