Skip to content

mcp - detect *.versions.toml for android - #11375

Open
aalej wants to merge 3 commits into
mainfrom
aalej-11351
Open

aalej wants to merge 3 commits into
mainfrom
aalej-11351

Conversation

@aalej

@aalej aalej commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Description

Fixes #11351

Scenarios Tested

verified that crashlytics tool is enabled via npx -y @modelcontextprotocol/inspector@latest

Sample Commands

Notes

camelCase naming convention from what I can gather isn't recommended. Recommended convention is kebab-case, however camelCase is still used in some cases

our detection code failed to parse build.gradle since firebaseCrashlytics is in camel case

// app/build.gradle
plugins {
    alias(libs.plugins.firebaseCrashlytics)
}
dependencies {
    implementation platform(libs.firebaseBom)
    implementation libs.firebaseCrashlytics
}

async function androidAppUsesCrashlytics(appPath: string): Promise<boolean> {
const buildGradleFiles = await detectFiles(appPath, "build.gradle*");
const crashlyticsPattern =
/(firebase-crashlytics|firebase\.crashlytics|com\.google\.firebase\.crashlytics)/;
for (const file of buildGradleFiles) {
const content = await fs.readFile(path.join(appPath, file), "utf8");
if (crashlyticsPattern.test(content)) {
return true;
}
}
return false;
}

Parsing the existing *.versions.toml should fix this since the firebase-crashlytics dependency would be listed there as com.google.firebase:firebase-crashlytics

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

Copy link
Copy Markdown
Contributor

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 updates the Firebase MCP server to detect Crashlytics in Gradle version catalogs (*.versions.toml) in addition to build.gradle files. It extracts file patterns to scan for both Android and iOS into constants and updates the detection logic accordingly. Comprehensive unit tests are added to verify this behavior. The reviewer suggested adding an additional test case to ensure camelCase firebaseCrashlytics is correctly detected directly in build.gradle files.

Comment on lines +153 to +170
it("should return true for an Android project with Crashlytics library in gradle/libs.versions.toml", async () => {
mockfs({
"/test-dir": {
gradle: {
"libs.versions.toml":
'[libraries]\ncrashlytics = { module = "com.google.firebase:firebase-crashlytics", version = "21.0.0" }',
},
android: {
"build.gradle.kts": "dependencies { implementation(libs.crashlytics) }",
src: { main: {} },
},
},
});

const result = await isCrashlyticsAvailable(mockContext("/test-dir"));

expect(result).to.be.true;
});

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Add Test Case for camelCase firebaseCrashlytics in build.gradle

To ensure that camelCase firebaseCrashlytics is correctly detected directly in build.gradle (or build.gradle.kts) files without relying on version catalogs, we should add a test case specifically for this scenario.

  it("should return true for an Android project with Crashlytics library in gradle/libs.versions.toml", async () => {
    mockfs({
      "/test-dir": {
        gradle: {
          "libs.versions.toml":
            '[libraries]\ncrashlytics = { module = "com.google.firebase:firebase-crashlytics", version = "21.0.0" }',
        },
        android: {
          "build.gradle.kts": "dependencies { implementation(libs.crashlytics) }",
          src: { main: {} },
        },
      },
    });

    const result = await isCrashlyticsAvailable(mockContext("/test-dir"));

    expect(result).to.be.true;
  });

  it("should return true for an Android project with camelCase firebaseCrashlytics in build.gradle", async () => {
    mockfs({
      "/test-dir": {
        android: {
          "build.gradle": "dependencies { implementation libs.firebaseCrashlytics }",
          src: { main: {} },
        },
      },
    });

    const result = await isCrashlyticsAvailable(mockContext("/test-dir"));

    expect(result).to.be.true;
  });

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

we probably don't need to look for camelCase firebaseCrashlytics in build.gradle files since the dependency firebase-crashlytics would be declared in *.versions.toml

@aalej
aalej requested a review from joehan October 28, 2026 13:48

This branch has not been deployed

No deployments
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.

[MCP] Crashlytics tools not loaded for Android projects using Gradle version catalogs (libs.versions.toml)

1 participant