Class: Ask::MCP::Tool
- Inherits:
-
Object
- Object
- Ask::MCP::Tool
- Defined in:
- lib/ask/mcp/tool.rb
Instance Attribute Summary collapse
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#input_schema ⇒ Object
readonly
Returns the value of attribute input_schema.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name:, description: "", input_schema: {}) ⇒ Tool
constructor
A new instance of Tool.
- #to_ask_tool ⇒ Object
- #to_h ⇒ Object
Constructor Details
#initialize(name:, description: "", input_schema: {}) ⇒ Tool
Returns a new instance of Tool.
8 9 10 11 12 |
# File 'lib/ask/mcp/tool.rb', line 8 def initialize(name:, description: "", input_schema: {}) @name = name @description = description @input_schema = input_schema end |
Instance Attribute Details
#description ⇒ Object (readonly)
Returns the value of attribute description.
6 7 8 |
# File 'lib/ask/mcp/tool.rb', line 6 def description @description end |
#input_schema ⇒ Object (readonly)
Returns the value of attribute input_schema.
6 7 8 |
# File 'lib/ask/mcp/tool.rb', line 6 def input_schema @input_schema end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/ask/mcp/tool.rb', line 6 def name @name end |
Class Method Details
.from_h(hash) ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/ask/mcp/tool.rb', line 32 def self.from_h(hash) new( name: hash[:name] || hash["name"], description: hash[:description] || hash["description"] || "", input_schema: hash[:inputSchema] || hash["input_schema"] || hash[:input_schema] || hash["inputSchema"] || {} ) end |
Instance Method Details
#to_ask_tool ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/ask/mcp/tool.rb', line 14 def to_ask_tool require "ask/tools/tool" Ask::Tools::Tool.new( name: @name, description: @description, parameters: @input_schema ) end |
#to_h ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/ask/mcp/tool.rb', line 24 def to_h { name: @name, description: @description, inputSchema: @input_schema } end |