-
Notifications
You must be signed in to change notification settings - Fork 2
add new mcp tools for cloud build #76
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: main
Are you sure you want to change the base?
Conversation
|
/gemini help |
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. |
|
/gemini review |
|
/gemini summary |
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 new MCP tools for interacting with Google Cloud Build, including listing builds, getting build information, and starting new builds. The implementation is mostly solid, but there are a few issues to address. The most critical is a bug in the start_build tool where the specified location is ignored, and the build is always created in the global location. Additionally, there are some inconsistencies in tool naming between the code and the PR description, and a misleading tool description. I've also included some suggestions for improving code style and log message formatting.
| }, | ||
| }, | ||
| } | ||
| res, err := cbClient.StartBuild(ctx, args.ProjectID, source) |
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 location argument from StartBuildArgs is being ignored here. You should pass it to the cbClient.StartBuild function. This change depends on updating the StartBuild method signature in the client to accept a location.
| res, err := cbClient.StartBuild(ctx, args.ProjectID, source) | |
| res, err := cbClient.StartBuild(ctx, args.ProjectID, args.Location, source) |
| case *loggingpb.LogEntry_JsonPayload: | ||
| logMessage = fmt.Sprintf("%v", payload.JsonPayload) |
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.
Using fmt.Sprintf("%v", ...) for a JSON payload will produce the Go struct's string representation, not a valid JSON string. This can be hard to parse or read. Consider marshaling the payload to a JSON string using protojson.Marshal. You will need to add "google.golang.org/protobuf/encoding/protojson" to your imports.
case *loggingpb.LogEntry_JsonPayload:
jsonBytes, err := protojson.Marshal(payload.JsonPayload)
if err != nil {
logMessage = fmt.Sprintf("failed to marshal json payload to string: %v", err)
} else {
logMessage = string(jsonBytes)
}| } | ||
| return &mcp.CallToolResult{}, res, nil | ||
| } | ||
| mcp.AddTool(server, &mcp.Tool{Name: "cloudbuild.get_build_info", Description: "Gets information about a specific Cloud Build."}, getBuildInfoToolFunc) |
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 tool name cloudbuild.get_build_info is inconsistent with the PR description, which specifies cloudbuild.build_info. Please align the tool name for consistency.
| mcp.AddTool(server, &mcp.Tool{Name: "cloudbuild.get_build_info", Description: "Gets information about a specific Cloud Build."}, getBuildInfoToolFunc) | |
| mcp.AddTool(server, &mcp.Tool{Name: "cloudbuild.build_info", Description: "Gets information about a specific Cloud Build."}, getBuildInfoToolFunc) |
Summary of ChangesThis pull request significantly expands the capabilities of the Cloud Build integration by adding three new tools. These tools enable users to list all builds for a given project and region, retrieve detailed information about a specific build including its logs, and initiate new builds directly from Google Cloud Storage. The changes involve updating the Cloud Build client interface and implementation to support these new operations, as well as registering the corresponding tools within the system. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
|
Added tools under cloud build
cloudbuild.list_builds: List builds for the given project and regioncloudbuild.build_info: This should provide a detailed information about a given build along with build logs.cloudbuild.start: This will allow running a GCB build on a local directory.