Class: Mewmew::ThorIntrospector
- Inherits:
-
Object
- Object
- Mewmew::ThorIntrospector
- Defined in:
- lib/mewmew/thor_introspector.rb
Overview
Introspects Thor CLI classes and extracts command information
Instance Attribute Summary collapse
-
#thor_class ⇒ Object
readonly
Returns the value of attribute thor_class.
Instance Method Summary collapse
-
#commands ⇒ Object
Get all commands from the Thor class.
-
#initialize(thor_class) ⇒ ThorIntrospector
constructor
A new instance of ThorIntrospector.
-
#to_mcp_tools ⇒ Object
Convert Thor commands to MCP tools.
Constructor Details
#initialize(thor_class) ⇒ ThorIntrospector
Returns a new instance of ThorIntrospector.
16 17 18 19 |
# File 'lib/mewmew/thor_introspector.rb', line 16 def initialize(thor_class) @thor_class = thor_class validate_thor_class! end |
Instance Attribute Details
#thor_class ⇒ Object (readonly)
Returns the value of attribute thor_class.
14 15 16 |
# File 'lib/mewmew/thor_introspector.rb', line 14 def thor_class @thor_class end |
Instance Method Details
#commands ⇒ Object
Get all commands from the Thor class
22 23 24 |
# File 'lib/mewmew/thor_introspector.rb', line 22 def commands @commands ||= thor_class.commands.except("help", "mcp") end |
#to_mcp_tools ⇒ Object
Convert Thor commands to MCP tools
27 28 29 30 31 |
# File 'lib/mewmew/thor_introspector.rb', line 27 def to_mcp_tools commands.map do |name, command| create_tool_class(name, command, thor_class) end end |