Skip to content

Conversation

@AnmolShukla2002
Copy link
Contributor

No description provided.

@AnmolShukla2002 AnmolShukla2002 requested a review from a team as a code owner January 19, 2026 09:20
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @AnmolShukla2002, 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 significantly enhances the documentation for the MCP Toolbox Go SDK's core package. It provides developers with a centralized and comprehensive resource for understanding the SDK's capabilities, from basic setup and tool interaction to advanced topics like secure authentication mechanisms and flexible parameter binding. Furthermore, it offers ready-to-use integration samples for leading AI orchestration frameworks, streamlining the development of intelligent applications using the Toolbox.

Highlights

  • Comprehensive Go SDK Documentation: Introduces a new, detailed documentation page for the MCP Toolbox Go SDK's core package, covering installation, usage, and advanced features.
  • Authentication Guides: Provides in-depth guidance on both client-to-server authentication (e.g., for Cloud Run deployments) and tool-level authentication, including token retrieval and configuration options.
  • Parameter Binding Functionality: Explains how to bind static or dynamic values to tool parameters, enhancing security and control over tool invocation.
  • Orchestration Framework Integration Samples: Includes practical code examples demonstrating how to integrate the Go SDK with popular AI orchestration frameworks like Google GenAI, LangChain Go, and OpenAI Go.

🧠 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.

Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a 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 extensive documentation and samples for the Go SDK core package. The documentation is comprehensive, but I've found several issues in the code samples, including incomplete examples, incorrect API usage, unhandled errors, and typos. These issues could confuse users or cause their code to fail if they copy the examples. I've left specific comments with suggestions for fixes. Addressing these will greatly improve the quality and usability of the documentation.

}

var schema *genai.Schema
_ = json.Unmarshal(inputschema, &schema)
Copy link
Contributor

Choose a reason for hiding this comment

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

high

The error returned by json.Unmarshal is ignored by assigning it to the blank identifier _. This is a bad practice as it can hide issues with JSON parsing, potentially leading to a nil schema and causing nil pointer dereferences later. The error should be checked.

Suggested change
_ = json.Unmarshal(inputschema, &schema)
if err := json.Unmarshal(inputschema, &schema); err != nil {
log.Printf("failed to unmarshal schema: %v", err)
return &genai.Tool{}
}



