Description

Open notepad

Opens Notepad on this machine.

Included in Version 5

Dynamically extracted tool implementation.
How to register OpenNotepadToolcsharp
public sealed class OpenNotepadTool : ApplicationOpenTool{    public const string Name = "open_notepad";    public static void Register(ToolRegistry registry) =>        ApplicationOpenTool.Register<OpenNotepadTool>(registry);    public override string ToolName => Name;    protected override string ApplicationName => "Notepad";    protected override string GetExecutable() =>        OperatingSystem.IsWindows() ? "notepad.exe" : "notepad";}
Helper classes for OpenNotepadToolcsharp
using System.Diagnostics;using Agent.Core.ToolCalling;namespace Agent.Addons.Tools.Applications;/// <summary>Base for addon tools that launch a local application.</summary>public abstract class ApplicationOpenTool : IApplicationOpen{    public abstract string ToolName { get; }    protected abstract string ApplicationName { get; }    public virtual string ToolDescription => $"Opens {ApplicationName} on this machine.";    protected abstract string GetExecutable();    protected virtual string? Arguments => null;    public static void Register<TTool>(ToolRegistry registry)        where TTool : ApplicationOpenTool, new()    {        var tool = new TTool();        registry.Register(new AgentTool(            tool.ToolName,            tool.ToolDescription,            _ => tool.Open()));    }    public string Open()    {        string executable = GetExecutable();        if (string.IsNullOrWhiteSpace(executable))        {            return $"Error: Could not resolve executable for {ToolName}.";        }        try        {            var startInfo = new ProcessStartInfo            {                FileName = executable,                Arguments = Arguments ?? "",                UseShellExecute = true,            };            Process.Start(startInfo);            return $"Opened {ApplicationName}.";        }        catch (Exception ex)        {            return $"Failed to open {ApplicationName}: {ex.Message}";        }    }}
Implementation of IApplicationOpencsharp
namespace Agent.Addons.Tools.Applications;/// <summary>Opens a desktop application when invoked as an agent tool.</summary>public interface IApplicationOpen{    string ToolName { get; }    string ToolDescription { get; }    string Open();}