Class: ZeroMcp::Tool
- Inherits:
-
Object
- Object
- ZeroMcp::Tool
- Defined in:
- lib/zeromcp/tool.rb
Instance Attribute Summary collapse
-
#cached_schema ⇒ Object
readonly
Returns the value of attribute cached_schema.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#execute_block ⇒ Object
readonly
Returns the value of attribute execute_block.
-
#input ⇒ Object
readonly
Returns the value of attribute input.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#permissions ⇒ Object
readonly
Returns the value of attribute permissions.
Instance Method Summary collapse
- #call(args, ctx = {}) ⇒ Object
-
#initialize(name:, description: '', input: {}, permissions: {}, &block) ⇒ Tool
constructor
A new instance of Tool.
Constructor Details
#initialize(name:, description: '', input: {}, permissions: {}, &block) ⇒ Tool
Returns a new instance of Tool.
9 10 11 12 13 14 15 16 |
# File 'lib/zeromcp/tool.rb', line 9 def initialize(name:, description: '', input: {}, permissions: {}, &block) @name = name @description = description @input = input @permissions = @execute_block = block @cached_schema = Schema.to_json_schema(@input) end |
Instance Attribute Details
#cached_schema ⇒ Object (readonly)
Returns the value of attribute cached_schema.
7 8 9 |
# File 'lib/zeromcp/tool.rb', line 7 def cached_schema @cached_schema end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
7 8 9 |
# File 'lib/zeromcp/tool.rb', line 7 def description @description end |
#execute_block ⇒ Object (readonly)
Returns the value of attribute execute_block.
7 8 9 |
# File 'lib/zeromcp/tool.rb', line 7 def execute_block @execute_block end |
#input ⇒ Object (readonly)
Returns the value of attribute input.
7 8 9 |
# File 'lib/zeromcp/tool.rb', line 7 def input @input end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'lib/zeromcp/tool.rb', line 7 def name @name end |
#permissions ⇒ Object (readonly)
Returns the value of attribute permissions.
7 8 9 |
# File 'lib/zeromcp/tool.rb', line 7 def @permissions end |
Instance Method Details
#call(args, ctx = {}) ⇒ Object
18 19 20 |
# File 'lib/zeromcp/tool.rb', line 18 def call(args, ctx = {}) @execute_block.call(args, ctx) end |