How to register BuiltInToolscsharp
registry.Register(new AgentTool( "store_memory", "Stores a persistent user fact in hierarchical vector memory (NOT workspace files). Use for preferences, name, job, pets, etc. Paths like user/name or user/preferences/color.", args => { if (registry.Memory is null) return "Error: Memory system is not initialized."; try { using var doc = JsonDocument.Parse(args); var root = doc.RootElement; if (!root.TryGetProperty("path", out var pathProp) || !root.TryGetProperty("content", out var contentProp)) { return "Error: Missing path or content properties."; } string path = pathProp.GetString() ?? ""; string content = contentProp.GetString() ?? ""; if (string.IsNullOrWhiteSpace(path)) return "Error: Path cannot be empty."; registry.Memory.StoreAsync(path, content).GetAwaiter().GetResult(); return $"Success: Stored memory under path '{path}'."; } catch (Exception ex) { return $"Error: {ex.Message}"; } }, new { type = "object", properties = new { path = new { type = "string", description = "The hierarchical path, e.g., 'user/name' or 'user/preferences/color'." }, content = new { type = "string", description = "The fact or information to store." } }, required = new[] { "path", "content" } } ));