Description

List workspace files

Lists all files and subdirectories located inside both the config and output workspace folders.

Included in Version 9

Dynamically extracted tool implementation.
How to register WorkspaceToolscsharp
registry.Register(new AgentTool(            "list_workspace_files",            "Lists all files and subdirectories located inside both the config and output workspace folders.",            _ => ListWorkspaceFiles(),            null,            ToolCategory.Self        ));
Helper classes for WorkspaceToolscsharp
    private string ListWorkspaceFiles()    {        if (Workspace is null)            return "Error: Workspace is not initialized.";        var sb = new System.Text.StringBuilder();        sb.AppendLine("Workspace Files & Directories:");        sb.AppendLine();        sb.AppendLine("1. Setup & Configuration Folder (Config):");        if (Directory.Exists(Workspace.ConfigFolder))        {            var files = Directory.GetFiles(Workspace.ConfigFolder, "*", SearchOption.AllDirectories);            if (files.Length == 0)            {                sb.AppendLine("   (Empty)");            }            foreach (var file in files)            {                var rel = Path.GetRelativePath(Workspace.ConfigFolder, file).Replace('\\', '/');                var size = new FileInfo(file).Length;                sb.AppendLine($"   - {rel} ({FormatSize(size)})");            }        }        else        {            sb.AppendLine("   (Directory does not exist)");        }        sb.AppendLine();        sb.AppendLine("2. Output & Creative Sandbox Folder (Output):");        if (Directory.Exists(Workspace.OutputFolder))        {            var files = Directory.GetFiles(Workspace.OutputFolder, "*", SearchOption.AllDirectories);            if (files.Length == 0)            {                sb.AppendLine("   (Empty)");            }            foreach (var file in files)            {                var rel = Path.GetRelativePath(Workspace.OutputFolder, file).Replace('\\', '/');                var size = new FileInfo(file).Length;                sb.AppendLine($"   - {rel} ({FormatSize(size)})");            }        }        else        {            sb.AppendLine("   (Directory does not exist)");        }        return sb.ToString();    }