Skip to content

Commit 73236b2

Browse files
authored
chore: Add DefaultToolOptions usage in the readme (#29)
* chore: Add DefaultToolOptions usage in the readme This change adds the usage of DefaultToolOptions in the documentation. * Update README.md * Update README.md
1 parent d5a6714 commit 73236b2

File tree

1 file changed

+41
-5
lines changed

1 file changed

+41
-5
lines changed

core/README.md

Lines changed: 41 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,25 @@ func getAuthToken() string {
316316
> tokens with longer validity periods or if the retrieval process is
317317
> resource-intensive.
318318
319-
#### Option A: Add Authentication to a Loaded Tool
319+
#### Option A: Add Default Authentication to a Client
320+
321+
You can add default tool level authentication to a client.
322+
Every tool / toolset loaded by the client will contain the auth token.
323+
324+
```go
325+
326+
ctx := context.Background()
327+
328+
client, err := core.NewToolboxClient("http://127.0.0.1:5000",
329+
core.WithDefaultToolOptions(
330+
core.WithAuthTokenString("my-auth-1", "auth-value"),
331+
),
332+
)
333+
334+
AuthTool, err := client.LoadTool("my-tool", ctx)
335+
```
336+
337+
#### Option B: Add Authentication to a Loaded Tool
320338

321339
You can add the token retriever function to a tool object *after* it has been
322340
loaded. This modifies the specific tool instance.
@@ -335,7 +353,7 @@ AuthTool, err := tool.ToolFrom(
335353
)
336354
```
337355

338-
#### Option B: Add Authentication While Loading Tools
356+
#### Option C: Add Authentication While Loading Tools
339357

340358
You can provide the token retriever(s) directly during the `LoadTool` or
341359
`LoadToolset` calls. This applies the authentication configuration only to the
@@ -412,7 +430,25 @@ fixed and will not be requested or modified by the LLM during tool use.
412430
> You do not need to modify the tool's configuration in the Toolbox service to
413431
> bind parameter values using the SDK.
414432
415-
### Option A: Binding Parameters to a Loaded Tool
433+
#### Option A: Add Default Bound Parameters to a Client
434+
435+
You can add default tool level bound parameters to a client. Every tool / toolset
436+
loaded by the client will have the bound parameter.
437+
438+
```go
439+
440+
ctx := context.Background()
441+
442+
client, err := core.NewToolboxClient("http://127.0.0.1:5000",
443+
core.WithDefaultToolOptions(
444+
core.WithBindParamString("param1", "value"),
445+
),
446+
)
447+
448+
boundTool, err := client.LoadTool("my-tool", ctx)
449+
```
450+
451+
### Option B: Binding Parameters to a Loaded Tool
416452

417453
Bind values to a tool object *after* it has been loaded. This modifies the
418454
specific tool instance.
@@ -428,7 +464,7 @@ boundTool, err := tool.ToolFrom(
428464
)
429465
```
430466

431-
### Option B: Binding Parameters While Loading Tools
467+
### Option C: Binding Parameters While Loading Tools
432468

433469
Specify bound parameters directly when loading tools. This applies the binding
434470
only to the tools loaded in that specific call.
@@ -472,4 +508,4 @@ This project is licensed under the Apache License 2.0. See the
472508

473509
# Support
474510

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

0 commit comments

Comments
 (0)