-
Notifications
You must be signed in to change notification settings - Fork 1.1k
MCP: Add --generate-resource-list option #9255
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
Conversation
Summary of ChangesHello @kevinthecheung, 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 enhances the 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 adds a new --generate-resource-list
command-line option to the MCP server, which prints a markdown table of available resources. The implementation follows the pattern of existing generator options. I've provided a few suggestions to improve maintainability and fix a minor typo in the generated documentation.
src/mcp/README.md
Outdated
| crashlytics_update_issue | crashlytics | Use this to update the state of Crashlytics issue. | | ||
| apphosting_fetch_logs | apphosting | Use this to fetch the most recent logs for a specified App Hosting backend. If `buildLogs` is specified, the logs from the build process for the latest build are returned. The most recent logs are listed first. | | ||
| apphosting_list_backends | apphosting | Use this to retrieve a list of App Hosting backends in the current project. An empty list means that there are no backends. The `uri` is the public URL of the backend. A working backend will have a `managed_resources` array that will contain a `run_service` entry. That `run_service.service` is the resource name of the Cloud Run service serving the App Hosting backend. The last segment of that name is the service ID. `domains` is the list of domains that are associated with the backend. They either have type `CUSTOM` or `DEFAULT`. Every backend should have a `DEFAULT` domain. The actual domain that a user would use to conenct to the backend is the last parameter of the domain resource name. If a custom domain is correctly set up, it will have statuses ending in `ACTIVE`. | | ||
| apphosting_list_backends | apphosting | Use this to retrieve a list of App Hosting backends in the current project. An empty list means that there are no backends. The `uri` is the public URL of the backend. A working backend will have a `managed_resources` array that will contain a `run_service` entry. That `run_service.service` is the resource name of the Cloud Run service serving the App Hosting backend. The last segment of that name is the service ID. `domains` is the list of domains that are associated with the backend. They either have type `CUSTOM` or `DEFAULT`. Every backend should have a `DEFAULT` domain. The actual domain that a user would use to conenct to the backend is the last parameter of the domain resource name. If a custom domain is correctly set up, it will have statuses ending in `ACTIVE`. | |
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's a typo conenct
which should be connect
. Also, there are multiple spaces between sentences (e.g., ... 'DEFAULT'. Every ...
). While markdown collapses most whitespace, it's better to have a single space for source readability and to avoid unintended formatting.
| apphosting_list_backends | apphosting | Use this to retrieve a list of App Hosting backends in the current project. An empty list means that there are no backends. The `uri` is the public URL of the backend. A working backend will have a `managed_resources` array that will contain a `run_service` entry. That `run_service.service` is the resource name of the Cloud Run service serving the App Hosting backend. The last segment of that name is the service ID. `domains` is the list of domains that are associated with the backend. They either have type `CUSTOM` or `DEFAULT`. Every backend should have a `DEFAULT` domain. The actual domain that a user would use to conenct to the backend is the last parameter of the domain resource name. If a custom domain is correctly set up, it will have statuses ending in `ACTIVE`. | | |
| apphosting_list_backends | apphosting | Use this to retrieve a list of App Hosting backends in the current project. An empty list means that there are no backends. The `uri` is the public URL of the backend. A working backend will have a `managed_resources` array that will contain a `run_service` entry. That `run_service.service` is the resource name of the Cloud Run service serving the App Hosting backend. The last segment of that name is the service ID. `domains` is the list of domains that are associated with the backend. They either have type `CUSTOM` or `DEFAULT`. Every backend should have a `DEFAULT` domain. The actual domain that a user would use to connect to the backend is the last parameter of the domain resource name. If a custom domain is correctly set up, it will have statuses ending in `ACTIVE`. | |
export function markdownDocsOfResources(): string { | ||
const allResources = [...resources, ...resourceTemplates]; | ||
const headings = ` | ||
| Resource Name | Description | | ||
| ------------- | ----------- |`; | ||
const resourceRows = allResources.map((res) => { | ||
let desc = res.mcp.title ? `${res.mcp.title}: ` : ""; | ||
desc += res.mcp.description || ""; | ||
desc = desc.replaceAll("\n", "<br>"); | ||
return ` | ||
| ${res.mcp.name} | ${desc} |`; | ||
}); | ||
return headings + resourceRows.join(""); | ||
} |
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.
This function can be written more clearly to build the markdown table. Using an array of lines and then joining them with a newline character is a more common and readable pattern than concatenating strings with embedded newlines.
export function markdownDocsOfResources(): string {
const allResources = [...resources, ...resourceTemplates];
const header = [
"| Resource Name | Description |".
"| ------------- | ----------- |",
];
const resourceRows = allResources.map((res) => {
let desc = res.mcp.title ? `${res.mcp.title}: ` : "";
desc += res.mcp.description || "";
desc = desc.replaceAll("\n", "<br>");
return `| ${res.mcp.name} | ${desc} |`;
});
return [...header, ...resourceRows].join("\n");
}
Description
Scenarios Tested
Sample Commands