Skip to content

CommonTools

Rasmus Wulff Jensen edited this page Jan 27, 2026 · 1 revision

Common Tools

Agent Framework Toolkit includes a provider-independent set of commonly useful tools in the AgentFrameworkToolkit.Tools.Common namespace.

Note

These tools are regular AITool instances and can be used with both Agent Framework Toolkit agents and plain AIAgent instances from Microsoft Agent Framework.

Package

dotnet add package AgentFrameworkToolkit.Tools

Quick start

using AgentFrameworkToolkit.OpenAI;
using AgentFrameworkToolkit.Tools;
using AgentFrameworkToolkit.Tools.Common;

OpenAIAgentFactory agentFactory = new("<apiKey>");
AIToolsFactory toolsFactory = new();

OpenAIAgent agent = agentFactory.CreateAgent(new AgentOptions
{
    Model = "gpt-5",
    Instructions = "Use tools when helpful.",
    Tools =
    [
        ..toolsFactory.GetTimeTools(),
        ..toolsFactory.GetWebsiteTools(),
        ..toolsFactory.GetHttpClientTools()
    ]
});

FileSystemTools

File system tools include both read and write operations. If you enable them, you should typically confine them to specific folders.

Tool names

  • Read: get_content_of_file, get_files, get_folders, file_exists, folder_exists
  • Write: create_file, create_folder, move_file, delete_file, delete_folder, copy_file, copy_folder

Confining file system access

If you set FileSystemToolsOptions.ConfinedToTheseFolderPaths, every operation will be validated to ensure it stays within one of those folder paths (including subfolders). If you do not set it, no confinement is applied.

using AgentFrameworkToolkit.Tools;
using AgentFrameworkToolkit.Tools.Common;

AIToolsFactory toolsFactory = new();

IList<AITool> tools = toolsFactory.GetFileSystemTools(new GetFileSystemToolsOptions
{
    FileSystemToolsOptions = new FileSystemToolsOptions
    {
        ConfinedToTheseFolderPaths = ["C:\\data\\agent-workdir"]
    }
});

HttpClientTools

HTTP tools provide simple GET/POST/PUT/PATCH/DELETE/HEAD helpers that return a formatted response string.

Tool names

http_get, http_post, http_put, http_patch, http_delete, http_head

Options

  • HttpClientToolsOptions.IncludeHeaders (default: false)
  • HttpClientToolsOptions.ThrowOnError (default: false)
  • HttpClientToolsOptions.HttpClientFactory (optional)
AIToolsFactory toolsFactory = new();
IList<AITool> tools = toolsFactory.GetHttpClientTools(new GetHttpClientToolsOptions
{
    HttpClientToolsOptions = new HttpClientToolsOptions { IncludeHeaders = true }
});

TimeTools

Time tools provide current time in UTC and local time. Local time can optionally accept a timeZoneId parameter (Windows/ICU timezone ids supported by .NET).

Tool names

get_now_local, get_now_utc

AIToolsFactory toolsFactory = new();
IList<AITool> tools = toolsFactory.GetTimeTools(new GetTimeToolsOptions
{
    GetNowLocalOptions = new GetNowLocalOptions
    {
        IncludeTimezoneParameter = true,
        DefaultLocalTimezoneIdIfNoneIsProvided = "UTC"
    }
});

WeatherTools (OpenWeatherMap)

Weather tools use the OpenWeatherMap API and require an API key.

Tool names

get_weather_for_city

AIToolsFactory toolsFactory = new();
IList<AITool> tools = toolsFactory.GetWeatherTools(new OpenWeatherMapOptions
{
    ApiKey = "<openweathermap-api-key>",
    PreferredUnits = WeatherOptionsUnits.Metric
});

WebsiteTools

Website tools fetch the content of a page from a URL, optionally stripping HTML/JS/CSS and returning plain text.

Tool names

get_content_of_url

AIToolsFactory toolsFactory = new();
IList<AITool> tools = toolsFactory.GetWebsiteTools(new GetWebsiteToolsOptions
{
    GetContentOfPageOptions = new GetContentOfPageOptions { StripMarkup = true }
});

Clone this wiki locally