```go
import "github.com/googleapis/mcp-toolbox-sdk-go/core"
Copy link
Contributor

Choose a reason for hiding this comment

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

high

This code example is incomplete as it uses the oauth2 package without importing it. Please add the import for golang.org/x/oauth2 to make the example runnable.

Suggested change
import "github.com/googleapis/mcp-toolbox-sdk-go/core"
import (
"github.com/googleapis/mcp-toolbox-sdk-go/core"
"golang.org/x/oauth2"
)

Comment on lines +311 to +315
token, err := core.GetGoogleIDToken(ctx, URL)

client, err := core.NewToolboxClient(
URL,
core.WithClientHeaderString("Authorization", token),
Copy link
Contributor

Choose a reason for hiding this comment

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

high

This code snippet has a couple of issues:

  1. The URL variable is used but not defined. It should be replaced with a placeholder to make it clear to the user.
  2. The Authorization header for a bearer token should be in the format "Bearer <token>". The current example is missing the "Bearer " prefix, which will lead to authentication failures.
Suggested change
token, err := core.GetGoogleIDToken(ctx, URL)
client, err := core.NewToolboxClient(
URL,
core.WithClientHeaderString("Authorization", token),
token, err := core.GetGoogleIDToken(ctx, "your-cloud-run-url")
client, err := core.NewToolboxClient(
"your-cloud-run-url",
core.WithClientHeaderString("Authorization", "Bearer "+token),

tool, err := client.LoadTool("my-tool", ctx)

AuthTool, err := tool.ToolFrom(
core.WithAuthTokenSource("my-auth", headerTokenSource),
Copy link
Contributor

Choose a reason for hiding this comment

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

high

This code example is incomplete. The headerTokenSource variable is used in core.WithAuthTokenSource but it is not defined anywhere in the snippet. Please define it to make the example complete and runnable for users.

log.Fatal("Could not invoke tool", err)
}

params.Messages = append(params.Messages, openai.ToolMessage(result.(string), toolCall.ID))
Copy link
Contributor

Choose a reason for hiding this comment

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

high

The type assertion result.(string) is unsafe and will cause a panic if the result from tool.Invoke is not a string. The Invoke method returns any, so its type is not guaranteed. It's safer to convert the result to a string using fmt.Sprintf to avoid a panic.

Suggested change
params.Messages = append(params.Messages, openai.ToolMessage(result.(string), toolCall.ID))
params.Messages = append(params.Messages, openai.ToolMessage(fmt.Sprintf("%v", result), toolCall.ID))

// Load the tools using the MCP Toolbox SDK.
tools, err := toolboxClient.LoadToolset("my-toolset", ctx)
if err != nil {
log.Fatalf("Failed to load tool : %v\nMake sure your Toolbox server is running and the tool is configured.", err)
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

There is a minor typo in the log message: an extra space before the colon.

Suggested change
log.Fatalf("Failed to load tool : %v\nMake sure your Toolbox server is running and the tool is configured.", err)
log.Fatalf("Failed to load tool: %v\nMake sure your Toolbox server is running and the tool is configured.", err)

toolsMap[tool.Name()] = tool

}
question := "Find hotels in Basel with Basel in it's name "
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

There's a grammatical error ("it's" should be "its") and a trailing space in the question string.

Suggested change
question := "Find hotels in Basel with Basel in it's name "
question := "Find hotels in Basel with Basel in its name"

// Make initial chat completion request
completion, err := openAIClient.Chat.Completions.New(ctx, params)
if err != nil {
panic(err)
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

This example uses panic(err) for error handling, which is generally discouraged in Go applications unless it's a truly unrecoverable state during initialization. It's also inconsistent with other parts of the example that use log.Fatal. Using log.Fatalf would be more idiomatic and consistent for a main function.

Suggested change
panic(err)
log.Fatalf("Chat completion failed: %v", err)

return
}

// If there is a was a function call, continue the conversation
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

There's a typo in this comment: "is a was a" should probably be "was a".

Suggested change
// If there is a was a function call, continue the conversation
// If there was a function call, continue the conversation

```

> [!NOTE]
> Adding auth tokens during loading only affect the tools loaded within that
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

There is a small grammatical error here. "affect" should be "affects".

Suggested change
> Adding auth tokens during loading only affect the tools loaded within that
> Adding auth tokens during loading only affects the tools loaded within that

@github-actions
Copy link
Contributor

Copy link
Contributor

@anubhav756 anubhav756 left a comment

Choose a reason for hiding this comment

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

Can we have major sections added as separate pages under the SDKs' sections?

@anubhav756
Copy link
Contributor

There seem to be links to the READMEs of individual packages in the top-level doc (screenshot). Can we have them linked to this docsite?

Comment on lines +73 to +75
> [!NOTE]
>
> - While the SDK itself is synchronous, you can execute its functions within goroutines to achieve asynchronous behavior.
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we make the notes render according to hugo/docsy way (check notes/tips in other docs)?

This renders well in github but doesn't work with docsy.

Comment on lines +73 to +75
> [!NOTE]
>
> - While the SDK itself is synchronous, you can execute its functions within goroutines to achieve asynchronous behavior.
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we make the notes render according to hugo/docsy way (check notes/tips in other docs)?

This renders well in github but doesn't work with docsy.

Same for other notes/warnings/tips below.


If you encounter issues or have questions, check the existing [GitHub Issues](https://github.com/googleapis/genai-toolbox/issues) for the main Toolbox project.

## Samples for Reference
Copy link
Contributor

Choose a reason for hiding this comment

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

Could there be a better way for presenting this? How about linking a github repo directory with these samples (so users can use the code review/hover features as well)?

Might also be simpler for samples testing, but I'd leave the final call to you.

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