Back/Engineering/Goose
AdvancedEngineeringGoose

How to Build a Custom AI Email Tool for Goose Using 'Vibe Coding'

A developer-focused guide on creating a new capability for the Goose AI agent. Learn to write a simple Python script, wrap it into a reusable Model Context Protocol (MCP) for sending emails, and integrate it into a larger workflow.

From How I AI

How I AI: Block's 3-Step Workflow for Data Analysis, E-commerce, and Custom AI Tools with Goose

with Claire Vo

How to Build a Custom AI Email Tool for Goose Using 'Vibe Coding'

Tools Used

Goose

Open-source AI agent by Block for automating tasks

Step-by-Step Guide

1

Scaffold the Core Functionality

Before building the full tool, ask Goose to write a basic script to perform the core task. This validates the logic in a simple environment.

Prompt:
I have a scaffolded Python package here using uv... I have a .env file... can you make a python script in this directory that sends a test email?
2

Convert the Script into an MCP

Provide Goose with the necessary context by pasting the example code from the MCP Python SDK's README file directly into the chat. Then, ask it to merge your script from Step 1 with the example to create a functional MCP server file.

Prompt:
Here's reference code... can you use that example to make an MCP with a send email tool?
3

Debug with AI Assistance

If the generated code has an error, don't debug it manually. Instead, copy and paste the full error message back into Goose and ask it to fix the problem. The agent can often identify and correct its own mistakes.

Pro Tip: This AI-driven feedback loop dramatically speeds up the development and debugging process for new tools.
4

Integrate the New Custom Tool

Once the MCP is working, add it as a new custom extension in the Goose settings. This makes the send_email function available as a tool that the agent can use in any conversation.

5

Use the New Tool to Close the Loop

Return to a previous conversation where you completed a task (like creating a payment link). Enable your new email extension for that session and give a final command to use the new capability.

Prompt:
I just enabled email tool. Can you send that payment link to my demo email address?

Become a 10x PM.
For just $5 / month.

We've made ChatPRD affordable so everyone from engineers to founders to Chief Product Officers can benefit from an AI PM.