Skip to main content
Leverage Gwiz tools directly in your Vercel AI SDK agents. Build powerful email-aware AI applications with just a few lines of code.

Quick Example

Here’s how easy it is to get started:
import { tools } from "@gwizai/sdk";
import { Agent } from "ai";

const gwiz = await tools();

const agent = new Agent({
  model: "google/gemini-2.5-flash",
  tools: { ...gwiz },
});

const result = await agent.generate({
  prompt: "When is my upcoming flight to Japan?",
});
That’s it! Your agent now has full access to your Gmail.

What You Can Build

With Gwiz SDK, you can create AI agents that:
  • Answer questions about your emails - “When is my next meeting?”
  • Search and retrieve emails - “Find all emails about the project proposal”
  • Send emails - “Send a follow-up email to the team”
  • Manage your inbox - “Archive all newsletters older than 30 days”
  • Reply to emails - “Reply to the latest email from John”

Installation

Install the SDK and required dependencies:
npm install @gwizai/sdk ai @ai-sdk/openai

Authentication

Get your authentication token:
npx @gwizai/sdk auth login
This saves your token to ~/.gwiz/config.json which the SDK automatically reads.

Complete Example

import { tools } from "@gwizai/sdk";
import { Agent } from "ai";
import { openai } from "@ai-sdk/openai";

async function main() {
  // Initialize tools (reads from ~/.gwiz/config.json or GWIZ_MCP_TOKEN env var)
  const gwizTools = await tools();

  // Create agent with Gmail capabilities
  const agent = new Agent({
    model: openai("gpt-4"),
    tools: {
      gmail: gwizTools,
    },
  });

  // Use the agent
  const result = await agent.generate({
    messages: [
      {
        role: "user",
        content: "When is my upcoming flight to Japan?",
      },
    ],
  });

  console.log(result.text);
}

main();

Available Tools

When you call tools(), you get access to all Gwiz MCP tools:
  • search-emails - Search for emails using vector search or Gmail operators
  • get-email - Retrieve a single email
  • get-thread - Retrieve an entire email thread
  • list-threads - List email threads in your mailbox
  • send-email - Send a new email
  • reply - Reply to an email
  • draft - Create draft emails
  • archive - Archive emails
  • list-contacts - List all contacts
  • list-subscriptions - List email subscriptions
  • And more!

Next Steps