Class: ActionMCP::Capability
- Inherits:
-
Object
- Object
- ActionMCP::Capability
- Includes:
- Callbacks, Instrumentation::Instrumentation, Renderable, ActiveModel::Attributes, ActiveModel::Model
- Defined in:
- lib/action_mcp/capability.rb
Class Attribute Summary collapse
Instance Attribute Summary collapse
-
#execution_context ⇒ Object
readonly
Returns the value of attribute execution_context.
Class Method Summary collapse
-
.abstract! ⇒ void
Marks this tool as abstract so that it won’t be available for use.
-
.abstract? ⇒ Boolean
Returns whether this tool is abstract.
-
.capability_name ⇒ Object
use _capability_name or default_capability_name.
- .description(text = nil) ⇒ Object
Instance Method Summary collapse
-
#initialize ⇒ Capability
constructor
A new instance of Capability.
- #session ⇒ Object
- #with_context(context) ⇒ Object
Methods included from Renderable
#render, #render_resource_link
Constructor Details
#initialize ⇒ Capability
Returns a new instance of Capability.
19 20 21 22 |
# File 'lib/action_mcp/capability.rb', line 19 def initialize(*) super @execution_context = {} end |
Class Attribute Details
.abstract_capability ⇒ Object
38 39 40 |
# File 'lib/action_mcp/capability.rb', line 38 def self.abstract_capability @abstract_capability ||= false # Default to false, unique to each class end |
Instance Attribute Details
#execution_context ⇒ Object (readonly)
Returns the value of attribute execution_context.
17 18 19 |
# File 'lib/action_mcp/capability.rb', line 17 def execution_context @execution_context end |
Class Method Details
.abstract! ⇒ void
This method returns an undefined value.
Marks this tool as abstract so that it won’t be available for use. If the tool is registered in ToolsRegistry, it is unregistered.
50 51 52 53 54 |
# File 'lib/action_mcp/capability.rb', line 50 def self.abstract! self.abstract_capability = true # Unregister from the appropriate registry if already registered unregister_from_registry end |
.abstract? ⇒ Boolean
Returns whether this tool is abstract.
59 60 61 |
# File 'lib/action_mcp/capability.rb', line 59 def self.abstract? abstract_capability end |
.capability_name ⇒ Object
use _capability_name or default_capability_name
34 35 36 |
# File 'lib/action_mcp/capability.rb', line 34 def self.capability_name _capability_name || default_capability_name end |
.description(text = nil) ⇒ Object
63 64 65 66 67 68 69 |
# File 'lib/action_mcp/capability.rb', line 63 def self.description(text = nil) if text self._description = text else _description end end |
Instance Method Details
#session ⇒ Object
29 30 31 |
# File 'lib/action_mcp/capability.rb', line 29 def session execution_context[:session] end |
#with_context(context) ⇒ Object
24 25 26 27 |
# File 'lib/action_mcp/capability.rb', line 24 def with_context(context) @execution_context = context self end |