Module: ActionMCP::Server::RegistryManagement
- Defined in:
- lib/action_mcp/server/registry_management.rb
Instance Method Summary collapse
- #send_registry_add_tool(request_id, tool_name) ⇒ Object
- #send_registry_remove_tool(request_id, tool_name) ⇒ Object
Instance Method Details
#send_registry_add_tool(request_id, tool_name) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/action_mcp/server/registry_management.rb', line 6 def send_registry_add_tool(request_id, tool_name) tool_class = ActionMCP::ToolsRegistry.find(tool_name) if tool_class session.register_tool(tool_class) send_jsonrpc_response(request_id, result: { success: true }) else send_jsonrpc_error(request_id, :invalid_params, "Tool '#{tool_name}' not found") end rescue ActionMCP::RegistryBase::NotFound send_jsonrpc_error(request_id, :invalid_params, "Tool '#{tool_name}' not found") end |
#send_registry_remove_tool(request_id, tool_name) ⇒ Object
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/action_mcp/server/registry_management.rb', line 19 def send_registry_remove_tool(request_id, tool_name) tool_class = session.available_tools.find { |t| t.tool_name == tool_name } if tool_class session.unregister_tool(tool_class) send_jsonrpc_response(request_id, result: { success: true }) else send_jsonrpc_error(request_id, :invalid_params, "Tool '#{tool_name}' not in session") end end |