Skip to content

Tools

BuiltInTools.Safe is the default safe set. BuiltInTools.All includes the larger built-in inventory.

The built-in catalog covers file operations, shell execution, web fetch and search, memory, base64 helpers, task management, and interactive prompts.

Use [Tool] and [ToolParam] for strongly typed registration:

[Tool("add", "Add two numbers")]
public static ToolResult Add(
IToolContext context,
[ToolParam("First number")] double a,
[ToolParam("Second number")] double b)
{
return ToolResult.Success($"{a} + {b} = {a + b}");
}

Register tools with:

  • Tool.FromType<T>()
  • Tool.FromMethod<T>(...)
  • Tool.FromInstance(...)

For dynamic tool definitions, use Tool.Create(...):

var tool = Tool.Create("custom_tool")
.WithDescription("A custom tool created with the builder pattern")
.WithParameter<string>("input", "Input text to process")
.WithHandler(async (parameters, context) =>
{
var input = parameters["input"]?.ToString() ?? "";
return ToolResult.Success(input.ToUpperInvariant());
})
.Build();

Document MCP using the verified APIs:

  • Agent.McpServers
  • McpToolLoader.LoadAsync(...)
  • McpToolLoader.DiscoverAsync(...)

Avoid older sample text that implies BuiltInTools.FromMcpServerAsync(...) is the supported path.