Class: API::Mcp::Handlers::ListTools
- Inherits:
-
Object
- Object
- API::Mcp::Handlers::ListTools
- Defined in:
- lib/api/mcp/handlers/list_tools.rb
Overview
Instance Method Summary collapse
-
#initialize(manager) ⇒ ListTools
constructor
A new instance of ListTools.
- #invoke(current_user) ⇒ Object
Constructor Details
#initialize(manager) ⇒ ListTools
Returns a new instance of ListTools.
8 9 10 |
# File 'lib/api/mcp/handlers/list_tools.rb', line 8 def initialize(manager) @manager = manager end |
Instance Method Details
#invoke(current_user) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/api/mcp/handlers/list_tools.rb', line 12 def invoke(current_user) tools_hash = manager.list_tools tools = tools_hash.filter_map do |name, tool| next nil unless tool_available?(tool, current_user) { name: name, description: tool.description, inputSchema: tool.input_schema } end { tools: tools } end |