Conversation
|
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. |
There was a problem hiding this comment.
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.
| } catch { | ||
| return mcpError(bucketError); | ||
| } |
There was a problem hiding this comment.
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.
| } catch { | |
| return mcpError(bucketError); | |
| } | |
| } catch (err: any) { | |
| return mcpError(err); | |
| } |
References
- Throw FirebaseError for expected, user-facing errors. Swallowing these errors and returning a generic message defeats the purpose of user-facing errors. (link)
| 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; | ||
| }); |
There was a problem hiding this comment.
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.
| 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
left a comment
There was a problem hiding this comment.
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.
Description
Add a read-only
storage_get_default_bucketMCP tool that returns the Firebase Storage bucket linked to the currently selected project. It uses the existinggetDefaultBucketread, 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
npm run build:publish, focused ESLint, Prettier, and staged diff checks passed.npm testwas not run locally. Upstream PR checks remain pending.Sample Commands
Call
storage_get_default_bucketwith{}after selecting a Firebase project.