UNPKG

@sierai/stargate

Version:

Stargate Tools for AI Agents.

28 lines (25 loc) 943 B
import { z } from "zod"; import { Google } from "@sierai/stargate-auth"; import { StargateTool } from "@sierai/stargate-toolmaker"; const sendGmail = new StargateTool({ name: "send_gmail", description: "This tool will send an email using Gmail. Ask user to connect if it's unauthed. You can use this tool directly, start by asking the recipient for their email address.", schema: z.object({ title: z.string().describe("Title of the document."), body: z.string().describe("Body of the document in plain text."), recipient: z.string().describe("Recipient of the email."), }), runner: async (input, config, oauthProvider: InstanceType<typeof Google>) => { try { return await oauthProvider.sendEmail({ title: input.title, body: input.body, recipient: input.recipient, }); } catch (err) { return "Error fetching events: " + err; } }, }); export default sendGmail;