-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add MCP init prompt for Firestore and AI Logic #9177
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
fc3dbc5
to
dd00ec8
Compare
Summary of ChangesHello @samedson, 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 significantly enhances the Firebase initialization experience within the MCP by introducing more structured and detailed prompts and guides. It streamlines the setup for core Firebase services, particularly for AI Logic, Firestore, Authentication, and Hosting, by providing comprehensive instructions and code examples tailored for various platforms and AI assistant interactions. Highlights
Using Gemini Code AssistThe 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
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 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
|
Co-authored-by: Konstantin Mandrika <kmandrika@google.com>
dd00ec8
to
127abc0
Compare
There was a problem hiding this 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 new MCP init prompts and detailed guides for Firestore and AI Logic, significantly enhancing the instructions for the AI agent. The changes are well-structured and provide comprehensive steps for setting up various Firebase services. My review includes a few suggestions to fix typos in the prompt text and remove large blocks of commented-out code to improve maintainability. Overall, these new prompts are a valuable addition.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Put in some thoughts on the content, but lets just get this in and then we can test those changes later
| :--- | ---: | :--- | :--- | | ||
| Swift iOS | Generate text from text-only input | Gemini Developer API (Developer API) | import FirebaseAI// Initialize the Gemini Developer API backend servicelet ai = FirebaseAI.firebaseAI(backend: .googleAI())// Create a \`GenerativeModel\` instance with a model that supports your use caselet model = ai.generativeModel(modelName: "gemini-2.5-flash")// Provide a prompt that contains textlet prompt = "Write a story about a magic backpack."// To generate text output, call generateContent with the text inputlet response = try await model.generateContent(prompt)print(response.text ?? "No text in response.")| | ||
| Kotlin Android | Generate text from text-only input | Gemini Developer API (Developer API) | // Initialize the Gemini Developer API backend service// Create a \`GenerativeModel\` instance with a model that supports your use caseval model = Firebase.ai(backend = GenerativeBackend.googleAI()) .generativeModel("gemini-2.5-flash")// Provide a prompt that contains textval prompt = "Write a story about a magic backpack."// To generate text output, call generateContent with the text inputval response = generativeModel.generateContent(prompt)print(response.text) | | ||
| Java Android | Generate text from text-only input | Gemini Developer API (Developer API) | // Initialize the Gemini Developer API backend service// Create a \`GenerativeModel\` instance with a model that supports your use caseGenerativeModel ai = FirebaseAI.getInstance(GenerativeBackend.googleAI()) .generativeModel("gemini-2.5-flash");// Use the GenerativeModelFutures Java compatibility layer which offers// support for ListenableFuture and Publisher APIsGenerativeModelFutures model = GenerativeModelFutures.from(ai);// Provide a prompt that contains textContent prompt = new Content.Builder() .addText("Write a story about a magic backpack.") .build();// To generate text output, call generateContent with the text inputListenableFuture<GenerateContentResponse> response = model.generateContent(prompt);Futures.addCallback(response, new FutureCallback<GenerateContentResponse>() { @Override public void onSuccess(GenerateContentResponse result) { String resultText = result.getText(); System.out.println(resultText); } @Override public void onFailure(Throwable t) { t.printStackTrace(); }}, executor); | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to act on this right away:
Long term, it feels like each of the cases should be it's own guide, and this guide should point the prompt at the correct one to read. Otherwise, we're dumping a ton of info into the context and I worry it may cause confusion
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a great idea. I think Andrew and team might be working on a more complete version of this prompt, so we can pass that idea along
- Introduce Firebase Hosting when developers are ready to deploy their application to production | ||
- **Alternative**: Developers can deploy later using the \`/deploy\` command | ||
- **Permission Required**: Request developer permission before implementing Firebase Hosting | ||
- **Deployment**: Configure Firebase Hosting and deploy the application to production |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nonblocking note for later - does this actually work? Seems like we'd want more explicit instructions on how to do this...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That was my thought too. We're starting with Charlotte's prompts for now, but we'll likely iterate on this. Surprisingly this works decently well
- **Verification**: Guide developers to verify database creation at the [Firebase Console](https://console.firebase.google.com/) by clicking on the "Firestore Database" tab in the left navigation to confirm the database is created. | ||
- **Testing**: Recommend developers test their application and verify data appears correctly in the console. Ask developers to confirm they can see their test data in the console before proceeding to the next step. | ||
- **Security**: Recommend implementing authentication if the application handles sensitive user data. Guide users to navigate to the "Firestore Database" section and click on the "Rules" tab to view and configure their security rules. | ||
- **Security Warning**: Alert developers against making Firestore security rules public (allowing read/write without authentication) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note for later: there's a really thorough prompt in studio about how to make secure rules - we might want to pull that into here as another guide, and link the AI to it here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I'm hoping to bring that in and add a bunch more rules tooling soon
2. Use the Firebase \`read_resources\` tool to load the guide to setup the product you choose. | ||
## Available Services | ||
The user will likely need to setup Firestore, Authentication, and Hosting. Read the following guides in order. Do not run the app until you have completed all 3 guides. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nonblocking thing to test: should this instead tell the AI to run the init MCP tool with Firestore, Auth, and Hosting?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ooh hadn't seen that tool - let me check that out in a follow up
Added this feedback to our task list. Gonna merge for now to have a v0 in for bug bash |
Description
Add MCP init prompts for Firestore and AI Logic
Scenarios Tested
NA
Sample Commands
/firebase:init --prompt="Build an app that gets the weather and converts it to its most appropriate emoji and stores them in a database"