-
Couldn't load subscription status.
- Fork 1.1k
Added FM Delivery Data API MCP Tool #9393
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
base: master
Are you sure you want to change the base?
Conversation
Summary of ChangesHello @gsiddh, 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 introduces a new capability for developers to access and analyze their Firebase Cloud Messaging (FCM) delivery data directly through an MCP tool. By integrating with the FCM Data Delivery API, it provides granular insights into how messages and notifications are delivered to Android devices, covering various metrics like delivery success rates, delays, and reasons for message drops. This enhancement aims to empower developers with better visibility into their messaging performance. 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
|
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 a new MCP tool to fetch FCM delivery data for Android apps. The changes include adding a new API endpoint, creating the tool logic, implementing the API client function, and defining the necessary data interfaces. My review focuses on improving correctness and code quality. I've pointed out a critical bug where pagination parameters were not being sent in the API request, an issue with an incomplete data interface, and some minor code cleanup opportunities like removing unused imports. Overall, this is a great addition, and with these fixes, it will be ready to merge.
| const res = await apiClient.request<null, ListAndroidDeliveryDataResponse>({ | ||
| method: "GET", | ||
| path: `/projects/${projectId}/androidApps/${androidAppId}/deliveryData`, | ||
| headers: customHeaders, | ||
| timeout: TIMEOUT, | ||
| }); |
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.
The query parameters for pagination (pageSize and pageToken) are constructed but not passed to the API request. This will cause pagination to fail. You should add the queryParams to the apiClient.request options.
| const res = await apiClient.request<null, ListAndroidDeliveryDataResponse>({ | |
| method: "GET", | |
| path: `/projects/${projectId}/androidApps/${androidAppId}/deliveryData`, | |
| headers: customHeaders, | |
| timeout: TIMEOUT, | |
| }); | |
| const res = await apiClient.request<null, ListAndroidDeliveryDataResponse>({ | |
| method: "GET", | |
| path: `/projects/${projectId}/androidApps/${androidAppId}/deliveryData`, | |
| queryParams: params, | |
| headers: customHeaders, | |
| timeout: TIMEOUT, | |
| }); |
src/messaging/interfaces.ts
Outdated
| // TODO: where to get the date type from | ||
| // date: string; |
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.
The date field is commented out with a TODO. According to the FCM Data API documentation, this field is part of the response and has a specific object structure. It should be properly typed and included in the AndroidDeliveryData interface for type safety and correctness.
The structure is:
{
year: number;
month: number;
day: number;
}| // TODO: where to get the date type from | |
| // date: string; | |
| date: { | |
| year: number; | |
| month: number; | |
| day: number; | |
| }; |
| import { mcpError, toContent } from "../../util"; | ||
| import { getAndroidDeliveryData } from "../../../messaging/getDeliveryData"; | ||
| import { FirebaseError } from "../../../error"; | ||
| import { logger } from "../../../logger"; |
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.
There are a couple of unused imports here (mcpError and logger). It's best to remove them to keep the code clean and avoid potential confusion.
| import { mcpError, toContent } from "../../util"; | |
| import { getAndroidDeliveryData } from "../../../messaging/getDeliveryData"; | |
| import { FirebaseError } from "../../../error"; | |
| import { logger } from "../../../logger"; | |
| import { toContent } from "../../util"; | |
| import { getAndroidDeliveryData } from "../../../messaging/getDeliveryData"; | |
| import { FirebaseError } from "../../../error"; | |
src/messaging/getDeliveryData.ts
Outdated
| import { Client } from "../apiv2"; | ||
| import { logger } from "../logger"; | ||
| import { FirebaseError } from "../error"; | ||
| import { ListAndroidDeliveryDataResponse, ListAndroidDeliveryDataRequest } from "./interfaces"; |
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.
The ListAndroidDeliveryDataRequest interface is imported but not used in this file. It's good practice to remove unused imports to keep the code clean.
| import { ListAndroidDeliveryDataResponse, ListAndroidDeliveryDataRequest } from "./interfaces"; | |
| import { ListAndroidDeliveryDataResponse } from "./interfaces"; |
Adding MCP tooling for FCM's Android Data Delivery API.
This will enable developers to play around with their FCM delivery data in their Agent of choice :)