Skip to content

Conversation

@raybellwaves
Copy link
Contributor

Closes #46 ???

Note: this was from Jules (raybellwaves#1)

Haven't build, haven't tested and haven't spend to the time to understand this repo. Therefore, merge at your peril.

google-labs-jules bot and others added 2 commits November 27, 2025 05:05
This change adds a new top-level tool `/gmail:search` to the gemini-cli.
It creates a `commands/gmail/search.toml` file that defines the command
and instructs the agent to use `gmail.search` and `gmail.get` to find
and display emails.
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @raybellwaves, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request integrates a new gmail:search command, enabling users to perform email searches directly. It streamlines the process of querying Gmail and presenting relevant email details by orchestrating calls to existing gmail.search and gmail.get functionalities.

Highlights

  • New Gmail Search Tool: A new top-level tool named gmail:search has been introduced to enable searching for emails within Gmail.
  • Tool Definition: The new tool is defined in a dedicated TOML configuration file, commands/gmail/search.toml.
  • Search Workflow: The tool's prompt outlines a workflow that first uses gmail.search to find email IDs, then gmail.get for each found email to retrieve metadata (From, Subject, Snippet), and finally formats the results into a readable list.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new top-level tool, gmail:search, by adding a search.toml configuration file. This file contains a prompt that guides an AI to search for emails using the gmail.search and gmail.get tools. While the prompt structure is logical, I've identified a significant performance concern. The current instructions could lead to an excessive number of API calls if a search yields many results. My review includes a suggestion to modify the prompt to limit the number of fetched emails, improving efficiency and user experience. Given the author's note that this change has not been tested, I strongly recommend thorough testing before merging to ensure it functions as expected and to validate the fix for the performance issue.

Comment on lines +6 to +10
2) Call the `gmail.search` tool, passing the user's query as the `query` argument.
3) The `gmail.search` tool returns a JSON object containing a list of emails (id and threadId).
4) For each email found, you MUST call `gmail.get` with the `messageId` and `format='metadata'` to get the From, Subject, and Snippet.
5) Format the result into a clear, readable list.
6) If no emails are found, state that clearly.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The current instructions can lead to performance issues. If a search query returns many results, the instruction in step 4 (For each email found, you MUST call 'gmail.get'...) will trigger a large number of subsequent API calls (an N+1 problem). This can result in slow responses and could potentially hit API rate limits.

To make this more efficient and provide a better user experience, I recommend explicitly limiting the number of results in the initial search and then informing the user if more results are available. The gmail.search tool returns a resultSizeEstimate which can be used for this.

2) Call the `gmail.search` tool, passing the user's query as the `query` argument and setting `maxResults` to 5.
3) The `gmail.search` tool returns a JSON object containing a list of emails (id and threadId) and a `resultSizeEstimate`.
4) For each email found, you MUST call `gmail.get` with the `messageId` and `format='metadata'` to get the From, Subject, and Snippet.
5) Format the result into a clear, readable list. If the `resultSizeEstimate` is greater than the number of emails shown, inform the user (e.g., "Showing 5 of 27 results.").
6) If no emails are found, state that clearly.

Copy link
Contributor

@allenhutchison allenhutchison left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution. I tested this on several different queries this afternoon and it performs well.

@allenhutchison allenhutchison merged commit 53ab229 into gemini-cli-extensions:main Dec 2, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

add other high level tool like gmail:search

2 participants