Skip to content

MeaiTools

This example assumes using Resend; is in scope and apiKey contains your Resend API key.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
var apiKey =
    Environment.GetEnvironmentVariable("RESEND_API_KEY") is { Length: > 0 } value
        ? value
        : throw new AssertInconclusiveException("RESEND_API_KEY environment variable is not found.");

using var client = new ResendClient(apiKey);

// Create tools for email sending, retrieval, domains, contacts, and templates.
var sendEmailTool = client.AsSendEmailTool();
var getEmailTool = client.AsGetEmailTool();
var listEmailsTool = client.AsListEmailsTool();
var listDomainsTool = client.AsListDomainsTool();
var listContactsTool = client.AsListContactsTool();
var listTemplatesTool = client.AsListTemplatesTool();

// These tools can be passed to any IChatClient that supports function calling.
var tools = new[] { sendEmailTool, getEmailTool, listEmailsTool, listDomainsTool, listContactsTool, listTemplatesTool };