Class: MCPClient::Prompt
- Inherits:
-
Object
- Object
- MCPClient::Prompt
- 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.
Constructor Details
#initialize(name:, description:, arguments: {}, title: nil, icons: nil, meta: nil, server: nil) ⇒ Prompt
Initialize a new prompt
30 31 32 33 34 35 36 37 38 |
# File 'lib/mcp_client/prompt.rb', line 30 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.
20 |
# File 'lib/mcp_client/prompt.rb', line 20 attr_reader :name, :title, :description, :arguments, :icons, :meta, :server |
#description ⇒ String (readonly)
Returns the description of the prompt.
20 |
# File 'lib/mcp_client/prompt.rb', line 20 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).
20 |
# File 'lib/mcp_client/prompt.rb', line 20 attr_reader :name, :title, :description, :arguments, :icons, :meta, :server |
#meta ⇒ Hash? (readonly)
Returns optional _meta metadata attached to the prompt (MCP 2025-11-25).
20 |
# File 'lib/mcp_client/prompt.rb', line 20 attr_reader :name, :title, :description, :arguments, :icons, :meta, :server |
#name ⇒ String (readonly)
Returns the name of the prompt.
20 21 22 |
# File 'lib/mcp_client/prompt.rb', line 20 def name @name end |
#server ⇒ Object (readonly)
Returns the value of attribute server.
20 |
# File 'lib/mcp_client/prompt.rb', line 20 attr_reader :name, :title, :description, :arguments, :icons, :meta, :server |
#title ⇒ String? (readonly)
Returns optional human-readable name of the prompt for display purposes.
20 |
# File 'lib/mcp_client/prompt.rb', line 20 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
44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/mcp_client/prompt.rb', line 44 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 |