def addTool(self):

    # Get the name of the tool to add and check that it is valid.
    for counter, value in enumerate(sys.argv):
      if value == 'add-tool':
        try: tool = sys.argv[counter + 1]
        except: self.error.noToolNameProvided(conf.tools)
        break

    # Check that the tool exists.
    isValid = False
    for toolObject in conf.tools:
      if tool == toolObject.name:
        isValid = True
        break

    if not isValid: self.error.invalidToolAdded(conf.tools)

    # Check if this tool is already included in the users version of gkno.
    if tool in self.userSettings['compiled tools']: self.error.toolAlreadyBuilt()

    # Build the tool.
    # Cache our starting working directory since we're going to move around
    originalWorkingDir = os.getcwd()

    print('Building tool: ' + tool + '...', end = '', file=sys.stdout)
    sys.stdout.flush()
    if self.buildTool(toolObject):
      print('done.', file=sys.stdout)
      self.builtTools[tool] = True
      self.userSettings['compiled tools'].append(tool)
    else:
      self.error.toolBuildFailed(tool, dest = sys.stdout)
      self.builtTools[tool] = False
      self.allBuilt         = False
    os.chdir(originalWorkingDir)

    # For valid tools that are not included in the current version of gkno, update the user_settings.json
    # to include the tool, then build the tool.
    self.exportUserSettings()

    # Return success.
    return True

  # "gkno add-resource [organism] [options]"
  #
  # Depending on input parameters, either lists available resources/releases or 
  # fetches the requested resource/release.
dataset/ETHPy150Open gkno/gkno_launcher/src/gkno/adminUtils.py/adminUtils.addTool/original