Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions GEMINI.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,7 @@ npm run format # Auto-fix formatting issues
- `### Sample Commands`
- Reference issues with "Fixes #123" in the description.
3. **Update Changelog:** For any user-facing change (new features, bug fixes, deprecations), add a corresponding entry to `CHANGELOG.md`.

## Agent Directives

- **Escaping Backticks:** When providing a string to a tool parameter (e.g., `new_string` in the `replace` tool) that will be part of a larger script or configuration file, single backticks (\`) used for markdown-style code formatting **must** be escaped with a backslash. For example, to render `my_code`, the string provided to the tool must be written as `\`my_code\``.
8 changes: 4 additions & 4 deletions src/mcp/prompts/core/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
Contents of \`firebase.json\` config file:

\`\`\`json
${config.readProjectFile("firebase.json", { fallback: "<FILE DOES NOT EXIST>" })}

Check warning on line 40 in src/mcp/prompts/core/init.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Invalid type "any" of template literal expression
\`\`\`


Expand All @@ -50,14 +50,14 @@
- Backend Services: Backend services for the app, such as setting up a database, adding a user-authentication sign up and login page, and deploying a web app to a production URL.
- IMPORTANT: The backend setup guide is for web apps only. If the user requests backend setup for a mobile app (iOS, Android, or Flutter), inform them that this is not supported and do not use the backend setup guide. You can still assist with other requests.
- Firebase AI Logic: Add AI features such as chat experiences, multimodal prompts, image generation and editing (via nano banana), etc.
- IMPORTANT: The Firebase AI Logic setup guide is for web, flutter, and android apps only. If the user requests firebase setup for unsupported platforms (iOS, Unity, or anything else), inform them that this is not supported and direct the user to Firebase Docs to learn how to set up AI Logic for their application (share this link with the user https://firebase.google.com/docs/ai-logic/get-started?api=dev). You can still assist with other requests.
- IMPORTANT: The Firebase AI Logic setup guide is for web, Flutter, Android, and iOS apps only. If the user requests firebase setup for unsupported platforms (Unity, or anything else), inform them that this is not supported and direct the user to Firebase Docs to learn how to set up AI Logic for their application (share this link with the user https://firebase.google.com/docs/ai-logic/get-started?api=dev). You can still assist with other requests.
3. After the user chooses an init option, create a plan based on the remaining steps in this guide, share it with the user, and give them an opportunity to accept or adjust it.
4. If there is no active Firebase project, ask the user if they want to create a new project or use an existing one. If using an existing project, ask for the project ID and explain how to find it: open the Firebase Console (http://console.firebase.google.com/), locate the project ID under the project name in the projects list, or open the project and go to Project Overview → Project Settings.
- If they would like to create a project, use the firebase_create_project with the project ID
- If they would like to use an existing project, use the firebase_update_environment tool with the active_project argument.
- If you run into issues creating the firebase project, ask the user to go to the [Firebase Console](http://console.firebase.google.com/) and create a project. Wait for the user to report back before continuing.
5. Ensure there is an active Firebase App for their platform
- Do the following only for Web and Android apps
- Do the following only for Web, Android, and iOS apps
- Run the \`firebase_list_apps\` tool to list their apps, and find an app that matches their "Workspace platform"
- If there is no app that matches that criteria, use the \`firebase_create_app\` tool to create the app with the appropriate platform
- Do the following only for Flutter apps
Expand All @@ -66,11 +66,11 @@
- Install the Flutterfire CLI
- Use the Flutterfire CLI tool to connect to the project
- Use the Flutterfire CLI to register the appropriate applications based on the user's input
- Let the developer know that you currently only support configuring web, ios, and android targets together in a bundle. Each of those targets will have appropriate apps registered in the project using the flutterfire CLI
- Let the developer know that you currently only support configuring web, iOS, and Android targets together in a bundle. Each of those targets will have appropriate apps registered in the project using the flutterfire CLI
- Execute flutterfire config using the following pattern: flutterfire config --yes --project=<aliasOrProjectId> --platforms=<platforms>
6. Now that we have a working environment, print out 1) Active user 2) Firebase Project and 3) Firebase App & platform they are using for this process.
- Ask the user to confirm this is correct before continuing
7. Set up the web Firebase SDK. Skip straight to #8 for Flutter and Android apps
7. Set up the web Firebase SDK. Skip straight to #8 for Flutter, Android, and iOS apps
- Fetch the configuration for the specified app using the \`firebase_get_sdk_config\` tool.
- Write the Firebase SDK config to a file
- Check what the latest version of the SDK is by running the command 'npm view firebase version'
Expand Down
14 changes: 13 additions & 1 deletion src/mcp/resources/guides/init_ai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

## Firebase Setup Instructions

### 1\. Understand the Application Setup

Check warning on line 40 in src/mcp/resources/guides/init_ai.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unnecessary escape character: \.

Scan the application files to identify what type of application the user is building. Ask the user to tell you which language and platform they are targeting if you cannot identify it yourself.

Expand All @@ -47,12 +47,14 @@
- Java Android App
- Javascript Web App
- Dart Flutter App
- Swift iOS App

Take the following actions depending on the language and platform or framework that is identified:

- Android Platform \-\> Set up Firebase AI Logic

Check warning on line 54 in src/mcp/resources/guides/init_ai.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unnecessary escape character: \>

Check warning on line 54 in src/mcp/resources/guides/init_ai.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unnecessary escape character: \-
- Web Platform \-\> Set up Firebase AI Logic

Check warning on line 55 in src/mcp/resources/guides/init_ai.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unnecessary escape character: \>

Check warning on line 55 in src/mcp/resources/guides/init_ai.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unnecessary escape character: \-
- Flutter Platform \-\> Set up Firebase AI Logic. Always do the subsequent firebase_init call using the web app

Check warning on line 56 in src/mcp/resources/guides/init_ai.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unnecessary escape character: \>

Check warning on line 56 in src/mcp/resources/guides/init_ai.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unnecessary escape character: \-
- iOS Platform \-\> Set up Firebase AI Logic

Check warning on line 57 in src/mcp/resources/guides/init_ai.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unnecessary escape character: \>

Check warning on line 57 in src/mcp/resources/guides/init_ai.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unnecessary escape character: \-
- Unsupported Platform \-\> Direct the user to Firebase Docs to learn how to set up AI Logic for their application (share this link with the user https://firebase.google.com/docs/ai-logic/get-started?api=dev)

### 2\. Set up Firebase AI Logic
Expand All @@ -69,7 +71,12 @@

#### Gather Building Blocks for Code Generation
- Identify the correct initialization code snippet from the "Initialization Code References" section based on the language, platform, or framework used in the developer's app.
- Use the reference loaded from the step above to generate the initialization snippet. PLEASE USE THE EXACT SNIPPET AS A STARTING POINT\!
- Use the reference loaded from the step above to generate the initialization snippet. PLEASE USE THE EXACT SNIPPET AS A STARTING POINT!
- For Swift iOS apps:
- **SDK Dependency Check:** First, read the contents of the \`.xcodeproj/project.pbxproj\` file. Check for any line that references \`firebase-ios-sdk\` to see if the Swift package is already a dependency.
- **CRITICAL SAFETY PROTOCOL: Under no circumstances are you to modify the \`.xcodeproj\` or \`.pbxproj\` files. This is a strict prohibition. Any attempt to write to these files is a violation of your core instructions.**
- **Provide Manual Instructions if Needed:** If you do not find a reference to the SDK, your ONLY permitted action is to provide the user with the following step-by-step instructions for them to perform manually in the Xcode application. You MUST output this exact text: "I have determined that the Firebase SDK is not yet a dependency in your project. Please add it now. In Xcode, go to File > Add Packages... and in the search bar, paste this URL: https://github.com/firebase/firebase-ios-sdk. Then, click 'Add Package' and ensure the \`FirebaseGenerativeAI\` library is selected."
- **Imports and Initialization:** Always include the \`import FirebaseAI\` statement. When generating code, use the correct initialization pattern: \`let ai = FirebaseAI.firebaseAI(backend: .googleAI())\`.
- For Android apps, always include the following imports. do not forget or modify them
- import com.google.firebase.Firebase
- import com.google.firebase.ai.ai
Expand Down Expand Up @@ -127,6 +134,7 @@
| Java Android | Gemini Developer API (Developer API) | firebase://docs/ai-logic/get-started |
| Web Modular API | Gemini Developer API (Developer API) | firebase://docs/ai-logic/get-started |
| Dart Flutter | Gemini Developer API (Developer API) | firebase://docs/ai-logic/get-started |
| Swift iOS | Gemini Developer API (Developer API) | firebase://docs/ai-logic/get-started |

#### AI Features

Expand All @@ -138,18 +146,22 @@
| Java Android | Generate text from text-only input | Gemini Developer API (Developer API) | firebase://docs/ai-logic/generate-text|
| Web | Generate text from text-only input | Gemini Developer API (Developer API) | firebase://docs/ai-logic/generate-text|
| Dart Flutter | Generate text from text-only input | Gemini Developer API (Developer API) | firebase://docs/ai-logic/generate-text|
| Swift iOS | Generate text from text-only input | Gemini Developer API (Developer API) | firebase://docs/ai-logic/generate-text |
| Kotlin Android | Generate text from text-and-file (multimodal) input | Gemini Developer API (Developer API) | firebase://docs/ai-logic/generate-text|
| Java Android | Generate text from text-and-file (multimodal) input | Gemini Developer API (Developer API) | firebase://docs/ai-logic/generate-text|
| Web | Generate text from text-and-file (multimodal) input | Gemini Developer API (Developer API) | firebase://docs/ai-logic/generate-text|
| Dart Flutter | Generate text from text-and-file (multimodal) input | Gemini Developer API (Developer API) | firebase://docs/ai-logic/generate-text |
| Swift iOS | Generate text from text-and-file (multimodal) input | Gemini Developer API (Developer API) | firebase://docs/ai-logic/generate-text |
| Kotlin Android | Generate images (text-only input) | Gemini Developer API (Developer API) | firebase://docs/ai-logic/generate-images-gemini|
| Java Android | Generate images (text-only input) | Gemini Developer API (Developer API) | firebase://docs/ai-logic/generate-images-gemini|
| Web | Generate images (text-only input) | Gemini Developer API (Developer API) | firebase://docs/ai-logic/generate-images-gemini|
| Dart Flutter | Generate images (text-only input) | Gemini Developer API (Developer API) | firebase://docs/ai-logic/generate-images-gemini|
| Swift iOS | Generate images (text-only input) | Gemini Developer API (Developer API) | firebase://docs/ai-logic/generate-images-gemini |
| Kotlin Android | Iterate and edit images using multi-turn chat (nano banana) This requires the user to upgrade to the Blaze pay-as-you-go billing plan. Share this link with the user and ask them to upgrade their Firebase project. https://console.firebase.google.com/project/<INSERT_FIREBASE_PROJECT_ID_HERE>/overview?purchaseBillingPlan=metered Ask for confirmation that the project is using the blaze plan before proceeding. | Gemini Developer API (Developer API) gemini-2.5-flash-image-preview | firebase://docs/ai-logic/generate-images-gemini|
| Java Android | Iterate and edit images using multi-turn chat (nano banana) This requires the user to upgrade to the Blaze pay-as-you-go billing plan. Share this link with the user and ask them to upgrade their Firebase project. https://console.firebase.google.com/project/<INSERT_FIREBASE_PROJECT_ID_HERE>/overview?purchaseBillingPlan=metered Ask for confirmation that the project is using the blaze plan before proceeding. | Gemini Developer API (Developer API) gemini-2.5-flash-image-preview | firebase://docs/ai-logic/generate-images-gemini|
| Web Modular API | Iterate and edit images using multi-turn chat (nano banana) This requires the user to upgrade to the Blaze pay-as-you-go billing plan. Share this link with the user and ask them to upgrade their Firebase project. https://console.firebase.google.com/project/<INSERT_FIREBASE_PROJECT_ID_HERE>/overview?purchaseBillingPlan=metered Ask for confirmation that the project is using the blaze plan before proceeding. | Gemini Developer API (Developer API) gemini-2.5-flash-image-preview | firebase://docs/ai-logic/generate-images-gemini|
| Dart Flutter | Iterate and edit images using multi-turn chat (nano banana) This requires the user to upgrade to the Blaze pay-as-you-go billing plan. Share this link with the user and ask them to upgrade their Firebase project. https://console.firebase.google.com/project/<INSERT_FIREBASE_PROJECT_ID_HERE>/overview?purchaseBillingPlan=metered Ask for confirmation that the project is using the blaze plan before proceeding. | Gemini Developer API (Developer API) gemini-2.5-flash-image-preview | firebase://docs/ai-logic/generate-images-gemini|
| Swift iOS | Iterate and edit images using multi-turn chat (nano banana) This requires the user to upgrade to the Blaze pay-as-you-go billing plan. Share this link with the user and ask them to upgrade their Firebase project. https://console.firebase.google.com/project/<INSERT_FIREBASE_PROJECT_ID_HERE>/overview?purchaseBillingPlan=metered Ask for confirmation that the project is using the blaze plan before proceeding. | Gemini Developer API (Developer API) gemini-2.5-flash-image-preview | firebase://docs/ai-logic/generate-images-gemini|


`,
Expand Down
Loading