// Copyright 2026 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

syntax = "proto3";

package google.cloud.ces.v1;

import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/cloud/ces/v1/agent_tool.proto";
import "google/cloud/ces/v1/client_function.proto";
import "google/cloud/ces/v1/common.proto";
import "google/cloud/ces/v1/connector_tool.proto";
import "google/cloud/ces/v1/data_store_tool.proto";
import "google/cloud/ces/v1/fakes.proto";
import "google/cloud/ces/v1/file_search_tool.proto";
import "google/cloud/ces/v1/google_search_tool.proto";
import "google/cloud/ces/v1/mcp_tool.proto";
import "google/cloud/ces/v1/open_api_tool.proto";
import "google/cloud/ces/v1/python_function.proto";
import "google/cloud/ces/v1/system_tool.proto";
import "google/cloud/ces/v1/widget_tool.proto";
import "google/protobuf/timestamp.proto";

option go_package = "cloud.google.com/go/ces/apiv1/cespb;cespb";
option java_multiple_files = true;
option java_outer_classname = "ToolProto";
option java_package = "com.google.cloud.ces.v1";

// A tool represents an action that the CES agent can take to achieve certain
// goals.
message Tool {
  option (google.api.resource) = {
    type: "ces.googleapis.com/Tool"
    pattern: "projects/{project}/locations/{location}/apps/{app}/tools/{tool}"
    plural: "tools"
    singular: "tool"
  };

  // The type of the tool.
  oneof tool_type {
    // Optional. The client function.
    ClientFunction client_function = 2 [(google.api.field_behavior) = OPTIONAL];

    // Optional. The open API tool.
    OpenApiTool open_api_tool = 3 [(google.api.field_behavior) = OPTIONAL];

    // Optional. The google search tool.
    GoogleSearchTool google_search_tool = 5
        [(google.api.field_behavior) = OPTIONAL];

    // Optional. The Integration Connector tool.
    ConnectorTool connector_tool = 8 [(google.api.field_behavior) = OPTIONAL];

    // Optional. The data store tool.
    DataStoreTool data_store_tool = 10 [(google.api.field_behavior) = OPTIONAL];

    // Optional. The python function tool.
    PythonFunction python_function = 11
        [(google.api.field_behavior) = OPTIONAL];

    // Optional. The MCP tool. An MCP tool cannot be created or updated directly
    // and is managed by the MCP toolset.
    McpTool mcp_tool = 16 [(google.api.field_behavior) = OPTIONAL];

    // Optional. The file search tool.
    FileSearchTool file_search_tool = 17
        [(google.api.field_behavior) = OPTIONAL];

    // Optional. The system tool.
    SystemTool system_tool = 18 [(google.api.field_behavior) = OPTIONAL];

    // Optional. The agent tool.
    AgentTool agent_tool = 23 [(google.api.field_behavior) = OPTIONAL];

    // Optional. The widget tool.
    WidgetTool widget_tool = 24 [(google.api.field_behavior) = OPTIONAL];
  }

  // Identifier. The resource name of the tool. Format:
  //
  // * `projects/{project}/locations/{location}/apps/{app}/tools/{tool}`
  //   for standalone tools.
  // * `projects/{project}/locations/{location}/apps/{app}/toolsets/{toolset}/tools/{tool}`
  //   for tools retrieved from a toolset.
  //
  // These tools are dynamic and output-only; they cannot be referenced directly
  // where a tool is expected.
  string name = 1 [(google.api.field_behavior) = IDENTIFIER];

  // Output only. The display name of the tool, derived based on the tool's
  // type. For example, display name of a [ClientFunction][Tool.ClientFunction]
  // is derived from its `name` property.
  string display_name = 13 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Optional. The execution type of the tool.
  ExecutionType execution_type = 12 [(google.api.field_behavior) = OPTIONAL];

  // Output only. Timestamp when the tool was created.
  google.protobuf.Timestamp create_time = 6
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Timestamp when the tool was last updated.
  google.protobuf.Timestamp update_time = 7
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Etag used to ensure the object hasn't changed during a read-modify-write
  // operation. If the etag is empty, the update will overwrite any concurrent
  // changes.
  string etag = 14;

  // Output only. If the tool is generated by the LLM assistant, this field
  // contains a descriptive summary of the generation.
  string generated_summary = 15 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Optional. Configuration for tool behavior in fake mode.
  ToolFakeConfig tool_fake_config = 20 [(google.api.field_behavior) = OPTIONAL];
}
