feat: Add support for HTTP Tool pathParams (#726)

Allow users to specify dynamic path for HTTP tools.

fix: https://github.com/googleapis/genai-toolbox/issues/680
This commit is contained in:
Wenxin Du
2025-06-20 14:53:49 -04:00
committed by GitHub
parent 4827771b78
commit fd300dc606
4 changed files with 133 additions and 50 deletions

View File

@@ -16,7 +16,12 @@ Toolbox allows you to configure the request URL, method, headers, query paramete
### URL
An HTTP request URL identifies the target the client wants to access.
Toolbox composes the request URL from the HTTP Source's `baseUrl` and the HTTP Tool's `path`.
Toolbox composes the request URL from 3 places:
1. The HTTP Source's `baseUrl`.
2. The HTTP Tool's `path` field.
3. The HTTP Tool's `pathParams` for dynamic path composed during Tool invocation.
For example, the following config allows you to reach different paths of the same server using multiple Tools:
```yaml
@@ -39,6 +44,17 @@ tools:
method: GET
path: /search
description: Tool to search information from the example API
my-dynamic-path-tool:
kind: http
source: my-http-source
method: GET
path: /{{.myPathParam}}/search
description: Tool to reach endpoint based on the input to `myPathParam`
pathParams:
- name: myPathParam
type: string
description: The dynamic path parameter
```