-
Notifications
You must be signed in to change notification settings - Fork 528
Description
Describe the bug
When trying to use a tool in the Genkit UI, the tool appears with the name local/toolName
and the /
is not accepted as a valid character in the tool name.
Error:
Internal Server Error: client error. Code: 400, Message: * GenerateContentRequest.tools[0].function_declarations[0].name: Invalid function name. Must start with a letter or an underscore. Must be alphameric (a-z, A-Z, 0-9), underscores (_), dots (.) or dashes (-), with a maximum length of 64. , Status: INVALID_ARGUMENT, Details: []
To Reproduce
When defining a new tool (in Go) models can correctly use them in code, so it's only needed to load the google-ai plugin and run Genkit
Btw: I am using air
for Go to help with the hot-reloading.
package main
import (
"context"
"fmt"
"log"
// Import Genkit and the Google AI plugin
"github.com/firebase/genkit/go/ai"
"github.com/firebase/genkit/go/genkit"
"github.com/firebase/genkit/go/plugins/googlegenai"
)
func main() {
ctx := context.Background()
fmt.Println("Initializing attempt to create `stocky`")
g, err := genkit.Init(ctx, genkit.WithPlugins(&googlegenai.GoogleAI{}))
if err != nil {
log.Fatal(err)
}
type WeatherToolForm struct {
City string
}
weatherTool := genkit.DefineTool(
g,
"getWeather",
"Fetches the weather for a given city",
func(ctx *ai.ToolContext, form WeatherToolForm) (string, error) {
log.Printf("Tool: Fetching weather for %s", form.City)
if form.City == "Paris" {
return "Sunny, 25°C", nil
}
return "Cloudy, 18°C", nil
},
)
<-ctx.Done()
}
Expected behavior
I expected to see that the Genkit UI would not try to create an invalid tool name
Screenshots

Runtime (please complete the following information):
- OS: MacOS
- Version 15.3.2
** Go version
- go version go1.24.1 darwin/arm64

Metadata
Metadata
Assignees
Labels
Type
Projects
Status