Class: MCPClient::Prompt
- Inherits:
-
Object
- Object
- MCPClient::Prompt
- Includes:
- DeepCopy
- Defined in:
- lib/mcp_client/prompt.rb
Overview
Representation of an MCP prompt
Instance Attribute Summary collapse
-
#arguments ⇒ Hash
readonly
The JSON arguments for the prompt.
-
#description ⇒ String
readonly
The description of the prompt.
-
#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 prompt (MCP 2025-11-25). -
#name ⇒ String
readonly
The name of the prompt.
-
#server ⇒ Object
readonly
Returns the value of attribute server.
-
#title ⇒ String?
readonly
Optional human-readable name of the prompt for display purposes.
Class Method Summary collapse
-
.from_json(data, server: nil) ⇒ MCPClient::Prompt
Create a Prompt instance from JSON data.
Instance Method Summary collapse
-
#initialize(name:, description:, arguments: {}, title: nil, icons: nil, meta: nil, server: nil) ⇒ Prompt
constructor
Initialize a new prompt.
Methods included from DeepCopy
copy, #initialize_copy, shallow_copy
Constructor Details
#initialize(name:, description:, arguments: {}, title: nil, icons: nil, meta: nil, server: nil) ⇒ Prompt
Initialize a new prompt
34 35 36 37 38 39 40 41 42 |
# File 'lib/mcp_client/prompt.rb', line 34 def initialize(name:, description:, arguments: {}, title: nil, icons: nil, meta: nil, server: nil) @name = name @title = title @description = description @arguments = arguments @icons = icons @meta = @server = server end |
Instance Attribute Details
#arguments ⇒ Hash (readonly)
Returns the JSON arguments for the prompt.
24 |
# File 'lib/mcp_client/prompt.rb', line 24 attr_reader :name, :title, :description, :arguments, :icons, :meta, :server |
#description ⇒ String (readonly)
Returns the description of the prompt.
24 |
# File 'lib/mcp_client/prompt.rb', line 24 attr_reader :name, :title, :description, :arguments, :icons, :meta, :server |
#icons ⇒ Array<Hash>? (readonly)
Returns optional icons for display in user interfaces (MCP 2025-11-25, SEP-973).
24 |
# File 'lib/mcp_client/prompt.rb', line 24 attr_reader :name, :title, :description, :arguments, :icons, :meta, :server |
#meta ⇒ Hash? (readonly)
Returns optional _meta metadata attached to the prompt (MCP 2025-11-25).
24 |
# File 'lib/mcp_client/prompt.rb', line 24 attr_reader :name, :title, :description, :arguments, :icons, :meta, :server |
#name ⇒ String (readonly)
Returns the name of the prompt.
24 25 26 |
# File 'lib/mcp_client/prompt.rb', line 24 def name @name end |
#server ⇒ Object (readonly)
Returns the value of attribute server.
24 |
# File 'lib/mcp_client/prompt.rb', line 24 attr_reader :name, :title, :description, :arguments, :icons, :meta, :server |
#title ⇒ String? (readonly)
Returns optional human-readable name of the prompt for display purposes.
24 |
# File 'lib/mcp_client/prompt.rb', line 24 attr_reader :name, :title, :description, :arguments, :icons, :meta, :server |
Class Method Details
.from_json(data, server: nil) ⇒ MCPClient::Prompt
Create a Prompt instance from JSON data
48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/mcp_client/prompt.rb', line 48 def self.from_json(data, server: nil) new( name: data['name'], title: data['title'], description: data['description'], arguments: data['arguments'] || {}, icons: data['icons'], meta: data['_meta'], server: server ) end |