'GET /api/tools/{tool_id}/diagnostics
Return diagnostic information to help debug panel
and dependency related problems.'

@expose_api
@web.require_admin
def diagnostics(self, trans, id, **kwd):

    def to_dict(x):
        return x.to_dict()
    tool = self._get_tool(id, user=trans.user)
    if hasattr(tool, 'lineage'):
        lineage_dict = tool.lineage.to_dict()
    else:
        lineage_dict = None
    tool_shed_dependencies = tool.installed_tool_dependencies
    if tool_shed_dependencies:
        tool_shed_dependencies_dict = map(to_dict, tool_shed_dependencies)
    else:
        tool_shed_dependencies_dict = None
    return {'tool_id': tool.id, 'tool_version': tool.version, 'dependency_shell_commands': tool.build_dependency_shell_commands(), 'lineage': lineage_dict, 'requirements': map(to_dict, tool.requirements), 'installed_tool_shed_dependencies': tool_shed_dependencies_dict, 'tool_dir': tool.tool_dir, 'tool_shed': tool.tool_shed, 'repository_name': tool.repository_name, 'repository_owner': tool.repository_owner, 'installed_changeset_revision': None, 'guid': tool.guid}
