'Update the received metadata_dict with changes that have been applied to the received tool.'

def generate_tool_metadata(self, tool_config, tool, metadata_dict):

    guid = suc.generate_tool_guid(self.repository_clone_url, tool)
    tool_requirements = []
    for tool_requirement in tool.requirements:
        name = str(tool_requirement.name)
        tool_type = str(tool_requirement.type)
        version = (str(tool_requirement.version) if tool_requirement.version else None)
        requirement_dict = dict(name=name, type=tool_type, version=version)
        tool_requirements.append(requirement_dict)
    tool_tests = []
    if tool.tests:
        for ttb in tool.tests:
            required_files = []
            for required_file in ttb.required_files:
                (value, extra) = required_file
                required_files.append(value)
            inputs = []
            for (param_name, values) in ttb.inputs.items():
                if (param_name is not None):
                    if (values in [None, False]):
                        inputs.append((param_name, values))
                    elif isinstance(values, TestCollectionDef):
                        collection_type = values.collection_type
                        metadata_display_value = ('%s    collection' % collection_type)
                        inputs.append((param_name, metadata_display_value))
                    else:
                        try:
                            if (len(values) == 1):
                                inputs.append((param_name, values[0]))
                                continue
                        except TypeError:
                            log.exception('Expected    a    list    of    values    for    tool    "%s"    parameter    "%s",    got    %s:    %s', tool.id, param_name, type(values), values)
                        inputs.append((param_name, values))
            outputs = []
            for output in ttb.outputs:
                (name, file_name, extra) = output
                outputs.append((name, (basic_util.strip_path(file_name) if file_name else None)))
                if ((file_name not in required_files) and (file_name is not None)):
                    required_files.append(file_name)
            test_dict = dict(name=str(ttb.name), required_files=required_files, inputs=inputs, outputs=outputs)
            tool_tests.append(test_dict)
    datatypes = metadata_dict.get('datatypes', None)
    add_to_tool_panel_attribute = self.set_add_to_tool_panel_attribute_for_tool(tool=tool, guid=guid, datatypes=datatypes)
    tool_dict = dict(id=tool.id, guid=guid, name=tool.name, version=tool.version, profile=tool.profile, description=tool.description, version_string_cmd=tool.version_string_cmd, tool_config=tool_config, tool_type=tool.tool_type, requirements=tool_requirements, tests=tool_tests, add_to_tool_panel=add_to_tool_panel_attribute)
    if ('tools' in metadata_dict):
        metadata_dict['tools'].append(tool_dict)
    else:
        metadata_dict['tools'] = [tool_dict]
    return metadata_dict
