mirror of
https://github.com/googleapis/genai-toolbox.git
synced 2026-02-01 10:44:58 -05:00
Compare commits
9 Commits
processing
...
migrate-go
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
be98d1337e | ||
|
|
4aed8b5bcb | ||
|
|
51a1f71c59 | ||
|
|
4928f0be8f | ||
|
|
0cb3ad9026 | ||
|
|
290cba0f1e | ||
|
|
047def93ef | ||
|
|
875b5277e3 | ||
|
|
a29f9e5484 |
25
docs/en/sdks/JS-sdk/_index.md
Normal file
25
docs/en/sdks/JS-sdk/_index.md
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
---
|
||||||
|
title: "JS SDK"
|
||||||
|
type: docs
|
||||||
|
weight: 7
|
||||||
|
description: >
|
||||||
|
JS SDKs to connect to the MCP Toolbox server.
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
## Overview
|
||||||
|
|
||||||
|
The MCP Toolbox service provides a centralized way to manage and expose tools
|
||||||
|
(like API connectors, database query tools, etc.) for use by GenAI applications.
|
||||||
|
|
||||||
|
These JS SDKs act as clients for that service. They handle the communication needed to:
|
||||||
|
|
||||||
|
* Fetch tool definitions from your running Toolbox instance.
|
||||||
|
* Provide convenient JS objects or functions representing those tools.
|
||||||
|
* Invoke the tools (calling the underlying APIs/services configured in Toolbox).
|
||||||
|
* Handle authentication and parameter binding as needed.
|
||||||
|
|
||||||
|
By using these SDKs, you can easily leverage your Toolbox-managed tools directly
|
||||||
|
within your JS applications or AI orchestration frameworks.
|
||||||
|
|
||||||
|
[Github](https://github.com/googleapis/mcp-toolbox-sdk-js)
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
---
|
|
||||||
title: "Go SDK"
|
|
||||||
weight: 2
|
|
||||||
description: Go lang client SDK
|
|
||||||
icon: fa-brands fa-golang
|
|
||||||
manualLink: "https://github.com/googleapis/mcp-toolbox-sdk-go"
|
|
||||||
manualLinkTarget: _blank
|
|
||||||
---
|
|
||||||
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<link rel="canonical" href="https://github.com/googleapis/mcp-toolbox-sdk-go"/>
|
|
||||||
<meta http-equiv="refresh" content="0;url=https://github.com/googleapis/mcp-toolbox-sdk-go"/>
|
|
||||||
</head>
|
|
||||||
</html>
|
|
||||||
114
docs/en/sdks/go-sdk/_index.md
Normal file
114
docs/en/sdks/go-sdk/_index.md
Normal file
@@ -0,0 +1,114 @@
|
|||||||
|
---
|
||||||
|
title: "Go SDK"
|
||||||
|
type: docs
|
||||||
|
weight: 7
|
||||||
|
description: >
|
||||||
|
Go SDKs to connect to the MCP Toolbox server.
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
## Overview
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
# MCP Toolbox SDKs for Go
|
||||||
|
|
||||||
|
[](https://opensource.org/licenses/Apache-2.0)
|
||||||
|
[](https://googleapis.github.io/genai-toolbox/)
|
||||||
|
[](https://discord.gg/Dmm69peqjh)
|
||||||
|
[](https://medium.com/@mcp_toolbox)
|
||||||
|
[](https://goreportcard.com/report/github.com/googleapis/mcp-toolbox-sdk-go)
|
||||||
|
[](https://img.shields.io/github/v/release/googleapis/mcp-toolbox-sdk-go)
|
||||||
|
[](https://img.shields.io/github/go-mod/go-version/googleapis/mcp-toolbox-sdk-go)
|
||||||
|
|
||||||
|
This repository contains the Go SDK designed to seamlessly integrate the
|
||||||
|
functionalities of the [MCP
|
||||||
|
Toolbox](https://github.com/googleapis/genai-toolbox) into your Gen AI
|
||||||
|
applications. The SDK allow you to load tools defined in Toolbox and use them
|
||||||
|
as standard Go tools within popular orchestration frameworks
|
||||||
|
or your custom code.
|
||||||
|
|
||||||
|
This simplifies the process of incorporating external functionalities (like
|
||||||
|
Databases or APIs) managed by Toolbox into your GenAI applications.
|
||||||
|
|
||||||
|
<!-- TOC -->
|
||||||
|
|
||||||
|
- [Overview](#overview)
|
||||||
|
- [Which Package Should I Use?](#which-package-should-i-use)
|
||||||
|
- [Available Packages](#available-packages)
|
||||||
|
- [Getting Started](#getting-started)
|
||||||
|
|
||||||
|
<!-- /TOC -->
|
||||||
|
|
||||||
|
## Overview
|
||||||
|
|
||||||
|
The MCP Toolbox service provides a centralized way to manage and expose tools
|
||||||
|
(like API connectors, database query tools, etc.) for use by GenAI applications.
|
||||||
|
|
||||||
|
The Go SDK act as clients for that service. They handle the communication needed to:
|
||||||
|
|
||||||
|
* Fetch tool definitions from your running Toolbox instance.
|
||||||
|
* Provide convenient Go structs representing those tools.
|
||||||
|
* Invoke the tools (calling the underlying APIs/services configured in Toolbox).
|
||||||
|
* Handle authentication and parameter binding as needed.
|
||||||
|
|
||||||
|
By using the SDK, you can easily leverage your Toolbox-managed tools directly
|
||||||
|
within your Go applications or AI orchestration frameworks.
|
||||||
|
|
||||||
|
## Which Package Should I Use?
|
||||||
|
|
||||||
|
Choosing the right package depends on how you are building your application:
|
||||||
|
|
||||||
|
- [`core`](https://github.com/googleapis/mcp-toolbox-sdk-go/tree/main/core):
|
||||||
|
This is a framework agnostic way to connect the tools to popular frameworks
|
||||||
|
like Google GenAI, LangChain, etc.
|
||||||
|
|
||||||
|
- [`tbadk`](https://github.com/googleapis/mcp-toolbox-sdk-go/tree/main/tbadk):
|
||||||
|
This package provides a way to connect tools to ADK Go.
|
||||||
|
|
||||||
|
- [`tbgenkit`](https://github.com/googleapis/mcp-toolbox-sdk-go/tree/main/tbgenkit):
|
||||||
|
This package provides a functionality to convert the Tool fetched using the core package
|
||||||
|
into a Genkit Go compatible tool.
|
||||||
|
|
||||||
|
## Available Packages
|
||||||
|
|
||||||
|
This repository hosts the following Go packages. See the package-specific
|
||||||
|
README for detailed installation and usage instructions:
|
||||||
|
|
||||||
|
| Package | Target Use Case | Integration | Path | Details (README) |
|
||||||
|
| :------ | :----------| :---------- | :---------------------- | :---------- |
|
||||||
|
| `core` | Framework-agnostic / Custom applications | Use directly / Custom | `core/` | 📄 [View README](https://github.com/googleapis/mcp-toolbox-sdk-go/blob/main/core/README.md) |
|
||||||
|
| `tbadk` | ADK Go | Use directly | `tbadk/` | 📄 [View README](https://github.com/googleapis/mcp-toolbox-sdk-go/blob/main/tbadk/README.md) |
|
||||||
|
| `tbgenkit` | Genkit Go | Along with core | `tbgenkit/` | 📄 [View README](https://github.com/googleapis/mcp-toolbox-sdk-go/blob/main/tbgenkit/README.md) |
|
||||||
|
|
||||||
|
## Getting Started
|
||||||
|
|
||||||
|
To get started using Toolbox tools with an application, follow these general steps:
|
||||||
|
|
||||||
|
1. **Set up and Run the Toolbox Service:**
|
||||||
|
|
||||||
|
Before using the SDKs, you need the MCP Toolbox server running. Follow
|
||||||
|
the instructions here: [**Toolbox Getting Started
|
||||||
|
Guide**](https://github.com/googleapis/genai-toolbox?tab=readme-ov-file#getting-started)
|
||||||
|
|
||||||
|
2. **Install the Appropriate SDK:**
|
||||||
|
|
||||||
|
Choose the package based on your needs (see "[Which Package Should I Use?](#which-package-should-i-use)" above)
|
||||||
|
Use this command to install the SDK module
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# For the core, framework-agnostic SDK
|
||||||
|
go get github.com/googleapis/mcp-toolbox-sdk-go
|
||||||
|
```
|
||||||
|
|
||||||
|
3. **Use the SDK:**
|
||||||
|
|
||||||
|
Consult the README for your chosen package (linked in the "[Available
|
||||||
|
Packages](#available-packages)" section above) for detailed instructions on
|
||||||
|
how to connect the client, load tool definitions, invoke tools, configure
|
||||||
|
authentication/binding, and integrate them into your application or
|
||||||
|
framework.
|
||||||
|
|
||||||
|
[Github](https://github.com/googleapis/mcp-toolbox-sdk-go)
|
||||||
148
docs/en/sdks/go-sdk/tbgenkit/_index.md
Normal file
148
docs/en/sdks/go-sdk/tbgenkit/_index.md
Normal file
@@ -0,0 +1,148 @@
|
|||||||
|
---
|
||||||
|
title: "tbGenkit Package"
|
||||||
|
linkTitle: "tbGenkit"
|
||||||
|
type: docs
|
||||||
|
weight: 1
|
||||||
|
---
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
# MCP Toolbox TBGenkit Package
|
||||||
|
|
||||||
|
[](https://opensource.org/licenses/Apache-2.0)
|
||||||
|
|
||||||
|
This package allows you to seamlessly integrate the functionalities of
|
||||||
|
[Toolbox](https://github.com/googleapis/genai-toolbox) allowing you to load and
|
||||||
|
use tools defined in the service as standard Genkit Tools within your Genkit Go
|
||||||
|
applications.
|
||||||
|
|
||||||
|
This simplifies integrating external functionalities (like APIs, databases, or
|
||||||
|
custom logic) managed by the Toolbox into your workflows, especially those
|
||||||
|
involving Large Language Models (LLMs).
|
||||||
|
|
||||||
|
|
||||||
|
<!-- TOC ignore:true -->
|
||||||
|
<!-- TOC -->
|
||||||
|
|
||||||
|
- [Installation](#installation)
|
||||||
|
- [Quickstart](#quickstart)
|
||||||
|
- [Convert Toolbox Tool to a Genkit Tool](#convert-toolbox-tool-to-a-genkit-tool)
|
||||||
|
- [Contributing](#contributing)
|
||||||
|
- [License](#license)
|
||||||
|
- [Support](#support)
|
||||||
|
- [Samples for Reference](#samples-for-reference)
|
||||||
|
<!-- /TOC -->
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
```bash
|
||||||
|
go get github.com/googleapis/mcp-toolbox-sdk-go
|
||||||
|
```
|
||||||
|
This SDK is supported on Go version 1.24.4 and higher.
|
||||||
|
|
||||||
|
## Quickstart
|
||||||
|
|
||||||
|
For more information on how to load a ToolboxTool, see [the core package](https://github.com/googleapis/mcp-toolbox-sdk-go/tree/main/core)
|
||||||
|
|
||||||
|
## Convert Toolbox Tool to a Genkit Tool
|
||||||
|
|
||||||
|
```go
|
||||||
|
"github.com/googleapis/mcp-toolbox-sdk-go/tbgenkit"
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
// Assuming the toolbox tool is loaded
|
||||||
|
// Make sure to add error checks for debugging
|
||||||
|
ctx := context.Background()
|
||||||
|
g, err := genkit.Init(ctx)
|
||||||
|
|
||||||
|
genkitTool, err := tbgenkit.ToGenkitTool(toolboxTool, g)
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
For end-to-end example on how to use Toolbox with Genkit Go, check out the [/samples/](https://github.com/googleapis/mcp-toolbox-sdk-go/tree/main/tbgenkit/samples) folder
|
||||||
|
|
||||||
|
# Contributing
|
||||||
|
|
||||||
|
Contributions are welcome! Please refer to the [DEVELOPER.md](/DEVELOPER.md)
|
||||||
|
file for guidelines on how to set up a development environment and run tests.
|
||||||
|
|
||||||
|
# License
|
||||||
|
|
||||||
|
This project is licensed under the Apache License 2.0. See the
|
||||||
|
[LICENSE](https://github.com/googleapis/mcp-toolbox-sdk-go/blob/main/LICENSE) file for details.
|
||||||
|
|
||||||
|
# Support
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>Genkit Go</summary>
|
||||||
|
|
||||||
|
```go
|
||||||
|
//This sample contains a complete example on how to integrate MCP Toolbox Go SDK with Genkit Go using the tbgenkit package.
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"fmt"
|
||||||
|
"log"
|
||||||
|
|
||||||
|
"github.com/googleapis/mcp-toolbox-sdk-go/core"
|
||||||
|
"github.com/googleapis/mcp-toolbox-sdk-go/tbgenkit"
|
||||||
|
|
||||||
|
"github.com/firebase/genkit/go/ai"
|
||||||
|
"github.com/firebase/genkit/go/genkit"
|
||||||
|
"github.com/firebase/genkit/go/plugins/googlegenai"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
ctx := context.Background()
|
||||||
|
toolboxClient, err := core.NewToolboxClient("http://127.0.0.1:5000")
|
||||||
|
if err != nil {
|
||||||
|
log.Fatalf("Failed to create Toolbox client: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Load the tools using the MCP Toolbox SDK.
|
||||||
|
tools, err := toolboxClient.LoadToolset("my-toolset", ctx)
|
||||||
|
if err != nil {
|
||||||
|
log.Fatalf("Failed to load tools: %v\nMake sure your Toolbox server is running and the tool is configured.", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Initialize genkit
|
||||||
|
g := genkit.Init(ctx,
|
||||||
|
genkit.WithPlugins(&googlegenai.GoogleAI{}),
|
||||||
|
genkit.WithDefaultModel("googleai/gemini-1.5-flash"),
|
||||||
|
)
|
||||||
|
|
||||||
|
// Convert your tool to a Genkit tool.
|
||||||
|
genkitTools := make([]ai.Tool, len(tools))
|
||||||
|
for i, tool := range tools {
|
||||||
|
newTool, err := tbgenkit.ToGenkitTool(tool, g)
|
||||||
|
if err != nil {
|
||||||
|
log.Fatalf("Failed to convert tool: %v\n", err)
|
||||||
|
}
|
||||||
|
genkitTools[i] = newTool
|
||||||
|
}
|
||||||
|
|
||||||
|
toolRefs := make([]ai.ToolRef, len(genkitTools))
|
||||||
|
|
||||||
|
for i, tool := range genkitTools {
|
||||||
|
toolRefs[i] = tool
|
||||||
|
}
|
||||||
|
|
||||||
|
// Generate llm response using prompts and tools.
|
||||||
|
resp, err := genkit.Generate(ctx, g,
|
||||||
|
ai.WithPrompt("Find hotels in Basel with Basel in it's name."),
|
||||||
|
ai.WithTools(toolRefs...),
|
||||||
|
)
|
||||||
|
if err != nil {
|
||||||
|
log.Fatalf("%v\n", err)
|
||||||
|
}
|
||||||
|
fmt.Println(resp.Text())
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
</details>
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
---
|
|
||||||
title: "JS SDK"
|
|
||||||
weight: 2
|
|
||||||
description: Javascript client SDK
|
|
||||||
icon: fa-brands fa-node-js
|
|
||||||
manualLink: "https://github.com/googleapis/mcp-toolbox-sdk-js"
|
|
||||||
manualLinkTarget: _blank
|
|
||||||
---
|
|
||||||
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<link rel="canonical" href="https://github.com/googleapis/mcp-toolbox-sdk-js"/>
|
|
||||||
<meta http-equiv="refresh" content="0;url=https://github.com/googleapis/mcp-toolbox-sdk-js"/>
|
|
||||||
</head>
|
|
||||||
</html>
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
---
|
|
||||||
title: "Python SDK"
|
|
||||||
weight: 2
|
|
||||||
description: Python client SDK
|
|
||||||
icon: fa-brands fa-python
|
|
||||||
manualLink: "https://github.com/googleapis/mcp-toolbox-sdk-python"
|
|
||||||
manualLinkTarget: _blank
|
|
||||||
---
|
|
||||||
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<link rel="canonical" href="https://github.com/googleapis/mcp-toolbox-sdk-python"/>
|
|
||||||
<meta http-equiv="refresh" content="0;url=https://github.com/googleapis/mcp-toolbox-sdk-python"/>
|
|
||||||
</head>
|
|
||||||
</html>
|
|
||||||
25
docs/en/sdks/python-sdk/_index.md
Normal file
25
docs/en/sdks/python-sdk/_index.md
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
---
|
||||||
|
title: "Python SDK"
|
||||||
|
type: docs
|
||||||
|
weight: 7
|
||||||
|
description: >
|
||||||
|
Python SDKs to connect to the MCP Toolbox server.
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
## Overview
|
||||||
|
|
||||||
|
The MCP Toolbox service provides a centralized way to manage and expose tools
|
||||||
|
(like API connectors, database query tools, etc.) for use by GenAI applications.
|
||||||
|
|
||||||
|
These Python SDKs act as clients for that service. They handle the communication needed to:
|
||||||
|
|
||||||
|
* Fetch tool definitions from your running Toolbox instance.
|
||||||
|
* Provide convenient Python objects or functions representing those tools.
|
||||||
|
* Invoke the tools (calling the underlying APIs/services configured in Toolbox).
|
||||||
|
* Handle authentication and parameter binding as needed.
|
||||||
|
|
||||||
|
By using these SDKs, you can easily leverage your Toolbox-managed tools directly
|
||||||
|
within your Python applications or AI orchestration frameworks.
|
||||||
|
|
||||||
|
[Github](https://github.com/googleapis/mcp-toolbox-sdk-python)
|
||||||
Reference in New Issue
Block a user