- HTTP request
- Path parameters
- Request body
- Response body
- Authorization scopes
- IAM Permissions
- MockConfig
- MockedToolCall
- MockConfig.UnmatchedToolCallBehavior
Executes the given tool with the given arguments.
HTTP request
POST https://ces.googleapis.com/v1/{parent=projects/*/locations/*/apps/*}:executeTool
The URL uses gRPC Transcoding syntax.
Path parameters
| Parameters | |
|---|---|
parent |
Required. The resource name of the app which the tool/toolset belongs to. Format: |
Request body
The request body contains data with the following structure:
| JSON representation |
|---|
{ "args": { object }, "mockConfig": { object ( |
| Fields | |
|---|---|
args |
Optional. The input parameters and values for the tool in JSON object format. |
mockConfig |
Optional. Mock configuration for the tool execution. If this field is set, tools that call other tools will be mocked based on the provided patterns and responses. |
| The identifier of the tool to execute. It could be either a persisted tool or a tool from a toolset. The following is a list of mutually exclusive fields. At most one of the fields will be set in a response: | |
tool |
Optional. The name of the tool to execute. Format: projects/{project}/locations/{location}/apps/{app}/tools/{tool} |
toolsetTool |
Optional. The toolset tool to execute. Only one tool should match the predicate from the toolset. Otherwise, an error will be returned. |
| End of mutually exclusive fields. | |
| Additional context to be provided for the tool execution The following is a list of mutually exclusive fields. At most one of the fields will be set in a response: | |
variables |
Optional. The variables that are available for the tool execution. |
context |
Optional. The [ToolCallContext](https://docs.cloud.google.com/customer-engagement-ai/conversational-agents/ps/tool/python#environment for details) to be passed to the Python tool. |
| End of mutually exclusive fields. | |
Response body
Response message for ToolService.ExecuteTool.
If successful, the response body contains data with the following structure:
| JSON representation |
|---|
{ "response": { object }, "variables": { object }, "citations": { object ( |
| Fields | |
|---|---|
response |
The tool execution result in JSON object format. Use "output" key to specify tool response and "error" key to specify error details (if any). If "output" and "error" keys are not specified, then whole "response" is treated as tool execution result. |
variables |
The variable values at the end of the tool execution. |
citations |
Citations that provide the source information for the tool's execution. |
googleSearchSuggestions |
The suggestions returned from Google Search as a result of invoking the Google Search Tool during the tool execution. |
| The identifier of the tool that got executed. The following is a list of mutually exclusive fields. At most one of the fields will be set in a response: | |
tool |
The name of the tool that got executed. Format: |
toolsetTool |
The toolset tool that got executed. |
| End of mutually exclusive fields. | |
Authorization scopes
Requires one of the following OAuth scopes:
https://www.googleapis.com/auth/cloud-platformhttps://www.googleapis.com/auth/ces
For more information, see the Authentication Overview.
IAM Permissions
Requires the following IAM permission on the parent resource:
ces.tools.execute
For more information, see the IAM documentation.
MockConfig
Mock tool calls configuration for the session.
| JSON representation |
|---|
{ "mockedToolCalls": [ { object ( |
| Fields | |
|---|---|
mockedToolCalls[] |
Optional. All tool calls to mock for the duration of the session. |
unmatchedToolCallBehavior |
Required. Beavhior for tool calls that don't match any args patterns in mockedToolCalls. |
MockedToolCall
A mocked tool call.
Expresses the target tool + a pattern to match against that tool's args / inputs. If the pattern matches, then the mock response will be returned.
| JSON representation |
|---|
{
"tool": string,
"expectedArgsPattern": {
object
},
"mockResponse": {
object
},
// The following is a list of mutually exclusive fields. At most one of the
// fields will be set in a response:
"toolId": string,
"toolset": {
object ( |
| Fields | |
|---|---|
tool |
Optional. Deprecated. Use tool_identifier instead. |
expectedArgsPattern |
Required. A pattern to match against the args / inputs of all dispatched tool calls. If the tool call inputs match this pattern, then mock output will be returned. |
mockResponse |
Optional. The mock response / output to return if the tool call args / inputs match the pattern. |
| The identifier of the tool to mock. The following is a list of mutually exclusive fields. At most one of the fields will be set in a response: | |
toolId |
Optional. The name of the tool to mock. Format: |
toolset |
Optional. The toolset to mock. |
| End of mutually exclusive fields. | |
MockConfig.UnmatchedToolCallBehavior
What to do when a tool call doesn't match any mocked tool calls.
| Enums | |
|---|---|
UNMATCHED_TOOL_CALL_BEHAVIOR_UNSPECIFIED |
Default value. This value is unused. |
FAIL |
Throw an error for any tool calls that don't match a mock expected input pattern. |
PASS_THROUGH |
For unmatched tool calls, pass the tool call through to real tool. |