From d57dd5c370218cc16441d888019adf1549687537 Mon Sep 17 00:00:00 2001 From: Grant Linville Date: Thu, 13 Mar 2025 13:10:05 -0400 Subject: [PATCH] enhance: gmail: add tool to get the signed in user's address Signed-off-by: Grant Linville --- google/gmail/currentEmail.py | 15 +++++++++++++++ google/gmail/tool.gpt | 9 ++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 google/gmail/currentEmail.py diff --git a/google/gmail/currentEmail.py b/google/gmail/currentEmail.py new file mode 100644 index 000000000..534adb90d --- /dev/null +++ b/google/gmail/currentEmail.py @@ -0,0 +1,15 @@ +import asyncio +from helpers import client + +async def main(): + service = client('gmail', 'v1') + try: + profile = service.users().getProfile(userId='me').execute() + email_address = profile['emailAddress'] + print(email_address) + except Exception as e: + print(f"Error getting email address: {e}") + return None + +if __name__ == "__main__": + asyncio.run(main()) diff --git a/google/gmail/tool.gpt b/google/gmail/tool.gpt index 08dacc8f6..3bd7fc43f 100644 --- a/google/gmail/tool.gpt +++ b/google/gmail/tool.gpt @@ -2,7 +2,14 @@ Name: Gmail Description: Tools for interacting with a user's Gmail account Metadata: bundle: true -Share Tools: List Inbox, Read Email, Search Emails, Send Email, Delete Email, List Drafts, Create Draft, Update Draft, Delete Draft, Send Draft +Share Tools: Current Email, List Inbox, Read Email, Search Emails, Send Email, Delete Email, List Drafts, Create Draft, Update Draft, Delete Draft, Send Draft + +--- +Name: Current Email +Description: Gets the email address of the currently signed in user +Credential: ../credential + +#!/usr/bin/env python3 ${GPTSCRIPT_TOOL_DIR}/currentEmail.py --- Name: List Inbox