Skip to content

feat: expose linked default Storage bucket - #11179

Open
info618 wants to merge 1 commit into
firebase:mainfrom
info618:codex/issue-4000-default-bucket
Open

info618 wants to merge 1 commit into
firebase:mainfrom
info618:codex/issue-4000-default-bucket

Conversation

@info618

@info618 info618 commented Sep 26, 2026

Copy link
Copy Markdown

Description

Add a read-only storage_get_default_bucket MCP tool that returns the Firebase Storage bucket linked to the currently selected project. It uses the existing getDefaultBucket read, accepts no arguments, rejects extra keys, and returns only the bucket name or a bounded error. The Storage tool registry and MCP tool list are updated.

Scenarios Tested

  • Focused Storage MCP spec: 5 passing cases for registration, selected project, missing bucket or permission failures, malformed response, and extra input.
  • npm run build:publish, focused ESLint, Prettier, and staged diff checks passed.
  • The local README generator command was blocked by a provider PreToolUse hook; the added row was checked against its generator source.
  • Full npm test was not run locally. Upstream PR checks remain pending.

Sample Commands

Call storage_get_default_bucket with {} after selecting a Firebase project.

@google-cla

google-cla Bot commented Sep 26, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@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 introduces the storage_get_default_bucket tool to retrieve the default Firebase Storage bucket name for a selected project, along with its unit tests and documentation. The review feedback suggests propagating specific error messages thrown by getDefaultBucket rather than swallowing them into a generic error, which ensures more descriptive, user-facing error feedback in line with the repository's style guide. Additionally, the unit tests should be updated to assert these specific errors.

Comment on lines +40 to +42
} catch {
return mcpError(bucketError);
}

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

By catching all errors and returning a generic bucketError, you are swallowing the highly descriptive and helpful FirebaseError messages thrown by getDefaultBucket (such as the 404 error containing setup instructions and the Firebase Console URL). Propagating these user-facing errors directly allows the user/client to know exactly why the tool call failed and how to resolve it.

Suggested change
} catch {
return mcpError(bucketError);
}
} catch (err: any) {
return mcpError(err);
}
References
  1. Throw FirebaseError for expected, user-facing errors. Swallowing these errors and returning a generic message defeats the purpose of user-facing errors. (link)

Comment on lines +45 to +54
it("returns a bounded error for missing bucket and permission failures", async () => {
for (const error of [new Error("bucket missing"), new Error("permission denied")]) {
getDefaultBucketStub.rejects(error);

const result = await get_default_bucket.fn({}, context);

expect(result).to.deep.equal(mcpError(bucketError));
}
expect(getDefaultBucketStub.calledTwice).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

Since we are now propagating the specific error messages from getDefaultBucket instead of swallowing them into a generic bucketError, we should update the unit tests to assert that the exact thrown error is returned.

Suggested change
it("returns a bounded error for missing bucket and permission failures", async () => {
for (const error of [new Error("bucket missing"), new Error("permission denied")]) {
getDefaultBucketStub.rejects(error);
const result = await get_default_bucket.fn({}, context);
expect(result).to.deep.equal(mcpError(bucketError));
}
expect(getDefaultBucketStub.calledTwice).to.be.true;
});
it("returns a bounded error for missing bucket and permission failures", async () => {
for (const error of [new Error("bucket missing"), new Error("permission denied")]) {
getDefaultBucketStub.rejects(error);
const result = await get_default_bucket.fn({}, context);
expect(result).to.deep.equal(mcpError(error));
}
expect(getDefaultBucketStub.calledTwice).to.be.true;
});

@b2m-reviewer b2m-reviewer left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Independent B2M #4000 source review PASS at exact head bb60c35. Review record: https://github.com/info618/b2m-hub/issues/4000#issuecomment-5851570287. This review does not waive upstream maintainer approval or merge rules.

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.

3 participants