RichStokoe.AgentTools
2.0.1
dotnet add package RichStokoe.AgentTools --version 2.0.1
NuGet\Install-Package RichStokoe.AgentTools -Version 2.0.1
<PackageReference Include="RichStokoe.AgentTools" Version="2.0.1" />
<PackageVersion Include="RichStokoe.AgentTools" Version="2.0.1" />
<PackageReference Include="RichStokoe.AgentTools" />
paket add RichStokoe.AgentTools --version 2.0.1
#r "nuget: RichStokoe.AgentTools, 2.0.1"
#:package RichStokoe.AgentTools@2.0.1
#addin nuget:?package=RichStokoe.AgentTools&version=2.0.1
#tool nuget:?package=RichStokoe.AgentTools&version=2.0.1
RichStokoe.AgentTools
A collection of ready-made tools for AI agents built with Microsoft Agent Framework (MAF). Drop them into any MAF agent to give it real-world capabilities without writing boilerplate.
Installation
dotnet add package RichStokoe.AgentTools
Usage
Register ToolManager in your DI container and pass its tools to your agent:
// SetupServices.cs
builder.Services.AddSingleton<ToolManager>();
// Agent/AgentRunner.cs
public class AgentRunner(IChatClient chatClient, ToolManager toolManager)
{
private readonly AIAgent _agent = chatClient.AsAIAgent(
name: "MyAgent",
instructions: "You are a helpful assistant.",
tools: toolManager.GetTools(typeFilter: AgentToolTypes.ReadWrite)
);
}
ToolManager discovers tools at runtime by scanning all assemblies loaded into the current AssemblyLoadContext. Any public static method decorated with [AgentTool] (and [Description]) is registered as an AIFunction.
Filtering tools
GetTools accepts optional filters so you can pass only a relevant subset to an agent:
// All read-only tools
toolManager.GetTools(typeFilter: AgentToolTypes.Read)
// Read and write tools (excludes Dangerous) — convenience composite
toolManager.GetTools(typeFilter: AgentToolTypes.ReadWrite)
// Explicitly include Dangerous tools (e.g. BashTool)
toolManager.GetTools(typeFilter: AgentToolTypes.ReadWrite | AgentToolTypes.Dangerous)
// Every tool in every category — convenience composite
toolManager.GetTools(typeFilter: AgentToolTypes.All)
// All tools whose name contains "Weather" (case-insensitive)
toolManager.GetTools(namePattern: "*Weather*", typeFilter: AgentToolTypes.Read)
// Tools whose name starts with "Get", restricted to read-only
toolManager.GetTools(namePattern: "Get_*", typeFilter: AgentToolTypes.Read)
namePattern supports * (any sequence of characters) and ? (any single character) wildcards. The pattern is matched against the tool's Name if one was set on the attribute, otherwise against the method name.
typeFilter is a required opt-in — passing AgentToolTypes.None (the default) returns an empty list. This prevents accidentally handing a dangerous tool to an agent that does not need it. Use AgentToolTypes.ReadWrite for the common case of read/write tools without dangerous ones, or AgentToolTypes.All to include everything.
Tools
Utils
DateTimeTools
Gives the agent awareness of the current local date and time. Instructs the model not to cache these values, so repeated calls always return fresh results.
| Tool | Description |
|---|---|
Get_Current_Time |
Returns the current local time |
Get_Current_Date |
Returns the current local date |
WeatherTools
Fetches live weather data via wttr.in. No API key required.
| Tool | Description |
|---|---|
Get_Current_Weather_For_Location |
Returns temperature (°C/°F), conditions, humidity, wind speed and direction, visibility, and UV index for a city name or lat/long coordinates |
LocationTools
Resolves an IP address to a geographic location via ip-api.com (free for non-commercial use, no API key required). Pair with NetworkTools so the agent can look up the user's own location.
| Tool | Description |
|---|---|
Get_Location_From_Ip_Address |
Returns city, region, country, coordinates, timezone, and ISP for a given IP address |
NetworkTools
| Tool | Description |
|---|---|
Get_Public_Ip_Address |
Returns the machine's current public IP address via ipify.org |
MathTools
| Tool | Description |
|---|---|
Add_Numbers |
Adds a sequence of decimal numbers and returns the sum |
BashTool
Executes shell commands and returns stdout, stderr, and the exit code. Uses zsh on macOS/Linux and cmd.exe on Windows. Commands time out after 60 seconds.
Classified
Dangerous— not returned byGetToolsunlessAgentToolTypes.Dangerousis included in the type filter.
| Tool | Description |
|---|---|
RunCommand |
Runs a shell command and returns combined stdout, stderr (labelled [stderr]), and exit code if non-zero |
FileTools
Reads and writes files on the local filesystem. Parent directories are created automatically on write. Not tagged with [AgentTool] — register manually or add the attribute to enable ToolManager discovery.
| Tool | Description |
|---|---|
ReadFile |
Returns the full text content of a file, or an error if the file does not exist |
WriteFile |
Creates or overwrites a file with the given content |
AppendToFile |
Appends text to a file, creating it if it does not exist |
Web
WebFetchTool
Fetches the content of a URL via HTTP GET. For HTML pages, <script> and <style> blocks are removed entirely before tags are stripped, returning clean plain text. Non-2xx responses are returned as an error message. Not tagged with [AgentTool] — register manually or add the attribute to enable ToolManager discovery.
| Tool | Description |
|---|---|
FetchUrl |
Returns the plain-text content of a URL, truncated to maxLength characters (default 8,000) |
WebSearchTools
Searches the web via DuckDuckGo without an API key.
| Tool | Description |
|---|---|
Search_Web |
Returns titles, URLs, and snippets for a search query (1–10 results) |
Get_Instant_Answer |
Returns a direct answer, Wikipedia-style abstract, or definition for a factual question via the DuckDuckGo Instant Answer API |
RssFeedTools
Reads and searches RSS/Atom feeds. Supports both arbitrary feed URLs and a set of named news sources.
| Tool | Description |
|---|---|
Read_Rss_Feed |
Reads up to 20 articles from any RSS or Atom feed URL |
Get_Latest_News |
Fetches headlines from a named source (see supported sources below) |
Find_Rss_Feeds |
Searches for RSS feeds related to a topic via the Feedly API |
Supported news sources for Get_Latest_News:
| Key | Source |
|---|---|
bbc |
BBC News |
cnn |
CNN |
reuters |
Reuters |
techcrunch |
TechCrunch |
hackernews |
Hacker News |
guardian |
The Guardian |
nytimes |
New York Times |
reddit |
Reddit Front Page |
ars |
Ars Technica |
verge |
The Verge |
Adding Your Own Tools
Decorate any public static method with [AgentTool] and [Description]. The method can live in any assembly that is loaded by the application — ToolManager scans all of them.
using System.ComponentModel;
using RichStokoe.AgentTools;
public static class MyTools
{
[AgentTool(Type = AgentToolTypes.Read)]
[Description("Returns a friendly greeting for the given name.")]
public static string Greet(
[Description("The name to greet.")] string name)
=> $"Hello, {name}!";
}
[AgentTool] has two optional properties:
| Property | Type | Description |
|---|---|---|
Name |
string? |
Override the tool name exposed to the model. Defaults to the method name. |
Type |
AgentToolTypes |
Classify the tool as Read, Write, Dangerous, or a combination. Defaults to None (never returned by GetTools). |
No registration required — just ensure the assembly is loaded and restart.
External Services
All tools that call external services use free, no-registration APIs:
| Service | Used by | Terms |
|---|---|---|
| wttr.in | WeatherTools | Free, no key |
| ip-api.com | LocationTools | Free for non-commercial use |
| ipify.org | NetworkTools | Free, no key |
| DuckDuckGo | WebSearchTools | Free, no key |
| Feedly | RssFeedTools (Find) | Free tier |
| RSS/Atom feeds | RssFeedTools | Per-source terms |
License
MIT — provided as-is, without warranty of any kind. See the LICENSE file for the full terms.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Microsoft.Extensions.AI (>= 10.4.1)
- System.ServiceModel.Syndication (>= 10.0.5)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.