1.1.0 (latest) 1.0.0

    public abstract class ToolServiceClient

Reference documentation and code samples for the Gemini Enterprise for Customer Experience v1 API class ToolServiceClient.

ToolService client wrapper, for convenient use.

## Inheritance

[object](https://learn.microsoft.com/dotnet/api/system.object) \> ToolServiceClient

## Inherited Members

[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) [object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) [object.MemberwiseClone()](https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone) [object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)

## Derived Types

[ToolServiceClientImpl](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Ces.V1/latest/Google.Cloud.Ces.V1.ToolServiceClientImpl.md.txt)

## Namespace

[Google.Cloud.Ces.V1](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Ces.V1/latest/Google.Cloud.Ces.V1.md.txt)

## Assembly

Google.Cloud.Ces.V1.dll

## Remarks

Tool service provides APIs for interacting with CES tools.

## Properties

### DefaultEndpoint

    public static string DefaultEndpoint { get; }

The default endpoint for the ToolService service, which is a host of "ces.googleapis.com" and a port of 443.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### DefaultScopes

    public static IReadOnlyList<string> DefaultScopes { get; }

The default ToolService scopes.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `IReadOnlyListstring` |   |

**Remarks** The default ToolService scopes are:

- <https://www.googleapis.com/auth/ces>
- <https://www.googleapis.com/auth/cloud-platform>

### GrpcClient

    public virtual ToolService.ToolServiceClient GrpcClient { get; }

The underlying gRPC ToolService client

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `ToolServiceToolServiceClient` |   |

### LocationsClient

    public virtual LocationsClient LocationsClient { get; }

The [LocationsClient](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Location/latest/Google.Cloud.Location.LocationsClient.md.txt) associated with this client.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `LocationsClient` |   |

### ServiceMetadata

    public static ServiceMetadata ServiceMetadata { get; }

The service metadata associated with this client type.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `ServiceMetadata` |   |

## Methods

### Create()

    public static ToolServiceClient Create()

Synchronously creates a [ToolServiceClient](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Ces.V1/latest/Google.Cloud.Ces.V1.ToolServiceClient.md.txt) using the default credentials, endpoint and
settings. To specify custom credentials or other settings, use [ToolServiceClientBuilder](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Ces.V1/latest/Google.Cloud.Ces.V1.ToolServiceClientBuilder.md.txt).

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `ToolServiceClient` | The created [ToolServiceClient](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Ces.V1/latest/Google.Cloud.Ces.V1.ToolServiceClient.md.txt). |

### CreateAsync(CancellationToken)

    public static Task<ToolServiceClient> CreateAsync(CancellationToken cancellationToken = default)

Asynchronously creates a [ToolServiceClient](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Ces.V1/latest/Google.Cloud.Ces.V1.ToolServiceClient.md.txt) using the default credentials, endpoint and
settings. To specify custom credentials or other settings, use [ToolServiceClientBuilder](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Ces.V1/latest/Google.Cloud.Ces.V1.ToolServiceClientBuilder.md.txt).

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `cancellationToken` | `CancellationToken` The [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken) to use while creating the client. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `TaskToolServiceClient` | The task representing the created [ToolServiceClient](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Ces.V1/latest/Google.Cloud.Ces.V1.ToolServiceClient.md.txt). |

### ExecuteTool(ExecuteToolRequest, CallSettings)

    public virtual ExecuteToolResponse ExecuteTool(ExecuteToolRequest request, CallSettings callSettings = null)

Executes the given tool with the given arguments.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `ExecuteToolRequest` The request object containing all of the parameters for the API call. |
| `callSettings` | `CallSettings` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `ExecuteToolResponse` | The RPC response. |

**Example**

```cs
// Create client
ToolServiceClient toolServiceClient = ToolServiceClient.Create();
// Initialize request argument(s)
ExecuteToolRequest request = new ExecuteToolRequest
{
    ToolAsToolName = ToolName.FromProjectLocationAppTool("[PROJECT]", "[LOCATION]", "[APP]", "[TOOL]"),
    Args = new Struct(),
    ParentAsAppName = AppName.FromProjectLocationApp("[PROJECT]", "[LOCATION]", "[APP]"),
    Variables = new Struct(),
    MockConfig = new MockConfig(),
};
// Make the request
ExecuteToolResponse response = toolServiceClient.ExecuteTool(request);
```

### ExecuteToolAsync(ExecuteToolRequest, CallSettings)

    public virtual Task<ExecuteToolResponse> ExecuteToolAsync(ExecuteToolRequest request, CallSettings callSettings = null)

Executes the given tool with the given arguments.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `ExecuteToolRequest` The request object containing all of the parameters for the API call. |
| `callSettings` | `CallSettings` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `TaskExecuteToolResponse` | A Task containing the RPC response. |

**Example**

```cs
// Create client
ToolServiceClient toolServiceClient = await ToolServiceClient.CreateAsync();
// Initialize request argument(s)
ExecuteToolRequest request = new ExecuteToolRequest
{
    ToolAsToolName = ToolName.FromProjectLocationAppTool("[PROJECT]", "[LOCATION]", "[APP]", "[TOOL]"),
    Args = new Struct(),
    ParentAsAppName = AppName.FromProjectLocationApp("[PROJECT]", "[LOCATION]", "[APP]"),
    Variables = new Struct(),
    MockConfig = new MockConfig(),
};
// Make the request
ExecuteToolResponse response = await toolServiceClient.ExecuteToolAsync(request);
```

### ExecuteToolAsync(ExecuteToolRequest, CancellationToken)

    public virtual Task<ExecuteToolResponse> ExecuteToolAsync(ExecuteToolRequest request, CancellationToken cancellationToken)

Executes the given tool with the given arguments.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `ExecuteToolRequest` The request object containing all of the parameters for the API call. |
| `cancellationToken` | `CancellationToken` A [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken) to use for this RPC. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `TaskExecuteToolResponse` | A Task containing the RPC response. |

**Example**

```cs
// Create client
ToolServiceClient toolServiceClient = await ToolServiceClient.CreateAsync();
// Initialize request argument(s)
ExecuteToolRequest request = new ExecuteToolRequest
{
    ToolAsToolName = ToolName.FromProjectLocationAppTool("[PROJECT]", "[LOCATION]", "[APP]", "[TOOL]"),
    Args = new Struct(),
    ParentAsAppName = AppName.FromProjectLocationApp("[PROJECT]", "[LOCATION]", "[APP]"),
    Variables = new Struct(),
    MockConfig = new MockConfig(),
};
// Make the request
ExecuteToolResponse response = await toolServiceClient.ExecuteToolAsync(request);
```

### RetrieveToolSchema(RetrieveToolSchemaRequest, CallSettings)

    public virtual RetrieveToolSchemaResponse RetrieveToolSchema(RetrieveToolSchemaRequest request, CallSettings callSettings = null)

Retrieve the schema of the given tool. The schema is computed on the fly
for the given instance of the tool.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `RetrieveToolSchemaRequest` The request object containing all of the parameters for the API call. |
| `callSettings` | `CallSettings` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `RetrieveToolSchemaResponse` | The RPC response. |

**Example**

```cs
// Create client
ToolServiceClient toolServiceClient = ToolServiceClient.Create();
// Initialize request argument(s)
RetrieveToolSchemaRequest request = new RetrieveToolSchemaRequest
{
    ToolAsToolName = ToolName.FromProjectLocationAppTool("[PROJECT]", "[LOCATION]", "[APP]", "[TOOL]"),
    ParentAsAppName = AppName.FromProjectLocationApp("[PROJECT]", "[LOCATION]", "[APP]"),
};
// Make the request
RetrieveToolSchemaResponse response = toolServiceClient.RetrieveToolSchema(request);
```

### RetrieveToolSchemaAsync(RetrieveToolSchemaRequest, CallSettings)

    public virtual Task<RetrieveToolSchemaResponse> RetrieveToolSchemaAsync(RetrieveToolSchemaRequest request, CallSettings callSettings = null)

Retrieve the schema of the given tool. The schema is computed on the fly
for the given instance of the tool.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `RetrieveToolSchemaRequest` The request object containing all of the parameters for the API call. |
| `callSettings` | `CallSettings` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `TaskRetrieveToolSchemaResponse` | A Task containing the RPC response. |

**Example**

```cs
// Create client
ToolServiceClient toolServiceClient = await ToolServiceClient.CreateAsync();
// Initialize request argument(s)
RetrieveToolSchemaRequest request = new RetrieveToolSchemaRequest
{
    ToolAsToolName = ToolName.FromProjectLocationAppTool("[PROJECT]", "[LOCATION]", "[APP]", "[TOOL]"),
    ParentAsAppName = AppName.FromProjectLocationApp("[PROJECT]", "[LOCATION]", "[APP]"),
};
// Make the request
RetrieveToolSchemaResponse response = await toolServiceClient.RetrieveToolSchemaAsync(request);
```

### RetrieveToolSchemaAsync(RetrieveToolSchemaRequest, CancellationToken)

    public virtual Task<RetrieveToolSchemaResponse> RetrieveToolSchemaAsync(RetrieveToolSchemaRequest request, CancellationToken cancellationToken)

Retrieve the schema of the given tool. The schema is computed on the fly
for the given instance of the tool.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `RetrieveToolSchemaRequest` The request object containing all of the parameters for the API call. |
| `cancellationToken` | `CancellationToken` A [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken) to use for this RPC. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `TaskRetrieveToolSchemaResponse` | A Task containing the RPC response. |

**Example**

```cs
// Create client
ToolServiceClient toolServiceClient = await ToolServiceClient.CreateAsync();
// Initialize request argument(s)
RetrieveToolSchemaRequest request = new RetrieveToolSchemaRequest
{
    ToolAsToolName = ToolName.FromProjectLocationAppTool("[PROJECT]", "[LOCATION]", "[APP]", "[TOOL]"),
    ParentAsAppName = AppName.FromProjectLocationApp("[PROJECT]", "[LOCATION]", "[APP]"),
};
// Make the request
RetrieveToolSchemaResponse response = await toolServiceClient.RetrieveToolSchemaAsync(request);
```

### RetrieveTools(RetrieveToolsRequest, CallSettings)

    public virtual RetrieveToolsResponse RetrieveTools(RetrieveToolsRequest request, CallSettings callSettings = null)

Retrieve the list of tools included in the specified toolset.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `RetrieveToolsRequest` The request object containing all of the parameters for the API call. |
| `callSettings` | `CallSettings` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `RetrieveToolsResponse` | The RPC response. |

**Example**

```cs
// Create client
ToolServiceClient toolServiceClient = ToolServiceClient.Create();
// Initialize request argument(s)
RetrieveToolsRequest request = new RetrieveToolsRequest
{
    ToolsetAsToolsetName = ToolsetName.FromProjectLocationAppToolset("[PROJECT]", "[LOCATION]", "[APP]", "[TOOLSET]"),
    ToolIds = { "", },
    BypassPersistenceConfig = false,
};
// Make the request
RetrieveToolsResponse response = toolServiceClient.RetrieveTools(request);
```

### RetrieveToolsAsync(RetrieveToolsRequest, CallSettings)

    public virtual Task<RetrieveToolsResponse> RetrieveToolsAsync(RetrieveToolsRequest request, CallSettings callSettings = null)

Retrieve the list of tools included in the specified toolset.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `RetrieveToolsRequest` The request object containing all of the parameters for the API call. |
| `callSettings` | `CallSettings` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `TaskRetrieveToolsResponse` | A Task containing the RPC response. |

**Example**

```cs
// Create client
ToolServiceClient toolServiceClient = await ToolServiceClient.CreateAsync();
// Initialize request argument(s)
RetrieveToolsRequest request = new RetrieveToolsRequest
{
    ToolsetAsToolsetName = ToolsetName.FromProjectLocationAppToolset("[PROJECT]", "[LOCATION]", "[APP]", "[TOOLSET]"),
    ToolIds = { "", },
    BypassPersistenceConfig = false,
};
// Make the request
RetrieveToolsResponse response = await toolServiceClient.RetrieveToolsAsync(request);
```

### RetrieveToolsAsync(RetrieveToolsRequest, CancellationToken)

    public virtual Task<RetrieveToolsResponse> RetrieveToolsAsync(RetrieveToolsRequest request, CancellationToken cancellationToken)

Retrieve the list of tools included in the specified toolset.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `RetrieveToolsRequest` The request object containing all of the parameters for the API call. |
| `cancellationToken` | `CancellationToken` A [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken) to use for this RPC. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `TaskRetrieveToolsResponse` | A Task containing the RPC response. |

**Example**

```cs
// Create client
ToolServiceClient toolServiceClient = await ToolServiceClient.CreateAsync();
// Initialize request argument(s)
RetrieveToolsRequest request = new RetrieveToolsRequest
{
    ToolsetAsToolsetName = ToolsetName.FromProjectLocationAppToolset("[PROJECT]", "[LOCATION]", "[APP]", "[TOOLSET]"),
    ToolIds = { "", },
    BypassPersistenceConfig = false,
};
// Make the request
RetrieveToolsResponse response = await toolServiceClient.RetrieveToolsAsync(request);
```

### ShutdownDefaultChannelsAsync()

    public static Task ShutdownDefaultChannelsAsync()

Shuts down any channels automatically created by [Create()](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Ces.V1/latest/Google.Cloud.Ces.V1.ToolServiceClient.md.txt#Google_Cloud_Ces_V1_ToolServiceClient_Create) and
[CreateAsync(CancellationToken)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Ces.V1/latest/Google.Cloud.Ces.V1.ToolServiceClient.md.txt#Google_Cloud_Ces_V1_ToolServiceClient_CreateAsync_System_Threading_CancellationToken_). Channels which weren't automatically created are not
affected.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Task` | A task representing the asynchronous shutdown operation. |

**Remarks** After calling this method, further calls to [Create()](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Ces.V1/latest/Google.Cloud.Ces.V1.ToolServiceClient.md.txt#Google_Cloud_Ces_V1_ToolServiceClient_Create) and
[CreateAsync(CancellationToken)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Ces.V1/latest/Google.Cloud.Ces.V1.ToolServiceClient.md.txt#Google_Cloud_Ces_V1_ToolServiceClient_CreateAsync_System_Threading_CancellationToken_) will create new channels, which could in turn be shut down
by another call to this method.