// Copyright 2025 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.apiregistry.v1beta;

import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/cloud/apiregistry/v1beta/common.proto";
import "google/protobuf/struct.proto";

option csharp_namespace = "Google.Cloud.ApiRegistry.V1Beta";
option go_package = "cloud.google.com/go/apiregistry/apiv1beta/apiregistrypb;apiregistrypb";
option java_multiple_files = true;
option java_outer_classname = "ResourcesProto";
option java_package = "com.google.cloud.apiregistry.v1beta";
option php_namespace = "Google\\Cloud\\ApiRegistry\\V1beta";
option ruby_package = "Google::Cloud::ApiRegistry::V1beta";

// Represents an MCP Server. MCP Servers act as endpoints that expose a
// collection of tools that can be invoked by agents.
message McpServer {
  option (google.api.resource) = {
    type: "cloudapiregistry.googleapis.com/McpServer"
    pattern: "projects/{project}/locations/{location}/apiNamespaces/{api_namespace}/mcpServers/{mcp_server}"
    pattern: "projects/{project}/locations/{location}/mcpServers/{mcp_server}"
    plural: "mcpServers"
    singular: "mcpServer"
  };

  // Identifier. The resource name of the MCP Server.
  // Format:
  // `projects/{project}/locations/{location}/mcpServers/{mcp_server}`.
  // Example:
  // projects/12345/locations/us-central1/mcpServers/google:bigquery.googleapis.com:mcp
  // for 1p
  // projects/12345/locations/us-central1/mcpServers/apphub:starbucks for
  // 2p
  string name = 1 [(google.api.field_behavior) = IDENTIFIER];

  // Optional. A human readable name for the MCP server.
  string display_name = 2 [(google.api.field_behavior) = OPTIONAL];

  // Optional. A human-readable description of the MCP Server's functionality.
  string description = 3 [(google.api.field_behavior) = OPTIONAL];

  // The base URL of the MCP server. Example: [geolocation.googleapis.com/mcp].
  repeated string urls = 4;

  // The capabilities that a server may support. Known capabilities defined in
  // https://modelcontextprotocol.io/specification/2025-06-18/schema#servercapabilities
  // and additional capabilities defined by the servers.
  google.protobuf.Struct capabilities = 6;

  // Output only. The state of the MCP Server.
  State state = 7 [(google.api.field_behavior) = OUTPUT_ONLY];
}

// Message describing McpTool object
message McpTool {
  option (google.api.resource) = {
    type: "cloudapiregistry.googleapis.com/McpTool"
    pattern: "projects/{project}/locations/{location}/apiNamespaces/{api_namespace}/mcpServers/{mcp_server}/mcpTools/{mcp_tool}"
    pattern: "projects/{project}/locations/{location}/mcpServers/{mcp_server}/mcpTools/{mcp_tool}"
    plural: "mcpTools"
    singular: "mcpTool"
  };

  // Identifier. The resource name of the McpTool.
  // Format:
  // `projects/{project}/locations/{location}/mcpServers/{mcp_server}/mcpTools/{mcp_tool}`.
  // Example:
  // projects/12345/locations/us-central1/mcpServers/google:bigquery.googleapis.com:mcp/mcpTools/insert_job
  // for 1p
  // projects/12345/locations/us-central1/mcpServers/apphub:starbucks/mcpTools/order_pizza
  // for 2p
  string name = 1 [(google.api.field_behavior) = IDENTIFIER];

  // Optional. A human-readable name for the tool, suitable for display.
  string display_name = 2 [(google.api.field_behavior) = OPTIONAL];

  // A human-readable description of the tool's functionality.
  string description = 3;

  // Automatically populated reference to MCP Server. Helpful when multiple
  // tools are requested across different MCP Servers.
  repeated string mcp_server_urls = 4;

  // A JSON Schema object defining the expected parameters for invoking the
  // tool.
  google.protobuf.Struct input_schema = 5;

  // Optional. A JSON Schema object defining the expected structure of the
  // tool's output.
  google.protobuf.Struct output_schema = 6;

  // Optional key-value object that allows developers to provide additional
  // information regarding tool properties, behavior, and usage best practices.
  // Annotations or tags to facilitate semantic search across tools ("semantic
  // tags") are not in the MVP scope. When implemented, the first set of
  // supported annotations will likely be the standard, predefined annotations
  // from the open-source MCP spec. These include:
  //   - title: A human-readable title for the tool, useful for UI display.
  //   - readOnlyHint: If true, indicates the tool does not modify its
  //   environment.
  //   - destructiveHint: If true, the tool may perform destructive updates
  //   (only meaningful when readOnlyHint is false).
  //   - idempotentHint: If true, calling the tool repeatedly with the same
  //   arguments has no additional effect (only meaningful when readOnlyHint is
  //   false).
  //   - openWorldHint: If true, the tool may interact with an "open world" of
  //   external entities.
  google.protobuf.Struct annotations = 7;
}
