diff --git a/packages/google-cloud-apiregistry/README.md b/packages/google-cloud-apiregistry/README.md index 75834c31ea3..6f2b47fae1b 100644 --- a/packages/google-cloud-apiregistry/README.md +++ b/packages/google-cloud-apiregistry/README.md @@ -57,6 +57,11 @@ Samples are in the [`samples/`][homepage_samples] directory. Each sample's `READ | Sample | Source Code | | --------------------------- | --------------------------------- | +| get mcp server | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-apiregistry/samples/generated/v1/cloud_api_registry.get_mcp_server.js) | +| get mcp tool | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-apiregistry/samples/generated/v1/cloud_api_registry.get_mcp_tool.js) | +| list mcp servers | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-apiregistry/samples/generated/v1/cloud_api_registry.list_mcp_servers.js) | +| list mcp tools | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-apiregistry/samples/generated/v1/cloud_api_registry.list_mcp_tools.js) | +| cloud | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-apiregistry/samples/generated/v1/snippet_metadata_google.cloud.apiregistry.v1.json) | | get mcp server | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-apiregistry/samples/generated/v1beta/cloud_api_registry.get_mcp_server.js) | | get mcp tool | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-apiregistry/samples/generated/v1beta/cloud_api_registry.get_mcp_tool.js) | | list mcp servers | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-apiregistry/samples/generated/v1beta/cloud_api_registry.list_mcp_servers.js) | diff --git a/packages/google-cloud-apiregistry/protos/google/cloud/apiregistry/v1/common.proto b/packages/google-cloud-apiregistry/protos/google/cloud/apiregistry/v1/common.proto new file mode 100644 index 00000000000..41dab339688 --- /dev/null +++ b/packages/google-cloud-apiregistry/protos/google/cloud/apiregistry/v1/common.proto @@ -0,0 +1,37 @@ +// 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.apiregistry.v1; + +option csharp_namespace = "Google.Cloud.ApiRegistry.V1"; +option go_package = "cloud.google.com/go/apiregistry/apiv1/apiregistrypb;apiregistrypb"; +option java_multiple_files = true; +option java_outer_classname = "CommonProto"; +option java_package = "com.google.cloud.apiregistry.v1"; +option php_namespace = "Google\\Cloud\\ApiRegistry\\V1"; +option ruby_package = "Google::Cloud::ApiRegistry::V1"; + +// The state of McpServer resource. +enum State { + // The McpServer state is unspecified. + STATE_UNSPECIFIED = 0; + + // The McpServer is enabled. + ENABLED = 1; + + // The McpServer is disabled. + DISABLED = 2; +} diff --git a/packages/google-cloud-apiregistry/protos/google/cloud/apiregistry/v1/resources.proto b/packages/google-cloud-apiregistry/protos/google/cloud/apiregistry/v1/resources.proto new file mode 100644 index 00000000000..824e1db551f --- /dev/null +++ b/packages/google-cloud-apiregistry/protos/google/cloud/apiregistry/v1/resources.proto @@ -0,0 +1,126 @@ +// 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.apiregistry.v1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/apiregistry/v1/common.proto"; +import "google/protobuf/struct.proto"; + +option csharp_namespace = "Google.Cloud.ApiRegistry.V1"; +option go_package = "cloud.google.com/go/apiregistry/apiv1/apiregistrypb;apiregistrypb"; +option java_multiple_files = true; +option java_outer_classname = "ResourcesProto"; +option java_package = "com.google.cloud.apiregistry.v1"; +option php_namespace = "Google\\Cloud\\ApiRegistry\\V1"; +option ruby_package = "Google::Cloud::ApiRegistry::V1"; + +// 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; +} diff --git a/packages/google-cloud-apiregistry/protos/google/cloud/apiregistry/v1/service.proto b/packages/google-cloud-apiregistry/protos/google/cloud/apiregistry/v1/service.proto new file mode 100644 index 00000000000..ccafb78f081 --- /dev/null +++ b/packages/google-cloud-apiregistry/protos/google/cloud/apiregistry/v1/service.proto @@ -0,0 +1,182 @@ +// 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.apiregistry.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/apiregistry/v1/resources.proto"; + +option csharp_namespace = "Google.Cloud.ApiRegistry.V1"; +option go_package = "cloud.google.com/go/apiregistry/apiv1/apiregistrypb;apiregistrypb"; +option java_multiple_files = true; +option java_outer_classname = "ServiceProto"; +option java_package = "com.google.cloud.apiregistry.v1"; +option php_namespace = "Google\\Cloud\\ApiRegistry\\V1"; +option ruby_package = "Google::Cloud::ApiRegistry::V1"; +option (google.api.resource_definition) = { + type: "cloudapiregistry.googleapis.com/ApiNamespace" + pattern: "projects/{project}/locations/{location}/apiNamespaces/{api_namespace}" +}; + +// The Cloud API Registry service provides a central registry for managing API +// Data. +service CloudApiRegistry { + option (google.api.default_host) = "cloudapiregistry.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Gets a single McpServer. + rpc GetMcpServer(GetMcpServerRequest) returns (McpServer) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/mcpServers/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists McpServers in a given Project. + rpc ListMcpServers(ListMcpServersRequest) returns (ListMcpServersResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/mcpServers" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets a single McpTool. + rpc GetMcpTool(GetMcpToolRequest) returns (McpTool) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/mcpServers/*/mcpTools/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists McpTools in a given McpServer. + rpc ListMcpTools(ListMcpToolsRequest) returns (ListMcpToolsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*/mcpServers/*}/mcpTools" + }; + option (google.api.method_signature) = "parent"; + } +} + +// Message for getting a McpServer +message GetMcpServerRequest { + // Required. Name of the resource + // Format: projects/{project}/locations/{location}/mcpServers/{mcp_server} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudapiregistry.googleapis.com/McpServer" + } + ]; +} + +// Message for requesting list of McpServers +message ListMcpServersRequest { + // Required. Parent value for ListMcpServersRequest + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Optional. Requested page size. Server may return fewer items than + // requested. If unspecified, at most 50 items will be returned. The maximum + // value is 100; values above 100 will be coerced to 100. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A token identifying a page of results the server should return. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. An expression that filters the results. + // For syntax, see https://google.aip.dev/160. + string filter = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A comma-separated list of fields to order by, sorted in ascending + // order. Use "desc" after a field name for descending. For syntax, see + // https://google.aip.dev/132#ordering. + string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +// Message for response to listing McpServers +message ListMcpServersResponse { + // The list of McpServer + repeated McpServer mcp_servers = 1; + + // A token identifying a page of results the server should return. + string next_page_token = 2; + + // Unordered list. Locations that could not be reached. + repeated string unreachable = 3 + [(google.api.field_behavior) = UNORDERED_LIST]; +} + +// Message for getting a McpTool +message GetMcpToolRequest { + // Required. Name of the resource + // Format: + // projects/{project}/locations/{location}/mcpServers/{mcp_server}/mcpTools/{mcp_tool} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudapiregistry.googleapis.com/McpTool" + } + ]; +} + +// Message for requesting list of McpTools +message ListMcpToolsRequest { + // Required. Parent value for ListMcpToolsRequest + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "cloudapiregistry.googleapis.com/McpTool" + } + ]; + + // Optional. Requested page size. Server may return fewer items than + // requested. If unspecified, at most 50 items will be returned. The maximum + // value is 100; values above 100 will be coerced to 100. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A token identifying a page of results the server should return. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. An expression that filters the results. + // For syntax, see https://google.aip.dev/160. + string filter = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A comma-separated list of fields to order by, sorted in ascending + // order. Use "desc" after a field name for descending. For syntax, see + // https://google.aip.dev/132#ordering. + string order_by = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +// Message for response to listing McpTools +message ListMcpToolsResponse { + // The list of McpTool + repeated McpTool mcp_tools = 1; + + // A token identifying a page of results the server should return. + string next_page_token = 2; + + // Unordered list. Locations that could not be reached. + repeated string unreachable = 3 + [(google.api.field_behavior) = UNORDERED_LIST]; +} diff --git a/packages/google-cloud-apiregistry/protos/protos.d.ts b/packages/google-cloud-apiregistry/protos/protos.d.ts index eaf4213c8d1..d90efa0c450 100644 --- a/packages/google-cloud-apiregistry/protos/protos.d.ts +++ b/packages/google-cloud-apiregistry/protos/protos.d.ts @@ -23,6 +23,1039 @@ export namespace google { /** Namespace apiregistry. */ namespace apiregistry { + /** Namespace v1. */ + namespace v1 { + + /** State enum. */ + enum State { + STATE_UNSPECIFIED = 0, + ENABLED = 1, + DISABLED = 2 + } + + /** Properties of a McpServer. */ + interface IMcpServer { + + /** McpServer name */ + name?: (string|null); + + /** McpServer displayName */ + displayName?: (string|null); + + /** McpServer description */ + description?: (string|null); + + /** McpServer urls */ + urls?: (string[]|null); + + /** McpServer capabilities */ + capabilities?: (google.protobuf.IStruct|null); + + /** McpServer state */ + state?: (google.cloud.apiregistry.v1.State|keyof typeof google.cloud.apiregistry.v1.State|null); + } + + /** Represents a McpServer. */ + class McpServer implements IMcpServer { + + /** + * Constructs a new McpServer. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.apiregistry.v1.IMcpServer); + + /** McpServer name. */ + public name: string; + + /** McpServer displayName. */ + public displayName: string; + + /** McpServer description. */ + public description: string; + + /** McpServer urls. */ + public urls: string[]; + + /** McpServer capabilities. */ + public capabilities?: (google.protobuf.IStruct|null); + + /** McpServer state. */ + public state: (google.cloud.apiregistry.v1.State|keyof typeof google.cloud.apiregistry.v1.State); + + /** + * Creates a new McpServer instance using the specified properties. + * @param [properties] Properties to set + * @returns McpServer instance + */ + public static create(properties?: google.cloud.apiregistry.v1.IMcpServer): google.cloud.apiregistry.v1.McpServer; + + /** + * Encodes the specified McpServer message. Does not implicitly {@link google.cloud.apiregistry.v1.McpServer.verify|verify} messages. + * @param message McpServer message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.apiregistry.v1.IMcpServer, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified McpServer message, length delimited. Does not implicitly {@link google.cloud.apiregistry.v1.McpServer.verify|verify} messages. + * @param message McpServer message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.apiregistry.v1.IMcpServer, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a McpServer message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns McpServer + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.apiregistry.v1.McpServer; + + /** + * Decodes a McpServer message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns McpServer + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.apiregistry.v1.McpServer; + + /** + * Verifies a McpServer message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a McpServer message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns McpServer + */ + public static fromObject(object: { [k: string]: any }): google.cloud.apiregistry.v1.McpServer; + + /** + * Creates a plain object from a McpServer message. Also converts values to other types if specified. + * @param message McpServer + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.apiregistry.v1.McpServer, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this McpServer to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for McpServer + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a McpTool. */ + interface IMcpTool { + + /** McpTool name */ + name?: (string|null); + + /** McpTool displayName */ + displayName?: (string|null); + + /** McpTool description */ + description?: (string|null); + + /** McpTool mcpServerUrls */ + mcpServerUrls?: (string[]|null); + + /** McpTool inputSchema */ + inputSchema?: (google.protobuf.IStruct|null); + + /** McpTool outputSchema */ + outputSchema?: (google.protobuf.IStruct|null); + + /** McpTool annotations */ + annotations?: (google.protobuf.IStruct|null); + } + + /** Represents a McpTool. */ + class McpTool implements IMcpTool { + + /** + * Constructs a new McpTool. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.apiregistry.v1.IMcpTool); + + /** McpTool name. */ + public name: string; + + /** McpTool displayName. */ + public displayName: string; + + /** McpTool description. */ + public description: string; + + /** McpTool mcpServerUrls. */ + public mcpServerUrls: string[]; + + /** McpTool inputSchema. */ + public inputSchema?: (google.protobuf.IStruct|null); + + /** McpTool outputSchema. */ + public outputSchema?: (google.protobuf.IStruct|null); + + /** McpTool annotations. */ + public annotations?: (google.protobuf.IStruct|null); + + /** + * Creates a new McpTool instance using the specified properties. + * @param [properties] Properties to set + * @returns McpTool instance + */ + public static create(properties?: google.cloud.apiregistry.v1.IMcpTool): google.cloud.apiregistry.v1.McpTool; + + /** + * Encodes the specified McpTool message. Does not implicitly {@link google.cloud.apiregistry.v1.McpTool.verify|verify} messages. + * @param message McpTool message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.apiregistry.v1.IMcpTool, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified McpTool message, length delimited. Does not implicitly {@link google.cloud.apiregistry.v1.McpTool.verify|verify} messages. + * @param message McpTool message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.apiregistry.v1.IMcpTool, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a McpTool message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns McpTool + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.apiregistry.v1.McpTool; + + /** + * Decodes a McpTool message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns McpTool + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.apiregistry.v1.McpTool; + + /** + * Verifies a McpTool message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a McpTool message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns McpTool + */ + public static fromObject(object: { [k: string]: any }): google.cloud.apiregistry.v1.McpTool; + + /** + * Creates a plain object from a McpTool message. Also converts values to other types if specified. + * @param message McpTool + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.apiregistry.v1.McpTool, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this McpTool to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for McpTool + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Represents a CloudApiRegistry */ + class CloudApiRegistry extends $protobuf.rpc.Service { + + /** + * Constructs a new CloudApiRegistry service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new CloudApiRegistry service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): CloudApiRegistry; + + /** + * Calls GetMcpServer. + * @param request GetMcpServerRequest message or plain object + * @param callback Node-style callback called with the error, if any, and McpServer + */ + public getMcpServer(request: google.cloud.apiregistry.v1.IGetMcpServerRequest, callback: google.cloud.apiregistry.v1.CloudApiRegistry.GetMcpServerCallback): void; + + /** + * Calls GetMcpServer. + * @param request GetMcpServerRequest message or plain object + * @returns Promise + */ + public getMcpServer(request: google.cloud.apiregistry.v1.IGetMcpServerRequest): Promise; + + /** + * Calls ListMcpServers. + * @param request ListMcpServersRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListMcpServersResponse + */ + public listMcpServers(request: google.cloud.apiregistry.v1.IListMcpServersRequest, callback: google.cloud.apiregistry.v1.CloudApiRegistry.ListMcpServersCallback): void; + + /** + * Calls ListMcpServers. + * @param request ListMcpServersRequest message or plain object + * @returns Promise + */ + public listMcpServers(request: google.cloud.apiregistry.v1.IListMcpServersRequest): Promise; + + /** + * Calls GetMcpTool. + * @param request GetMcpToolRequest message or plain object + * @param callback Node-style callback called with the error, if any, and McpTool + */ + public getMcpTool(request: google.cloud.apiregistry.v1.IGetMcpToolRequest, callback: google.cloud.apiregistry.v1.CloudApiRegistry.GetMcpToolCallback): void; + + /** + * Calls GetMcpTool. + * @param request GetMcpToolRequest message or plain object + * @returns Promise + */ + public getMcpTool(request: google.cloud.apiregistry.v1.IGetMcpToolRequest): Promise; + + /** + * Calls ListMcpTools. + * @param request ListMcpToolsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListMcpToolsResponse + */ + public listMcpTools(request: google.cloud.apiregistry.v1.IListMcpToolsRequest, callback: google.cloud.apiregistry.v1.CloudApiRegistry.ListMcpToolsCallback): void; + + /** + * Calls ListMcpTools. + * @param request ListMcpToolsRequest message or plain object + * @returns Promise + */ + public listMcpTools(request: google.cloud.apiregistry.v1.IListMcpToolsRequest): Promise; + } + + namespace CloudApiRegistry { + + /** + * Callback as used by {@link google.cloud.apiregistry.v1.CloudApiRegistry|getMcpServer}. + * @param error Error, if any + * @param [response] McpServer + */ + type GetMcpServerCallback = (error: (Error|null), response?: google.cloud.apiregistry.v1.McpServer) => void; + + /** + * Callback as used by {@link google.cloud.apiregistry.v1.CloudApiRegistry|listMcpServers}. + * @param error Error, if any + * @param [response] ListMcpServersResponse + */ + type ListMcpServersCallback = (error: (Error|null), response?: google.cloud.apiregistry.v1.ListMcpServersResponse) => void; + + /** + * Callback as used by {@link google.cloud.apiregistry.v1.CloudApiRegistry|getMcpTool}. + * @param error Error, if any + * @param [response] McpTool + */ + type GetMcpToolCallback = (error: (Error|null), response?: google.cloud.apiregistry.v1.McpTool) => void; + + /** + * Callback as used by {@link google.cloud.apiregistry.v1.CloudApiRegistry|listMcpTools}. + * @param error Error, if any + * @param [response] ListMcpToolsResponse + */ + type ListMcpToolsCallback = (error: (Error|null), response?: google.cloud.apiregistry.v1.ListMcpToolsResponse) => void; + } + + /** Properties of a GetMcpServerRequest. */ + interface IGetMcpServerRequest { + + /** GetMcpServerRequest name */ + name?: (string|null); + } + + /** Represents a GetMcpServerRequest. */ + class GetMcpServerRequest implements IGetMcpServerRequest { + + /** + * Constructs a new GetMcpServerRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.apiregistry.v1.IGetMcpServerRequest); + + /** GetMcpServerRequest name. */ + public name: string; + + /** + * Creates a new GetMcpServerRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetMcpServerRequest instance + */ + public static create(properties?: google.cloud.apiregistry.v1.IGetMcpServerRequest): google.cloud.apiregistry.v1.GetMcpServerRequest; + + /** + * Encodes the specified GetMcpServerRequest message. Does not implicitly {@link google.cloud.apiregistry.v1.GetMcpServerRequest.verify|verify} messages. + * @param message GetMcpServerRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.apiregistry.v1.IGetMcpServerRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetMcpServerRequest message, length delimited. Does not implicitly {@link google.cloud.apiregistry.v1.GetMcpServerRequest.verify|verify} messages. + * @param message GetMcpServerRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.apiregistry.v1.IGetMcpServerRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetMcpServerRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetMcpServerRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.apiregistry.v1.GetMcpServerRequest; + + /** + * Decodes a GetMcpServerRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetMcpServerRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.apiregistry.v1.GetMcpServerRequest; + + /** + * Verifies a GetMcpServerRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetMcpServerRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetMcpServerRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.apiregistry.v1.GetMcpServerRequest; + + /** + * Creates a plain object from a GetMcpServerRequest message. Also converts values to other types if specified. + * @param message GetMcpServerRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.apiregistry.v1.GetMcpServerRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetMcpServerRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetMcpServerRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListMcpServersRequest. */ + interface IListMcpServersRequest { + + /** ListMcpServersRequest parent */ + parent?: (string|null); + + /** ListMcpServersRequest pageSize */ + pageSize?: (number|null); + + /** ListMcpServersRequest pageToken */ + pageToken?: (string|null); + + /** ListMcpServersRequest filter */ + filter?: (string|null); + + /** ListMcpServersRequest orderBy */ + orderBy?: (string|null); + } + + /** Represents a ListMcpServersRequest. */ + class ListMcpServersRequest implements IListMcpServersRequest { + + /** + * Constructs a new ListMcpServersRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.apiregistry.v1.IListMcpServersRequest); + + /** ListMcpServersRequest parent. */ + public parent: string; + + /** ListMcpServersRequest pageSize. */ + public pageSize: number; + + /** ListMcpServersRequest pageToken. */ + public pageToken: string; + + /** ListMcpServersRequest filter. */ + public filter: string; + + /** ListMcpServersRequest orderBy. */ + public orderBy: string; + + /** + * Creates a new ListMcpServersRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListMcpServersRequest instance + */ + public static create(properties?: google.cloud.apiregistry.v1.IListMcpServersRequest): google.cloud.apiregistry.v1.ListMcpServersRequest; + + /** + * Encodes the specified ListMcpServersRequest message. Does not implicitly {@link google.cloud.apiregistry.v1.ListMcpServersRequest.verify|verify} messages. + * @param message ListMcpServersRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.apiregistry.v1.IListMcpServersRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListMcpServersRequest message, length delimited. Does not implicitly {@link google.cloud.apiregistry.v1.ListMcpServersRequest.verify|verify} messages. + * @param message ListMcpServersRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.apiregistry.v1.IListMcpServersRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListMcpServersRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListMcpServersRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.apiregistry.v1.ListMcpServersRequest; + + /** + * Decodes a ListMcpServersRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListMcpServersRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.apiregistry.v1.ListMcpServersRequest; + + /** + * Verifies a ListMcpServersRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListMcpServersRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListMcpServersRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.apiregistry.v1.ListMcpServersRequest; + + /** + * Creates a plain object from a ListMcpServersRequest message. Also converts values to other types if specified. + * @param message ListMcpServersRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.apiregistry.v1.ListMcpServersRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListMcpServersRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListMcpServersRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListMcpServersResponse. */ + interface IListMcpServersResponse { + + /** ListMcpServersResponse mcpServers */ + mcpServers?: (google.cloud.apiregistry.v1.IMcpServer[]|null); + + /** ListMcpServersResponse nextPageToken */ + nextPageToken?: (string|null); + + /** ListMcpServersResponse unreachable */ + unreachable?: (string[]|null); + } + + /** Represents a ListMcpServersResponse. */ + class ListMcpServersResponse implements IListMcpServersResponse { + + /** + * Constructs a new ListMcpServersResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.apiregistry.v1.IListMcpServersResponse); + + /** ListMcpServersResponse mcpServers. */ + public mcpServers: google.cloud.apiregistry.v1.IMcpServer[]; + + /** ListMcpServersResponse nextPageToken. */ + public nextPageToken: string; + + /** ListMcpServersResponse unreachable. */ + public unreachable: string[]; + + /** + * Creates a new ListMcpServersResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListMcpServersResponse instance + */ + public static create(properties?: google.cloud.apiregistry.v1.IListMcpServersResponse): google.cloud.apiregistry.v1.ListMcpServersResponse; + + /** + * Encodes the specified ListMcpServersResponse message. Does not implicitly {@link google.cloud.apiregistry.v1.ListMcpServersResponse.verify|verify} messages. + * @param message ListMcpServersResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.apiregistry.v1.IListMcpServersResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListMcpServersResponse message, length delimited. Does not implicitly {@link google.cloud.apiregistry.v1.ListMcpServersResponse.verify|verify} messages. + * @param message ListMcpServersResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.apiregistry.v1.IListMcpServersResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListMcpServersResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListMcpServersResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.apiregistry.v1.ListMcpServersResponse; + + /** + * Decodes a ListMcpServersResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListMcpServersResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.apiregistry.v1.ListMcpServersResponse; + + /** + * Verifies a ListMcpServersResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListMcpServersResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListMcpServersResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.apiregistry.v1.ListMcpServersResponse; + + /** + * Creates a plain object from a ListMcpServersResponse message. Also converts values to other types if specified. + * @param message ListMcpServersResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.apiregistry.v1.ListMcpServersResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListMcpServersResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListMcpServersResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GetMcpToolRequest. */ + interface IGetMcpToolRequest { + + /** GetMcpToolRequest name */ + name?: (string|null); + } + + /** Represents a GetMcpToolRequest. */ + class GetMcpToolRequest implements IGetMcpToolRequest { + + /** + * Constructs a new GetMcpToolRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.apiregistry.v1.IGetMcpToolRequest); + + /** GetMcpToolRequest name. */ + public name: string; + + /** + * Creates a new GetMcpToolRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetMcpToolRequest instance + */ + public static create(properties?: google.cloud.apiregistry.v1.IGetMcpToolRequest): google.cloud.apiregistry.v1.GetMcpToolRequest; + + /** + * Encodes the specified GetMcpToolRequest message. Does not implicitly {@link google.cloud.apiregistry.v1.GetMcpToolRequest.verify|verify} messages. + * @param message GetMcpToolRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.apiregistry.v1.IGetMcpToolRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetMcpToolRequest message, length delimited. Does not implicitly {@link google.cloud.apiregistry.v1.GetMcpToolRequest.verify|verify} messages. + * @param message GetMcpToolRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.apiregistry.v1.IGetMcpToolRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetMcpToolRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetMcpToolRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.apiregistry.v1.GetMcpToolRequest; + + /** + * Decodes a GetMcpToolRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetMcpToolRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.apiregistry.v1.GetMcpToolRequest; + + /** + * Verifies a GetMcpToolRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetMcpToolRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetMcpToolRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.apiregistry.v1.GetMcpToolRequest; + + /** + * Creates a plain object from a GetMcpToolRequest message. Also converts values to other types if specified. + * @param message GetMcpToolRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.apiregistry.v1.GetMcpToolRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetMcpToolRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetMcpToolRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListMcpToolsRequest. */ + interface IListMcpToolsRequest { + + /** ListMcpToolsRequest parent */ + parent?: (string|null); + + /** ListMcpToolsRequest pageSize */ + pageSize?: (number|null); + + /** ListMcpToolsRequest pageToken */ + pageToken?: (string|null); + + /** ListMcpToolsRequest filter */ + filter?: (string|null); + + /** ListMcpToolsRequest orderBy */ + orderBy?: (string|null); + } + + /** Represents a ListMcpToolsRequest. */ + class ListMcpToolsRequest implements IListMcpToolsRequest { + + /** + * Constructs a new ListMcpToolsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.apiregistry.v1.IListMcpToolsRequest); + + /** ListMcpToolsRequest parent. */ + public parent: string; + + /** ListMcpToolsRequest pageSize. */ + public pageSize: number; + + /** ListMcpToolsRequest pageToken. */ + public pageToken: string; + + /** ListMcpToolsRequest filter. */ + public filter: string; + + /** ListMcpToolsRequest orderBy. */ + public orderBy: string; + + /** + * Creates a new ListMcpToolsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListMcpToolsRequest instance + */ + public static create(properties?: google.cloud.apiregistry.v1.IListMcpToolsRequest): google.cloud.apiregistry.v1.ListMcpToolsRequest; + + /** + * Encodes the specified ListMcpToolsRequest message. Does not implicitly {@link google.cloud.apiregistry.v1.ListMcpToolsRequest.verify|verify} messages. + * @param message ListMcpToolsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.apiregistry.v1.IListMcpToolsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListMcpToolsRequest message, length delimited. Does not implicitly {@link google.cloud.apiregistry.v1.ListMcpToolsRequest.verify|verify} messages. + * @param message ListMcpToolsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.apiregistry.v1.IListMcpToolsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListMcpToolsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListMcpToolsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.apiregistry.v1.ListMcpToolsRequest; + + /** + * Decodes a ListMcpToolsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListMcpToolsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.apiregistry.v1.ListMcpToolsRequest; + + /** + * Verifies a ListMcpToolsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListMcpToolsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListMcpToolsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.apiregistry.v1.ListMcpToolsRequest; + + /** + * Creates a plain object from a ListMcpToolsRequest message. Also converts values to other types if specified. + * @param message ListMcpToolsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.apiregistry.v1.ListMcpToolsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListMcpToolsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListMcpToolsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListMcpToolsResponse. */ + interface IListMcpToolsResponse { + + /** ListMcpToolsResponse mcpTools */ + mcpTools?: (google.cloud.apiregistry.v1.IMcpTool[]|null); + + /** ListMcpToolsResponse nextPageToken */ + nextPageToken?: (string|null); + + /** ListMcpToolsResponse unreachable */ + unreachable?: (string[]|null); + } + + /** Represents a ListMcpToolsResponse. */ + class ListMcpToolsResponse implements IListMcpToolsResponse { + + /** + * Constructs a new ListMcpToolsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.apiregistry.v1.IListMcpToolsResponse); + + /** ListMcpToolsResponse mcpTools. */ + public mcpTools: google.cloud.apiregistry.v1.IMcpTool[]; + + /** ListMcpToolsResponse nextPageToken. */ + public nextPageToken: string; + + /** ListMcpToolsResponse unreachable. */ + public unreachable: string[]; + + /** + * Creates a new ListMcpToolsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListMcpToolsResponse instance + */ + public static create(properties?: google.cloud.apiregistry.v1.IListMcpToolsResponse): google.cloud.apiregistry.v1.ListMcpToolsResponse; + + /** + * Encodes the specified ListMcpToolsResponse message. Does not implicitly {@link google.cloud.apiregistry.v1.ListMcpToolsResponse.verify|verify} messages. + * @param message ListMcpToolsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.apiregistry.v1.IListMcpToolsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListMcpToolsResponse message, length delimited. Does not implicitly {@link google.cloud.apiregistry.v1.ListMcpToolsResponse.verify|verify} messages. + * @param message ListMcpToolsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.apiregistry.v1.IListMcpToolsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListMcpToolsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListMcpToolsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.apiregistry.v1.ListMcpToolsResponse; + + /** + * Decodes a ListMcpToolsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListMcpToolsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.apiregistry.v1.ListMcpToolsResponse; + + /** + * Verifies a ListMcpToolsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListMcpToolsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListMcpToolsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.apiregistry.v1.ListMcpToolsResponse; + + /** + * Creates a plain object from a ListMcpToolsResponse message. Also converts values to other types if specified. + * @param message ListMcpToolsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.apiregistry.v1.ListMcpToolsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListMcpToolsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListMcpToolsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + /** Namespace v1beta. */ namespace v1beta { diff --git a/packages/google-cloud-apiregistry/protos/protos.js b/packages/google-cloud-apiregistry/protos/protos.js index a0351c1e525..0cc0a5b1014 100644 --- a/packages/google-cloud-apiregistry/protos/protos.js +++ b/packages/google-cloud-apiregistry/protos/protos.js @@ -57,6 +57,2530 @@ */ var apiregistry = {}; + apiregistry.v1 = (function() { + + /** + * Namespace v1. + * @memberof google.cloud.apiregistry + * @namespace + */ + var v1 = {}; + + /** + * State enum. + * @name google.cloud.apiregistry.v1.State + * @enum {number} + * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value + * @property {number} ENABLED=1 ENABLED value + * @property {number} DISABLED=2 DISABLED value + */ + v1.State = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "ENABLED"] = 1; + values[valuesById[2] = "DISABLED"] = 2; + return values; + })(); + + v1.McpServer = (function() { + + /** + * Properties of a McpServer. + * @memberof google.cloud.apiregistry.v1 + * @interface IMcpServer + * @property {string|null} [name] McpServer name + * @property {string|null} [displayName] McpServer displayName + * @property {string|null} [description] McpServer description + * @property {Array.|null} [urls] McpServer urls + * @property {google.protobuf.IStruct|null} [capabilities] McpServer capabilities + * @property {google.cloud.apiregistry.v1.State|null} [state] McpServer state + */ + + /** + * Constructs a new McpServer. + * @memberof google.cloud.apiregistry.v1 + * @classdesc Represents a McpServer. + * @implements IMcpServer + * @constructor + * @param {google.cloud.apiregistry.v1.IMcpServer=} [properties] Properties to set + */ + function McpServer(properties) { + this.urls = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * McpServer name. + * @member {string} name + * @memberof google.cloud.apiregistry.v1.McpServer + * @instance + */ + McpServer.prototype.name = ""; + + /** + * McpServer displayName. + * @member {string} displayName + * @memberof google.cloud.apiregistry.v1.McpServer + * @instance + */ + McpServer.prototype.displayName = ""; + + /** + * McpServer description. + * @member {string} description + * @memberof google.cloud.apiregistry.v1.McpServer + * @instance + */ + McpServer.prototype.description = ""; + + /** + * McpServer urls. + * @member {Array.} urls + * @memberof google.cloud.apiregistry.v1.McpServer + * @instance + */ + McpServer.prototype.urls = $util.emptyArray; + + /** + * McpServer capabilities. + * @member {google.protobuf.IStruct|null|undefined} capabilities + * @memberof google.cloud.apiregistry.v1.McpServer + * @instance + */ + McpServer.prototype.capabilities = null; + + /** + * McpServer state. + * @member {google.cloud.apiregistry.v1.State} state + * @memberof google.cloud.apiregistry.v1.McpServer + * @instance + */ + McpServer.prototype.state = 0; + + /** + * Creates a new McpServer instance using the specified properties. + * @function create + * @memberof google.cloud.apiregistry.v1.McpServer + * @static + * @param {google.cloud.apiregistry.v1.IMcpServer=} [properties] Properties to set + * @returns {google.cloud.apiregistry.v1.McpServer} McpServer instance + */ + McpServer.create = function create(properties) { + return new McpServer(properties); + }; + + /** + * Encodes the specified McpServer message. Does not implicitly {@link google.cloud.apiregistry.v1.McpServer.verify|verify} messages. + * @function encode + * @memberof google.cloud.apiregistry.v1.McpServer + * @static + * @param {google.cloud.apiregistry.v1.IMcpServer} message McpServer message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + McpServer.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.displayName != null && Object.hasOwnProperty.call(message, "displayName")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.displayName); + if (message.description != null && Object.hasOwnProperty.call(message, "description")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.description); + if (message.urls != null && message.urls.length) + for (var i = 0; i < message.urls.length; ++i) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.urls[i]); + if (message.capabilities != null && Object.hasOwnProperty.call(message, "capabilities")) + $root.google.protobuf.Struct.encode(message.capabilities, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 7, wireType 0 =*/56).int32(message.state); + return writer; + }; + + /** + * Encodes the specified McpServer message, length delimited. Does not implicitly {@link google.cloud.apiregistry.v1.McpServer.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.apiregistry.v1.McpServer + * @static + * @param {google.cloud.apiregistry.v1.IMcpServer} message McpServer message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + McpServer.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a McpServer message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.apiregistry.v1.McpServer + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.apiregistry.v1.McpServer} McpServer + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + McpServer.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.apiregistry.v1.McpServer(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.displayName = reader.string(); + break; + } + case 3: { + message.description = reader.string(); + break; + } + case 4: { + if (!(message.urls && message.urls.length)) + message.urls = []; + message.urls.push(reader.string()); + break; + } + case 6: { + message.capabilities = $root.google.protobuf.Struct.decode(reader, reader.uint32()); + break; + } + case 7: { + message.state = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a McpServer message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.apiregistry.v1.McpServer + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.apiregistry.v1.McpServer} McpServer + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + McpServer.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a McpServer message. + * @function verify + * @memberof google.cloud.apiregistry.v1.McpServer + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + McpServer.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.displayName != null && message.hasOwnProperty("displayName")) + if (!$util.isString(message.displayName)) + return "displayName: string expected"; + if (message.description != null && message.hasOwnProperty("description")) + if (!$util.isString(message.description)) + return "description: string expected"; + if (message.urls != null && message.hasOwnProperty("urls")) { + if (!Array.isArray(message.urls)) + return "urls: array expected"; + for (var i = 0; i < message.urls.length; ++i) + if (!$util.isString(message.urls[i])) + return "urls: string[] expected"; + } + if (message.capabilities != null && message.hasOwnProperty("capabilities")) { + var error = $root.google.protobuf.Struct.verify(message.capabilities); + if (error) + return "capabilities." + error; + } + if (message.state != null && message.hasOwnProperty("state")) + switch (message.state) { + default: + return "state: enum value expected"; + case 0: + case 1: + case 2: + break; + } + return null; + }; + + /** + * Creates a McpServer message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.apiregistry.v1.McpServer + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.apiregistry.v1.McpServer} McpServer + */ + McpServer.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.apiregistry.v1.McpServer) + return object; + var message = new $root.google.cloud.apiregistry.v1.McpServer(); + if (object.name != null) + message.name = String(object.name); + if (object.displayName != null) + message.displayName = String(object.displayName); + if (object.description != null) + message.description = String(object.description); + if (object.urls) { + if (!Array.isArray(object.urls)) + throw TypeError(".google.cloud.apiregistry.v1.McpServer.urls: array expected"); + message.urls = []; + for (var i = 0; i < object.urls.length; ++i) + message.urls[i] = String(object.urls[i]); + } + if (object.capabilities != null) { + if (typeof object.capabilities !== "object") + throw TypeError(".google.cloud.apiregistry.v1.McpServer.capabilities: object expected"); + message.capabilities = $root.google.protobuf.Struct.fromObject(object.capabilities); + } + switch (object.state) { + default: + if (typeof object.state === "number") { + message.state = object.state; + break; + } + break; + case "STATE_UNSPECIFIED": + case 0: + message.state = 0; + break; + case "ENABLED": + case 1: + message.state = 1; + break; + case "DISABLED": + case 2: + message.state = 2; + break; + } + return message; + }; + + /** + * Creates a plain object from a McpServer message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.apiregistry.v1.McpServer + * @static + * @param {google.cloud.apiregistry.v1.McpServer} message McpServer + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + McpServer.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.urls = []; + if (options.defaults) { + object.name = ""; + object.displayName = ""; + object.description = ""; + object.capabilities = null; + object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.displayName != null && message.hasOwnProperty("displayName")) + object.displayName = message.displayName; + if (message.description != null && message.hasOwnProperty("description")) + object.description = message.description; + if (message.urls && message.urls.length) { + object.urls = []; + for (var j = 0; j < message.urls.length; ++j) + object.urls[j] = message.urls[j]; + } + if (message.capabilities != null && message.hasOwnProperty("capabilities")) + object.capabilities = $root.google.protobuf.Struct.toObject(message.capabilities, options); + if (message.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.google.cloud.apiregistry.v1.State[message.state] === undefined ? message.state : $root.google.cloud.apiregistry.v1.State[message.state] : message.state; + return object; + }; + + /** + * Converts this McpServer to JSON. + * @function toJSON + * @memberof google.cloud.apiregistry.v1.McpServer + * @instance + * @returns {Object.} JSON object + */ + McpServer.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for McpServer + * @function getTypeUrl + * @memberof google.cloud.apiregistry.v1.McpServer + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + McpServer.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.apiregistry.v1.McpServer"; + }; + + return McpServer; + })(); + + v1.McpTool = (function() { + + /** + * Properties of a McpTool. + * @memberof google.cloud.apiregistry.v1 + * @interface IMcpTool + * @property {string|null} [name] McpTool name + * @property {string|null} [displayName] McpTool displayName + * @property {string|null} [description] McpTool description + * @property {Array.|null} [mcpServerUrls] McpTool mcpServerUrls + * @property {google.protobuf.IStruct|null} [inputSchema] McpTool inputSchema + * @property {google.protobuf.IStruct|null} [outputSchema] McpTool outputSchema + * @property {google.protobuf.IStruct|null} [annotations] McpTool annotations + */ + + /** + * Constructs a new McpTool. + * @memberof google.cloud.apiregistry.v1 + * @classdesc Represents a McpTool. + * @implements IMcpTool + * @constructor + * @param {google.cloud.apiregistry.v1.IMcpTool=} [properties] Properties to set + */ + function McpTool(properties) { + this.mcpServerUrls = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * McpTool name. + * @member {string} name + * @memberof google.cloud.apiregistry.v1.McpTool + * @instance + */ + McpTool.prototype.name = ""; + + /** + * McpTool displayName. + * @member {string} displayName + * @memberof google.cloud.apiregistry.v1.McpTool + * @instance + */ + McpTool.prototype.displayName = ""; + + /** + * McpTool description. + * @member {string} description + * @memberof google.cloud.apiregistry.v1.McpTool + * @instance + */ + McpTool.prototype.description = ""; + + /** + * McpTool mcpServerUrls. + * @member {Array.} mcpServerUrls + * @memberof google.cloud.apiregistry.v1.McpTool + * @instance + */ + McpTool.prototype.mcpServerUrls = $util.emptyArray; + + /** + * McpTool inputSchema. + * @member {google.protobuf.IStruct|null|undefined} inputSchema + * @memberof google.cloud.apiregistry.v1.McpTool + * @instance + */ + McpTool.prototype.inputSchema = null; + + /** + * McpTool outputSchema. + * @member {google.protobuf.IStruct|null|undefined} outputSchema + * @memberof google.cloud.apiregistry.v1.McpTool + * @instance + */ + McpTool.prototype.outputSchema = null; + + /** + * McpTool annotations. + * @member {google.protobuf.IStruct|null|undefined} annotations + * @memberof google.cloud.apiregistry.v1.McpTool + * @instance + */ + McpTool.prototype.annotations = null; + + /** + * Creates a new McpTool instance using the specified properties. + * @function create + * @memberof google.cloud.apiregistry.v1.McpTool + * @static + * @param {google.cloud.apiregistry.v1.IMcpTool=} [properties] Properties to set + * @returns {google.cloud.apiregistry.v1.McpTool} McpTool instance + */ + McpTool.create = function create(properties) { + return new McpTool(properties); + }; + + /** + * Encodes the specified McpTool message. Does not implicitly {@link google.cloud.apiregistry.v1.McpTool.verify|verify} messages. + * @function encode + * @memberof google.cloud.apiregistry.v1.McpTool + * @static + * @param {google.cloud.apiregistry.v1.IMcpTool} message McpTool message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + McpTool.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.displayName != null && Object.hasOwnProperty.call(message, "displayName")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.displayName); + if (message.description != null && Object.hasOwnProperty.call(message, "description")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.description); + if (message.mcpServerUrls != null && message.mcpServerUrls.length) + for (var i = 0; i < message.mcpServerUrls.length; ++i) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.mcpServerUrls[i]); + if (message.inputSchema != null && Object.hasOwnProperty.call(message, "inputSchema")) + $root.google.protobuf.Struct.encode(message.inputSchema, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.outputSchema != null && Object.hasOwnProperty.call(message, "outputSchema")) + $root.google.protobuf.Struct.encode(message.outputSchema, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.annotations != null && Object.hasOwnProperty.call(message, "annotations")) + $root.google.protobuf.Struct.encode(message.annotations, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified McpTool message, length delimited. Does not implicitly {@link google.cloud.apiregistry.v1.McpTool.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.apiregistry.v1.McpTool + * @static + * @param {google.cloud.apiregistry.v1.IMcpTool} message McpTool message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + McpTool.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a McpTool message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.apiregistry.v1.McpTool + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.apiregistry.v1.McpTool} McpTool + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + McpTool.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.apiregistry.v1.McpTool(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.displayName = reader.string(); + break; + } + case 3: { + message.description = reader.string(); + break; + } + case 4: { + if (!(message.mcpServerUrls && message.mcpServerUrls.length)) + message.mcpServerUrls = []; + message.mcpServerUrls.push(reader.string()); + break; + } + case 5: { + message.inputSchema = $root.google.protobuf.Struct.decode(reader, reader.uint32()); + break; + } + case 6: { + message.outputSchema = $root.google.protobuf.Struct.decode(reader, reader.uint32()); + break; + } + case 7: { + message.annotations = $root.google.protobuf.Struct.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a McpTool message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.apiregistry.v1.McpTool + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.apiregistry.v1.McpTool} McpTool + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + McpTool.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a McpTool message. + * @function verify + * @memberof google.cloud.apiregistry.v1.McpTool + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + McpTool.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.displayName != null && message.hasOwnProperty("displayName")) + if (!$util.isString(message.displayName)) + return "displayName: string expected"; + if (message.description != null && message.hasOwnProperty("description")) + if (!$util.isString(message.description)) + return "description: string expected"; + if (message.mcpServerUrls != null && message.hasOwnProperty("mcpServerUrls")) { + if (!Array.isArray(message.mcpServerUrls)) + return "mcpServerUrls: array expected"; + for (var i = 0; i < message.mcpServerUrls.length; ++i) + if (!$util.isString(message.mcpServerUrls[i])) + return "mcpServerUrls: string[] expected"; + } + if (message.inputSchema != null && message.hasOwnProperty("inputSchema")) { + var error = $root.google.protobuf.Struct.verify(message.inputSchema); + if (error) + return "inputSchema." + error; + } + if (message.outputSchema != null && message.hasOwnProperty("outputSchema")) { + var error = $root.google.protobuf.Struct.verify(message.outputSchema); + if (error) + return "outputSchema." + error; + } + if (message.annotations != null && message.hasOwnProperty("annotations")) { + var error = $root.google.protobuf.Struct.verify(message.annotations); + if (error) + return "annotations." + error; + } + return null; + }; + + /** + * Creates a McpTool message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.apiregistry.v1.McpTool + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.apiregistry.v1.McpTool} McpTool + */ + McpTool.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.apiregistry.v1.McpTool) + return object; + var message = new $root.google.cloud.apiregistry.v1.McpTool(); + if (object.name != null) + message.name = String(object.name); + if (object.displayName != null) + message.displayName = String(object.displayName); + if (object.description != null) + message.description = String(object.description); + if (object.mcpServerUrls) { + if (!Array.isArray(object.mcpServerUrls)) + throw TypeError(".google.cloud.apiregistry.v1.McpTool.mcpServerUrls: array expected"); + message.mcpServerUrls = []; + for (var i = 0; i < object.mcpServerUrls.length; ++i) + message.mcpServerUrls[i] = String(object.mcpServerUrls[i]); + } + if (object.inputSchema != null) { + if (typeof object.inputSchema !== "object") + throw TypeError(".google.cloud.apiregistry.v1.McpTool.inputSchema: object expected"); + message.inputSchema = $root.google.protobuf.Struct.fromObject(object.inputSchema); + } + if (object.outputSchema != null) { + if (typeof object.outputSchema !== "object") + throw TypeError(".google.cloud.apiregistry.v1.McpTool.outputSchema: object expected"); + message.outputSchema = $root.google.protobuf.Struct.fromObject(object.outputSchema); + } + if (object.annotations != null) { + if (typeof object.annotations !== "object") + throw TypeError(".google.cloud.apiregistry.v1.McpTool.annotations: object expected"); + message.annotations = $root.google.protobuf.Struct.fromObject(object.annotations); + } + return message; + }; + + /** + * Creates a plain object from a McpTool message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.apiregistry.v1.McpTool + * @static + * @param {google.cloud.apiregistry.v1.McpTool} message McpTool + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + McpTool.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.mcpServerUrls = []; + if (options.defaults) { + object.name = ""; + object.displayName = ""; + object.description = ""; + object.inputSchema = null; + object.outputSchema = null; + object.annotations = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.displayName != null && message.hasOwnProperty("displayName")) + object.displayName = message.displayName; + if (message.description != null && message.hasOwnProperty("description")) + object.description = message.description; + if (message.mcpServerUrls && message.mcpServerUrls.length) { + object.mcpServerUrls = []; + for (var j = 0; j < message.mcpServerUrls.length; ++j) + object.mcpServerUrls[j] = message.mcpServerUrls[j]; + } + if (message.inputSchema != null && message.hasOwnProperty("inputSchema")) + object.inputSchema = $root.google.protobuf.Struct.toObject(message.inputSchema, options); + if (message.outputSchema != null && message.hasOwnProperty("outputSchema")) + object.outputSchema = $root.google.protobuf.Struct.toObject(message.outputSchema, options); + if (message.annotations != null && message.hasOwnProperty("annotations")) + object.annotations = $root.google.protobuf.Struct.toObject(message.annotations, options); + return object; + }; + + /** + * Converts this McpTool to JSON. + * @function toJSON + * @memberof google.cloud.apiregistry.v1.McpTool + * @instance + * @returns {Object.} JSON object + */ + McpTool.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for McpTool + * @function getTypeUrl + * @memberof google.cloud.apiregistry.v1.McpTool + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + McpTool.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.apiregistry.v1.McpTool"; + }; + + return McpTool; + })(); + + v1.CloudApiRegistry = (function() { + + /** + * Constructs a new CloudApiRegistry service. + * @memberof google.cloud.apiregistry.v1 + * @classdesc Represents a CloudApiRegistry + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function CloudApiRegistry(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (CloudApiRegistry.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = CloudApiRegistry; + + /** + * Creates new CloudApiRegistry service using the specified rpc implementation. + * @function create + * @memberof google.cloud.apiregistry.v1.CloudApiRegistry + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {CloudApiRegistry} RPC service. Useful where requests and/or responses are streamed. + */ + CloudApiRegistry.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.apiregistry.v1.CloudApiRegistry|getMcpServer}. + * @memberof google.cloud.apiregistry.v1.CloudApiRegistry + * @typedef GetMcpServerCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.apiregistry.v1.McpServer} [response] McpServer + */ + + /** + * Calls GetMcpServer. + * @function getMcpServer + * @memberof google.cloud.apiregistry.v1.CloudApiRegistry + * @instance + * @param {google.cloud.apiregistry.v1.IGetMcpServerRequest} request GetMcpServerRequest message or plain object + * @param {google.cloud.apiregistry.v1.CloudApiRegistry.GetMcpServerCallback} callback Node-style callback called with the error, if any, and McpServer + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CloudApiRegistry.prototype.getMcpServer = function getMcpServer(request, callback) { + return this.rpcCall(getMcpServer, $root.google.cloud.apiregistry.v1.GetMcpServerRequest, $root.google.cloud.apiregistry.v1.McpServer, request, callback); + }, "name", { value: "GetMcpServer" }); + + /** + * Calls GetMcpServer. + * @function getMcpServer + * @memberof google.cloud.apiregistry.v1.CloudApiRegistry + * @instance + * @param {google.cloud.apiregistry.v1.IGetMcpServerRequest} request GetMcpServerRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.apiregistry.v1.CloudApiRegistry|listMcpServers}. + * @memberof google.cloud.apiregistry.v1.CloudApiRegistry + * @typedef ListMcpServersCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.apiregistry.v1.ListMcpServersResponse} [response] ListMcpServersResponse + */ + + /** + * Calls ListMcpServers. + * @function listMcpServers + * @memberof google.cloud.apiregistry.v1.CloudApiRegistry + * @instance + * @param {google.cloud.apiregistry.v1.IListMcpServersRequest} request ListMcpServersRequest message or plain object + * @param {google.cloud.apiregistry.v1.CloudApiRegistry.ListMcpServersCallback} callback Node-style callback called with the error, if any, and ListMcpServersResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CloudApiRegistry.prototype.listMcpServers = function listMcpServers(request, callback) { + return this.rpcCall(listMcpServers, $root.google.cloud.apiregistry.v1.ListMcpServersRequest, $root.google.cloud.apiregistry.v1.ListMcpServersResponse, request, callback); + }, "name", { value: "ListMcpServers" }); + + /** + * Calls ListMcpServers. + * @function listMcpServers + * @memberof google.cloud.apiregistry.v1.CloudApiRegistry + * @instance + * @param {google.cloud.apiregistry.v1.IListMcpServersRequest} request ListMcpServersRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.apiregistry.v1.CloudApiRegistry|getMcpTool}. + * @memberof google.cloud.apiregistry.v1.CloudApiRegistry + * @typedef GetMcpToolCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.apiregistry.v1.McpTool} [response] McpTool + */ + + /** + * Calls GetMcpTool. + * @function getMcpTool + * @memberof google.cloud.apiregistry.v1.CloudApiRegistry + * @instance + * @param {google.cloud.apiregistry.v1.IGetMcpToolRequest} request GetMcpToolRequest message or plain object + * @param {google.cloud.apiregistry.v1.CloudApiRegistry.GetMcpToolCallback} callback Node-style callback called with the error, if any, and McpTool + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CloudApiRegistry.prototype.getMcpTool = function getMcpTool(request, callback) { + return this.rpcCall(getMcpTool, $root.google.cloud.apiregistry.v1.GetMcpToolRequest, $root.google.cloud.apiregistry.v1.McpTool, request, callback); + }, "name", { value: "GetMcpTool" }); + + /** + * Calls GetMcpTool. + * @function getMcpTool + * @memberof google.cloud.apiregistry.v1.CloudApiRegistry + * @instance + * @param {google.cloud.apiregistry.v1.IGetMcpToolRequest} request GetMcpToolRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.apiregistry.v1.CloudApiRegistry|listMcpTools}. + * @memberof google.cloud.apiregistry.v1.CloudApiRegistry + * @typedef ListMcpToolsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.apiregistry.v1.ListMcpToolsResponse} [response] ListMcpToolsResponse + */ + + /** + * Calls ListMcpTools. + * @function listMcpTools + * @memberof google.cloud.apiregistry.v1.CloudApiRegistry + * @instance + * @param {google.cloud.apiregistry.v1.IListMcpToolsRequest} request ListMcpToolsRequest message or plain object + * @param {google.cloud.apiregistry.v1.CloudApiRegistry.ListMcpToolsCallback} callback Node-style callback called with the error, if any, and ListMcpToolsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(CloudApiRegistry.prototype.listMcpTools = function listMcpTools(request, callback) { + return this.rpcCall(listMcpTools, $root.google.cloud.apiregistry.v1.ListMcpToolsRequest, $root.google.cloud.apiregistry.v1.ListMcpToolsResponse, request, callback); + }, "name", { value: "ListMcpTools" }); + + /** + * Calls ListMcpTools. + * @function listMcpTools + * @memberof google.cloud.apiregistry.v1.CloudApiRegistry + * @instance + * @param {google.cloud.apiregistry.v1.IListMcpToolsRequest} request ListMcpToolsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return CloudApiRegistry; + })(); + + v1.GetMcpServerRequest = (function() { + + /** + * Properties of a GetMcpServerRequest. + * @memberof google.cloud.apiregistry.v1 + * @interface IGetMcpServerRequest + * @property {string|null} [name] GetMcpServerRequest name + */ + + /** + * Constructs a new GetMcpServerRequest. + * @memberof google.cloud.apiregistry.v1 + * @classdesc Represents a GetMcpServerRequest. + * @implements IGetMcpServerRequest + * @constructor + * @param {google.cloud.apiregistry.v1.IGetMcpServerRequest=} [properties] Properties to set + */ + function GetMcpServerRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetMcpServerRequest name. + * @member {string} name + * @memberof google.cloud.apiregistry.v1.GetMcpServerRequest + * @instance + */ + GetMcpServerRequest.prototype.name = ""; + + /** + * Creates a new GetMcpServerRequest instance using the specified properties. + * @function create + * @memberof google.cloud.apiregistry.v1.GetMcpServerRequest + * @static + * @param {google.cloud.apiregistry.v1.IGetMcpServerRequest=} [properties] Properties to set + * @returns {google.cloud.apiregistry.v1.GetMcpServerRequest} GetMcpServerRequest instance + */ + GetMcpServerRequest.create = function create(properties) { + return new GetMcpServerRequest(properties); + }; + + /** + * Encodes the specified GetMcpServerRequest message. Does not implicitly {@link google.cloud.apiregistry.v1.GetMcpServerRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.apiregistry.v1.GetMcpServerRequest + * @static + * @param {google.cloud.apiregistry.v1.IGetMcpServerRequest} message GetMcpServerRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetMcpServerRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified GetMcpServerRequest message, length delimited. Does not implicitly {@link google.cloud.apiregistry.v1.GetMcpServerRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.apiregistry.v1.GetMcpServerRequest + * @static + * @param {google.cloud.apiregistry.v1.IGetMcpServerRequest} message GetMcpServerRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetMcpServerRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetMcpServerRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.apiregistry.v1.GetMcpServerRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.apiregistry.v1.GetMcpServerRequest} GetMcpServerRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetMcpServerRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.apiregistry.v1.GetMcpServerRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetMcpServerRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.apiregistry.v1.GetMcpServerRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.apiregistry.v1.GetMcpServerRequest} GetMcpServerRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetMcpServerRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetMcpServerRequest message. + * @function verify + * @memberof google.cloud.apiregistry.v1.GetMcpServerRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetMcpServerRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a GetMcpServerRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.apiregistry.v1.GetMcpServerRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.apiregistry.v1.GetMcpServerRequest} GetMcpServerRequest + */ + GetMcpServerRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.apiregistry.v1.GetMcpServerRequest) + return object; + var message = new $root.google.cloud.apiregistry.v1.GetMcpServerRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetMcpServerRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.apiregistry.v1.GetMcpServerRequest + * @static + * @param {google.cloud.apiregistry.v1.GetMcpServerRequest} message GetMcpServerRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetMcpServerRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this GetMcpServerRequest to JSON. + * @function toJSON + * @memberof google.cloud.apiregistry.v1.GetMcpServerRequest + * @instance + * @returns {Object.} JSON object + */ + GetMcpServerRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetMcpServerRequest + * @function getTypeUrl + * @memberof google.cloud.apiregistry.v1.GetMcpServerRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetMcpServerRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.apiregistry.v1.GetMcpServerRequest"; + }; + + return GetMcpServerRequest; + })(); + + v1.ListMcpServersRequest = (function() { + + /** + * Properties of a ListMcpServersRequest. + * @memberof google.cloud.apiregistry.v1 + * @interface IListMcpServersRequest + * @property {string|null} [parent] ListMcpServersRequest parent + * @property {number|null} [pageSize] ListMcpServersRequest pageSize + * @property {string|null} [pageToken] ListMcpServersRequest pageToken + * @property {string|null} [filter] ListMcpServersRequest filter + * @property {string|null} [orderBy] ListMcpServersRequest orderBy + */ + + /** + * Constructs a new ListMcpServersRequest. + * @memberof google.cloud.apiregistry.v1 + * @classdesc Represents a ListMcpServersRequest. + * @implements IListMcpServersRequest + * @constructor + * @param {google.cloud.apiregistry.v1.IListMcpServersRequest=} [properties] Properties to set + */ + function ListMcpServersRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListMcpServersRequest parent. + * @member {string} parent + * @memberof google.cloud.apiregistry.v1.ListMcpServersRequest + * @instance + */ + ListMcpServersRequest.prototype.parent = ""; + + /** + * ListMcpServersRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.apiregistry.v1.ListMcpServersRequest + * @instance + */ + ListMcpServersRequest.prototype.pageSize = 0; + + /** + * ListMcpServersRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.apiregistry.v1.ListMcpServersRequest + * @instance + */ + ListMcpServersRequest.prototype.pageToken = ""; + + /** + * ListMcpServersRequest filter. + * @member {string} filter + * @memberof google.cloud.apiregistry.v1.ListMcpServersRequest + * @instance + */ + ListMcpServersRequest.prototype.filter = ""; + + /** + * ListMcpServersRequest orderBy. + * @member {string} orderBy + * @memberof google.cloud.apiregistry.v1.ListMcpServersRequest + * @instance + */ + ListMcpServersRequest.prototype.orderBy = ""; + + /** + * Creates a new ListMcpServersRequest instance using the specified properties. + * @function create + * @memberof google.cloud.apiregistry.v1.ListMcpServersRequest + * @static + * @param {google.cloud.apiregistry.v1.IListMcpServersRequest=} [properties] Properties to set + * @returns {google.cloud.apiregistry.v1.ListMcpServersRequest} ListMcpServersRequest instance + */ + ListMcpServersRequest.create = function create(properties) { + return new ListMcpServersRequest(properties); + }; + + /** + * Encodes the specified ListMcpServersRequest message. Does not implicitly {@link google.cloud.apiregistry.v1.ListMcpServersRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.apiregistry.v1.ListMcpServersRequest + * @static + * @param {google.cloud.apiregistry.v1.IListMcpServersRequest} message ListMcpServersRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListMcpServersRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.filter); + if (message.orderBy != null && Object.hasOwnProperty.call(message, "orderBy")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.orderBy); + return writer; + }; + + /** + * Encodes the specified ListMcpServersRequest message, length delimited. Does not implicitly {@link google.cloud.apiregistry.v1.ListMcpServersRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.apiregistry.v1.ListMcpServersRequest + * @static + * @param {google.cloud.apiregistry.v1.IListMcpServersRequest} message ListMcpServersRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListMcpServersRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListMcpServersRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.apiregistry.v1.ListMcpServersRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.apiregistry.v1.ListMcpServersRequest} ListMcpServersRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListMcpServersRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.apiregistry.v1.ListMcpServersRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.pageSize = reader.int32(); + break; + } + case 3: { + message.pageToken = reader.string(); + break; + } + case 4: { + message.filter = reader.string(); + break; + } + case 5: { + message.orderBy = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListMcpServersRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.apiregistry.v1.ListMcpServersRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.apiregistry.v1.ListMcpServersRequest} ListMcpServersRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListMcpServersRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListMcpServersRequest message. + * @function verify + * @memberof google.cloud.apiregistry.v1.ListMcpServersRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListMcpServersRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + if (!$util.isString(message.orderBy)) + return "orderBy: string expected"; + return null; + }; + + /** + * Creates a ListMcpServersRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.apiregistry.v1.ListMcpServersRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.apiregistry.v1.ListMcpServersRequest} ListMcpServersRequest + */ + ListMcpServersRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.apiregistry.v1.ListMcpServersRequest) + return object; + var message = new $root.google.cloud.apiregistry.v1.ListMcpServersRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + if (object.filter != null) + message.filter = String(object.filter); + if (object.orderBy != null) + message.orderBy = String(object.orderBy); + return message; + }; + + /** + * Creates a plain object from a ListMcpServersRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.apiregistry.v1.ListMcpServersRequest + * @static + * @param {google.cloud.apiregistry.v1.ListMcpServersRequest} message ListMcpServersRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListMcpServersRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.pageSize = 0; + object.pageToken = ""; + object.filter = ""; + object.orderBy = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + object.orderBy = message.orderBy; + return object; + }; + + /** + * Converts this ListMcpServersRequest to JSON. + * @function toJSON + * @memberof google.cloud.apiregistry.v1.ListMcpServersRequest + * @instance + * @returns {Object.} JSON object + */ + ListMcpServersRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListMcpServersRequest + * @function getTypeUrl + * @memberof google.cloud.apiregistry.v1.ListMcpServersRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListMcpServersRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.apiregistry.v1.ListMcpServersRequest"; + }; + + return ListMcpServersRequest; + })(); + + v1.ListMcpServersResponse = (function() { + + /** + * Properties of a ListMcpServersResponse. + * @memberof google.cloud.apiregistry.v1 + * @interface IListMcpServersResponse + * @property {Array.|null} [mcpServers] ListMcpServersResponse mcpServers + * @property {string|null} [nextPageToken] ListMcpServersResponse nextPageToken + * @property {Array.|null} [unreachable] ListMcpServersResponse unreachable + */ + + /** + * Constructs a new ListMcpServersResponse. + * @memberof google.cloud.apiregistry.v1 + * @classdesc Represents a ListMcpServersResponse. + * @implements IListMcpServersResponse + * @constructor + * @param {google.cloud.apiregistry.v1.IListMcpServersResponse=} [properties] Properties to set + */ + function ListMcpServersResponse(properties) { + this.mcpServers = []; + this.unreachable = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListMcpServersResponse mcpServers. + * @member {Array.} mcpServers + * @memberof google.cloud.apiregistry.v1.ListMcpServersResponse + * @instance + */ + ListMcpServersResponse.prototype.mcpServers = $util.emptyArray; + + /** + * ListMcpServersResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.apiregistry.v1.ListMcpServersResponse + * @instance + */ + ListMcpServersResponse.prototype.nextPageToken = ""; + + /** + * ListMcpServersResponse unreachable. + * @member {Array.} unreachable + * @memberof google.cloud.apiregistry.v1.ListMcpServersResponse + * @instance + */ + ListMcpServersResponse.prototype.unreachable = $util.emptyArray; + + /** + * Creates a new ListMcpServersResponse instance using the specified properties. + * @function create + * @memberof google.cloud.apiregistry.v1.ListMcpServersResponse + * @static + * @param {google.cloud.apiregistry.v1.IListMcpServersResponse=} [properties] Properties to set + * @returns {google.cloud.apiregistry.v1.ListMcpServersResponse} ListMcpServersResponse instance + */ + ListMcpServersResponse.create = function create(properties) { + return new ListMcpServersResponse(properties); + }; + + /** + * Encodes the specified ListMcpServersResponse message. Does not implicitly {@link google.cloud.apiregistry.v1.ListMcpServersResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.apiregistry.v1.ListMcpServersResponse + * @static + * @param {google.cloud.apiregistry.v1.IListMcpServersResponse} message ListMcpServersResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListMcpServersResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.mcpServers != null && message.mcpServers.length) + for (var i = 0; i < message.mcpServers.length; ++i) + $root.google.cloud.apiregistry.v1.McpServer.encode(message.mcpServers[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + if (message.unreachable != null && message.unreachable.length) + for (var i = 0; i < message.unreachable.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.unreachable[i]); + return writer; + }; + + /** + * Encodes the specified ListMcpServersResponse message, length delimited. Does not implicitly {@link google.cloud.apiregistry.v1.ListMcpServersResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.apiregistry.v1.ListMcpServersResponse + * @static + * @param {google.cloud.apiregistry.v1.IListMcpServersResponse} message ListMcpServersResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListMcpServersResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListMcpServersResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.apiregistry.v1.ListMcpServersResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.apiregistry.v1.ListMcpServersResponse} ListMcpServersResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListMcpServersResponse.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.apiregistry.v1.ListMcpServersResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.mcpServers && message.mcpServers.length)) + message.mcpServers = []; + message.mcpServers.push($root.google.cloud.apiregistry.v1.McpServer.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + case 3: { + if (!(message.unreachable && message.unreachable.length)) + message.unreachable = []; + message.unreachable.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListMcpServersResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.apiregistry.v1.ListMcpServersResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.apiregistry.v1.ListMcpServersResponse} ListMcpServersResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListMcpServersResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListMcpServersResponse message. + * @function verify + * @memberof google.cloud.apiregistry.v1.ListMcpServersResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListMcpServersResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.mcpServers != null && message.hasOwnProperty("mcpServers")) { + if (!Array.isArray(message.mcpServers)) + return "mcpServers: array expected"; + for (var i = 0; i < message.mcpServers.length; ++i) { + var error = $root.google.cloud.apiregistry.v1.McpServer.verify(message.mcpServers[i]); + if (error) + return "mcpServers." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + if (message.unreachable != null && message.hasOwnProperty("unreachable")) { + if (!Array.isArray(message.unreachable)) + return "unreachable: array expected"; + for (var i = 0; i < message.unreachable.length; ++i) + if (!$util.isString(message.unreachable[i])) + return "unreachable: string[] expected"; + } + return null; + }; + + /** + * Creates a ListMcpServersResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.apiregistry.v1.ListMcpServersResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.apiregistry.v1.ListMcpServersResponse} ListMcpServersResponse + */ + ListMcpServersResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.apiregistry.v1.ListMcpServersResponse) + return object; + var message = new $root.google.cloud.apiregistry.v1.ListMcpServersResponse(); + if (object.mcpServers) { + if (!Array.isArray(object.mcpServers)) + throw TypeError(".google.cloud.apiregistry.v1.ListMcpServersResponse.mcpServers: array expected"); + message.mcpServers = []; + for (var i = 0; i < object.mcpServers.length; ++i) { + if (typeof object.mcpServers[i] !== "object") + throw TypeError(".google.cloud.apiregistry.v1.ListMcpServersResponse.mcpServers: object expected"); + message.mcpServers[i] = $root.google.cloud.apiregistry.v1.McpServer.fromObject(object.mcpServers[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + if (object.unreachable) { + if (!Array.isArray(object.unreachable)) + throw TypeError(".google.cloud.apiregistry.v1.ListMcpServersResponse.unreachable: array expected"); + message.unreachable = []; + for (var i = 0; i < object.unreachable.length; ++i) + message.unreachable[i] = String(object.unreachable[i]); + } + return message; + }; + + /** + * Creates a plain object from a ListMcpServersResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.apiregistry.v1.ListMcpServersResponse + * @static + * @param {google.cloud.apiregistry.v1.ListMcpServersResponse} message ListMcpServersResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListMcpServersResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.mcpServers = []; + object.unreachable = []; + } + if (options.defaults) + object.nextPageToken = ""; + if (message.mcpServers && message.mcpServers.length) { + object.mcpServers = []; + for (var j = 0; j < message.mcpServers.length; ++j) + object.mcpServers[j] = $root.google.cloud.apiregistry.v1.McpServer.toObject(message.mcpServers[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + if (message.unreachable && message.unreachable.length) { + object.unreachable = []; + for (var j = 0; j < message.unreachable.length; ++j) + object.unreachable[j] = message.unreachable[j]; + } + return object; + }; + + /** + * Converts this ListMcpServersResponse to JSON. + * @function toJSON + * @memberof google.cloud.apiregistry.v1.ListMcpServersResponse + * @instance + * @returns {Object.} JSON object + */ + ListMcpServersResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListMcpServersResponse + * @function getTypeUrl + * @memberof google.cloud.apiregistry.v1.ListMcpServersResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListMcpServersResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.apiregistry.v1.ListMcpServersResponse"; + }; + + return ListMcpServersResponse; + })(); + + v1.GetMcpToolRequest = (function() { + + /** + * Properties of a GetMcpToolRequest. + * @memberof google.cloud.apiregistry.v1 + * @interface IGetMcpToolRequest + * @property {string|null} [name] GetMcpToolRequest name + */ + + /** + * Constructs a new GetMcpToolRequest. + * @memberof google.cloud.apiregistry.v1 + * @classdesc Represents a GetMcpToolRequest. + * @implements IGetMcpToolRequest + * @constructor + * @param {google.cloud.apiregistry.v1.IGetMcpToolRequest=} [properties] Properties to set + */ + function GetMcpToolRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetMcpToolRequest name. + * @member {string} name + * @memberof google.cloud.apiregistry.v1.GetMcpToolRequest + * @instance + */ + GetMcpToolRequest.prototype.name = ""; + + /** + * Creates a new GetMcpToolRequest instance using the specified properties. + * @function create + * @memberof google.cloud.apiregistry.v1.GetMcpToolRequest + * @static + * @param {google.cloud.apiregistry.v1.IGetMcpToolRequest=} [properties] Properties to set + * @returns {google.cloud.apiregistry.v1.GetMcpToolRequest} GetMcpToolRequest instance + */ + GetMcpToolRequest.create = function create(properties) { + return new GetMcpToolRequest(properties); + }; + + /** + * Encodes the specified GetMcpToolRequest message. Does not implicitly {@link google.cloud.apiregistry.v1.GetMcpToolRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.apiregistry.v1.GetMcpToolRequest + * @static + * @param {google.cloud.apiregistry.v1.IGetMcpToolRequest} message GetMcpToolRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetMcpToolRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified GetMcpToolRequest message, length delimited. Does not implicitly {@link google.cloud.apiregistry.v1.GetMcpToolRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.apiregistry.v1.GetMcpToolRequest + * @static + * @param {google.cloud.apiregistry.v1.IGetMcpToolRequest} message GetMcpToolRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetMcpToolRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetMcpToolRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.apiregistry.v1.GetMcpToolRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.apiregistry.v1.GetMcpToolRequest} GetMcpToolRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetMcpToolRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.apiregistry.v1.GetMcpToolRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetMcpToolRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.apiregistry.v1.GetMcpToolRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.apiregistry.v1.GetMcpToolRequest} GetMcpToolRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetMcpToolRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetMcpToolRequest message. + * @function verify + * @memberof google.cloud.apiregistry.v1.GetMcpToolRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetMcpToolRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a GetMcpToolRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.apiregistry.v1.GetMcpToolRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.apiregistry.v1.GetMcpToolRequest} GetMcpToolRequest + */ + GetMcpToolRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.apiregistry.v1.GetMcpToolRequest) + return object; + var message = new $root.google.cloud.apiregistry.v1.GetMcpToolRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetMcpToolRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.apiregistry.v1.GetMcpToolRequest + * @static + * @param {google.cloud.apiregistry.v1.GetMcpToolRequest} message GetMcpToolRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetMcpToolRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this GetMcpToolRequest to JSON. + * @function toJSON + * @memberof google.cloud.apiregistry.v1.GetMcpToolRequest + * @instance + * @returns {Object.} JSON object + */ + GetMcpToolRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetMcpToolRequest + * @function getTypeUrl + * @memberof google.cloud.apiregistry.v1.GetMcpToolRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetMcpToolRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.apiregistry.v1.GetMcpToolRequest"; + }; + + return GetMcpToolRequest; + })(); + + v1.ListMcpToolsRequest = (function() { + + /** + * Properties of a ListMcpToolsRequest. + * @memberof google.cloud.apiregistry.v1 + * @interface IListMcpToolsRequest + * @property {string|null} [parent] ListMcpToolsRequest parent + * @property {number|null} [pageSize] ListMcpToolsRequest pageSize + * @property {string|null} [pageToken] ListMcpToolsRequest pageToken + * @property {string|null} [filter] ListMcpToolsRequest filter + * @property {string|null} [orderBy] ListMcpToolsRequest orderBy + */ + + /** + * Constructs a new ListMcpToolsRequest. + * @memberof google.cloud.apiregistry.v1 + * @classdesc Represents a ListMcpToolsRequest. + * @implements IListMcpToolsRequest + * @constructor + * @param {google.cloud.apiregistry.v1.IListMcpToolsRequest=} [properties] Properties to set + */ + function ListMcpToolsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListMcpToolsRequest parent. + * @member {string} parent + * @memberof google.cloud.apiregistry.v1.ListMcpToolsRequest + * @instance + */ + ListMcpToolsRequest.prototype.parent = ""; + + /** + * ListMcpToolsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.apiregistry.v1.ListMcpToolsRequest + * @instance + */ + ListMcpToolsRequest.prototype.pageSize = 0; + + /** + * ListMcpToolsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.apiregistry.v1.ListMcpToolsRequest + * @instance + */ + ListMcpToolsRequest.prototype.pageToken = ""; + + /** + * ListMcpToolsRequest filter. + * @member {string} filter + * @memberof google.cloud.apiregistry.v1.ListMcpToolsRequest + * @instance + */ + ListMcpToolsRequest.prototype.filter = ""; + + /** + * ListMcpToolsRequest orderBy. + * @member {string} orderBy + * @memberof google.cloud.apiregistry.v1.ListMcpToolsRequest + * @instance + */ + ListMcpToolsRequest.prototype.orderBy = ""; + + /** + * Creates a new ListMcpToolsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.apiregistry.v1.ListMcpToolsRequest + * @static + * @param {google.cloud.apiregistry.v1.IListMcpToolsRequest=} [properties] Properties to set + * @returns {google.cloud.apiregistry.v1.ListMcpToolsRequest} ListMcpToolsRequest instance + */ + ListMcpToolsRequest.create = function create(properties) { + return new ListMcpToolsRequest(properties); + }; + + /** + * Encodes the specified ListMcpToolsRequest message. Does not implicitly {@link google.cloud.apiregistry.v1.ListMcpToolsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.apiregistry.v1.ListMcpToolsRequest + * @static + * @param {google.cloud.apiregistry.v1.IListMcpToolsRequest} message ListMcpToolsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListMcpToolsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.filter); + if (message.orderBy != null && Object.hasOwnProperty.call(message, "orderBy")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.orderBy); + return writer; + }; + + /** + * Encodes the specified ListMcpToolsRequest message, length delimited. Does not implicitly {@link google.cloud.apiregistry.v1.ListMcpToolsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.apiregistry.v1.ListMcpToolsRequest + * @static + * @param {google.cloud.apiregistry.v1.IListMcpToolsRequest} message ListMcpToolsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListMcpToolsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListMcpToolsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.apiregistry.v1.ListMcpToolsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.apiregistry.v1.ListMcpToolsRequest} ListMcpToolsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListMcpToolsRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.apiregistry.v1.ListMcpToolsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.pageSize = reader.int32(); + break; + } + case 3: { + message.pageToken = reader.string(); + break; + } + case 4: { + message.filter = reader.string(); + break; + } + case 5: { + message.orderBy = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListMcpToolsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.apiregistry.v1.ListMcpToolsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.apiregistry.v1.ListMcpToolsRequest} ListMcpToolsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListMcpToolsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListMcpToolsRequest message. + * @function verify + * @memberof google.cloud.apiregistry.v1.ListMcpToolsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListMcpToolsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + if (!$util.isString(message.orderBy)) + return "orderBy: string expected"; + return null; + }; + + /** + * Creates a ListMcpToolsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.apiregistry.v1.ListMcpToolsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.apiregistry.v1.ListMcpToolsRequest} ListMcpToolsRequest + */ + ListMcpToolsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.apiregistry.v1.ListMcpToolsRequest) + return object; + var message = new $root.google.cloud.apiregistry.v1.ListMcpToolsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + if (object.filter != null) + message.filter = String(object.filter); + if (object.orderBy != null) + message.orderBy = String(object.orderBy); + return message; + }; + + /** + * Creates a plain object from a ListMcpToolsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.apiregistry.v1.ListMcpToolsRequest + * @static + * @param {google.cloud.apiregistry.v1.ListMcpToolsRequest} message ListMcpToolsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListMcpToolsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.pageSize = 0; + object.pageToken = ""; + object.filter = ""; + object.orderBy = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + object.orderBy = message.orderBy; + return object; + }; + + /** + * Converts this ListMcpToolsRequest to JSON. + * @function toJSON + * @memberof google.cloud.apiregistry.v1.ListMcpToolsRequest + * @instance + * @returns {Object.} JSON object + */ + ListMcpToolsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListMcpToolsRequest + * @function getTypeUrl + * @memberof google.cloud.apiregistry.v1.ListMcpToolsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListMcpToolsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.apiregistry.v1.ListMcpToolsRequest"; + }; + + return ListMcpToolsRequest; + })(); + + v1.ListMcpToolsResponse = (function() { + + /** + * Properties of a ListMcpToolsResponse. + * @memberof google.cloud.apiregistry.v1 + * @interface IListMcpToolsResponse + * @property {Array.|null} [mcpTools] ListMcpToolsResponse mcpTools + * @property {string|null} [nextPageToken] ListMcpToolsResponse nextPageToken + * @property {Array.|null} [unreachable] ListMcpToolsResponse unreachable + */ + + /** + * Constructs a new ListMcpToolsResponse. + * @memberof google.cloud.apiregistry.v1 + * @classdesc Represents a ListMcpToolsResponse. + * @implements IListMcpToolsResponse + * @constructor + * @param {google.cloud.apiregistry.v1.IListMcpToolsResponse=} [properties] Properties to set + */ + function ListMcpToolsResponse(properties) { + this.mcpTools = []; + this.unreachable = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListMcpToolsResponse mcpTools. + * @member {Array.} mcpTools + * @memberof google.cloud.apiregistry.v1.ListMcpToolsResponse + * @instance + */ + ListMcpToolsResponse.prototype.mcpTools = $util.emptyArray; + + /** + * ListMcpToolsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.apiregistry.v1.ListMcpToolsResponse + * @instance + */ + ListMcpToolsResponse.prototype.nextPageToken = ""; + + /** + * ListMcpToolsResponse unreachable. + * @member {Array.} unreachable + * @memberof google.cloud.apiregistry.v1.ListMcpToolsResponse + * @instance + */ + ListMcpToolsResponse.prototype.unreachable = $util.emptyArray; + + /** + * Creates a new ListMcpToolsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.apiregistry.v1.ListMcpToolsResponse + * @static + * @param {google.cloud.apiregistry.v1.IListMcpToolsResponse=} [properties] Properties to set + * @returns {google.cloud.apiregistry.v1.ListMcpToolsResponse} ListMcpToolsResponse instance + */ + ListMcpToolsResponse.create = function create(properties) { + return new ListMcpToolsResponse(properties); + }; + + /** + * Encodes the specified ListMcpToolsResponse message. Does not implicitly {@link google.cloud.apiregistry.v1.ListMcpToolsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.apiregistry.v1.ListMcpToolsResponse + * @static + * @param {google.cloud.apiregistry.v1.IListMcpToolsResponse} message ListMcpToolsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListMcpToolsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.mcpTools != null && message.mcpTools.length) + for (var i = 0; i < message.mcpTools.length; ++i) + $root.google.cloud.apiregistry.v1.McpTool.encode(message.mcpTools[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + if (message.unreachable != null && message.unreachable.length) + for (var i = 0; i < message.unreachable.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.unreachable[i]); + return writer; + }; + + /** + * Encodes the specified ListMcpToolsResponse message, length delimited. Does not implicitly {@link google.cloud.apiregistry.v1.ListMcpToolsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.apiregistry.v1.ListMcpToolsResponse + * @static + * @param {google.cloud.apiregistry.v1.IListMcpToolsResponse} message ListMcpToolsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListMcpToolsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListMcpToolsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.apiregistry.v1.ListMcpToolsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.apiregistry.v1.ListMcpToolsResponse} ListMcpToolsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListMcpToolsResponse.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.apiregistry.v1.ListMcpToolsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.mcpTools && message.mcpTools.length)) + message.mcpTools = []; + message.mcpTools.push($root.google.cloud.apiregistry.v1.McpTool.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + case 3: { + if (!(message.unreachable && message.unreachable.length)) + message.unreachable = []; + message.unreachable.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListMcpToolsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.apiregistry.v1.ListMcpToolsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.apiregistry.v1.ListMcpToolsResponse} ListMcpToolsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListMcpToolsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListMcpToolsResponse message. + * @function verify + * @memberof google.cloud.apiregistry.v1.ListMcpToolsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListMcpToolsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.mcpTools != null && message.hasOwnProperty("mcpTools")) { + if (!Array.isArray(message.mcpTools)) + return "mcpTools: array expected"; + for (var i = 0; i < message.mcpTools.length; ++i) { + var error = $root.google.cloud.apiregistry.v1.McpTool.verify(message.mcpTools[i]); + if (error) + return "mcpTools." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + if (message.unreachable != null && message.hasOwnProperty("unreachable")) { + if (!Array.isArray(message.unreachable)) + return "unreachable: array expected"; + for (var i = 0; i < message.unreachable.length; ++i) + if (!$util.isString(message.unreachable[i])) + return "unreachable: string[] expected"; + } + return null; + }; + + /** + * Creates a ListMcpToolsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.apiregistry.v1.ListMcpToolsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.apiregistry.v1.ListMcpToolsResponse} ListMcpToolsResponse + */ + ListMcpToolsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.apiregistry.v1.ListMcpToolsResponse) + return object; + var message = new $root.google.cloud.apiregistry.v1.ListMcpToolsResponse(); + if (object.mcpTools) { + if (!Array.isArray(object.mcpTools)) + throw TypeError(".google.cloud.apiregistry.v1.ListMcpToolsResponse.mcpTools: array expected"); + message.mcpTools = []; + for (var i = 0; i < object.mcpTools.length; ++i) { + if (typeof object.mcpTools[i] !== "object") + throw TypeError(".google.cloud.apiregistry.v1.ListMcpToolsResponse.mcpTools: object expected"); + message.mcpTools[i] = $root.google.cloud.apiregistry.v1.McpTool.fromObject(object.mcpTools[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + if (object.unreachable) { + if (!Array.isArray(object.unreachable)) + throw TypeError(".google.cloud.apiregistry.v1.ListMcpToolsResponse.unreachable: array expected"); + message.unreachable = []; + for (var i = 0; i < object.unreachable.length; ++i) + message.unreachable[i] = String(object.unreachable[i]); + } + return message; + }; + + /** + * Creates a plain object from a ListMcpToolsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.apiregistry.v1.ListMcpToolsResponse + * @static + * @param {google.cloud.apiregistry.v1.ListMcpToolsResponse} message ListMcpToolsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListMcpToolsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.mcpTools = []; + object.unreachable = []; + } + if (options.defaults) + object.nextPageToken = ""; + if (message.mcpTools && message.mcpTools.length) { + object.mcpTools = []; + for (var j = 0; j < message.mcpTools.length; ++j) + object.mcpTools[j] = $root.google.cloud.apiregistry.v1.McpTool.toObject(message.mcpTools[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + if (message.unreachable && message.unreachable.length) { + object.unreachable = []; + for (var j = 0; j < message.unreachable.length; ++j) + object.unreachable[j] = message.unreachable[j]; + } + return object; + }; + + /** + * Converts this ListMcpToolsResponse to JSON. + * @function toJSON + * @memberof google.cloud.apiregistry.v1.ListMcpToolsResponse + * @instance + * @returns {Object.} JSON object + */ + ListMcpToolsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListMcpToolsResponse + * @function getTypeUrl + * @memberof google.cloud.apiregistry.v1.ListMcpToolsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListMcpToolsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.apiregistry.v1.ListMcpToolsResponse"; + }; + + return ListMcpToolsResponse; + })(); + + return v1; + })(); + apiregistry.v1beta = (function() { /** diff --git a/packages/google-cloud-apiregistry/protos/protos.json b/packages/google-cloud-apiregistry/protos/protos.json index de7f24d07d1..81c02973e19 100644 --- a/packages/google-cloud-apiregistry/protos/protos.json +++ b/packages/google-cloud-apiregistry/protos/protos.json @@ -6,6 +6,346 @@ "nested": { "apiregistry": { "nested": { + "v1": { + "options": { + "csharp_namespace": "Google.Cloud.ApiRegistry.V1", + "go_package": "cloud.google.com/go/apiregistry/apiv1/apiregistrypb;apiregistrypb", + "java_multiple_files": true, + "java_outer_classname": "ServiceProto", + "java_package": "com.google.cloud.apiregistry.v1", + "php_namespace": "Google\\Cloud\\ApiRegistry\\V1", + "ruby_package": "Google::Cloud::ApiRegistry::V1", + "(google.api.resource_definition).type": "cloudapiregistry.googleapis.com/ApiNamespace", + "(google.api.resource_definition).pattern": "projects/{project}/locations/{location}/apiNamespaces/{api_namespace}" + }, + "nested": { + "State": { + "values": { + "STATE_UNSPECIFIED": 0, + "ENABLED": 1, + "DISABLED": 2 + } + }, + "McpServer": { + "options": { + "(google.api.resource).type": "cloudapiregistry.googleapis.com/McpServer", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/mcpServers/{mcp_server}", + "(google.api.resource).plural": "mcpServers", + "(google.api.resource).singular": "mcpServer" + }, + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "IDENTIFIER" + } + }, + "displayName": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "description": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "urls": { + "rule": "repeated", + "type": "string", + "id": 4 + }, + "capabilities": { + "type": "google.protobuf.Struct", + "id": 6 + }, + "state": { + "type": "State", + "id": 7, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + } + }, + "McpTool": { + "options": { + "(google.api.resource).type": "cloudapiregistry.googleapis.com/McpTool", + "(google.api.resource).pattern": "projects/{project}/locations/{location}/mcpServers/{mcp_server}/mcpTools/{mcp_tool}", + "(google.api.resource).plural": "mcpTools", + "(google.api.resource).singular": "mcpTool" + }, + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "IDENTIFIER" + } + }, + "displayName": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "description": { + "type": "string", + "id": 3 + }, + "mcpServerUrls": { + "rule": "repeated", + "type": "string", + "id": 4 + }, + "inputSchema": { + "type": "google.protobuf.Struct", + "id": 5 + }, + "outputSchema": { + "type": "google.protobuf.Struct", + "id": 6 + }, + "annotations": { + "type": "google.protobuf.Struct", + "id": 7 + } + } + }, + "CloudApiRegistry": { + "options": { + "(google.api.default_host)": "cloudapiregistry.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" + }, + "methods": { + "GetMcpServer": { + "requestType": "GetMcpServerRequest", + "responseType": "McpServer", + "options": { + "(google.api.http).get": "/v1/{name=projects/*/locations/*/mcpServers/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{name=projects/*/locations/*/mcpServers/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "ListMcpServers": { + "requestType": "ListMcpServersRequest", + "responseType": "ListMcpServersResponse", + "options": { + "(google.api.http).get": "/v1/{parent=projects/*/locations/*}/mcpServers", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{parent=projects/*/locations/*}/mcpServers" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "GetMcpTool": { + "requestType": "GetMcpToolRequest", + "responseType": "McpTool", + "options": { + "(google.api.http).get": "/v1/{name=projects/*/locations/*/mcpServers/*/mcpTools/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{name=projects/*/locations/*/mcpServers/*/mcpTools/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "ListMcpTools": { + "requestType": "ListMcpToolsRequest", + "responseType": "ListMcpToolsResponse", + "options": { + "(google.api.http).get": "/v1/{parent=projects/*/locations/*/mcpServers/*}/mcpTools", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{parent=projects/*/locations/*/mcpServers/*}/mcpTools" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + } + } + }, + "GetMcpServerRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "cloudapiregistry.googleapis.com/McpServer" + } + } + } + }, + "ListMcpServersRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "locations.googleapis.com/Location" + } + }, + "pageSize": { + "type": "int32", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "pageToken": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "filter": { + "type": "string", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "orderBy": { + "type": "string", + "id": 5, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "ListMcpServersResponse": { + "fields": { + "mcpServers": { + "rule": "repeated", + "type": "McpServer", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + }, + "unreachable": { + "rule": "repeated", + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "UNORDERED_LIST" + } + } + } + }, + "GetMcpToolRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "cloudapiregistry.googleapis.com/McpTool" + } + } + } + }, + "ListMcpToolsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "cloudapiregistry.googleapis.com/McpTool" + } + }, + "pageSize": { + "type": "int32", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "pageToken": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "filter": { + "type": "string", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "orderBy": { + "type": "string", + "id": 5, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "ListMcpToolsResponse": { + "fields": { + "mcpTools": { + "rule": "repeated", + "type": "McpTool", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + }, + "unreachable": { + "rule": "repeated", + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "UNORDERED_LIST" + } + } + } + } + } + }, "v1beta": { "options": { "csharp_namespace": "Google.Cloud.ApiRegistry.V1Beta", diff --git a/packages/google-cloud-apiregistry/samples/generated/v1/cloud_api_registry.get_mcp_server.js b/packages/google-cloud-apiregistry/samples/generated/v1/cloud_api_registry.get_mcp_server.js new file mode 100644 index 00000000000..f38c2f325dd --- /dev/null +++ b/packages/google-cloud-apiregistry/samples/generated/v1/cloud_api_registry.get_mcp_server.js @@ -0,0 +1,62 @@ +// 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START cloudapiregistry_v1_generated_CloudApiRegistry_GetMcpServer_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Name of the resource + * Format: projects/{project}/locations/{location}/mcpServers/{mcp_server} + */ + // const name = 'abc123' + + // Imports the Apiregistry library + const {CloudApiRegistryClient} = require('@google-cloud/apiregistry').v1; + + // Instantiates a client + const apiregistryClient = new CloudApiRegistryClient(); + + async function callGetMcpServer() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await apiregistryClient.getMcpServer(request); + console.log(response); + } + + callGetMcpServer(); + // [END cloudapiregistry_v1_generated_CloudApiRegistry_GetMcpServer_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-apiregistry/samples/generated/v1/cloud_api_registry.get_mcp_tool.js b/packages/google-cloud-apiregistry/samples/generated/v1/cloud_api_registry.get_mcp_tool.js new file mode 100644 index 00000000000..c91a350a7d1 --- /dev/null +++ b/packages/google-cloud-apiregistry/samples/generated/v1/cloud_api_registry.get_mcp_tool.js @@ -0,0 +1,63 @@ +// 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START cloudapiregistry_v1_generated_CloudApiRegistry_GetMcpTool_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Name of the resource + * Format: + * projects/{project}/locations/{location}/mcpServers/{mcp_server}/mcpTools/{mcp_tool} + */ + // const name = 'abc123' + + // Imports the Apiregistry library + const {CloudApiRegistryClient} = require('@google-cloud/apiregistry').v1; + + // Instantiates a client + const apiregistryClient = new CloudApiRegistryClient(); + + async function callGetMcpTool() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await apiregistryClient.getMcpTool(request); + console.log(response); + } + + callGetMcpTool(); + // [END cloudapiregistry_v1_generated_CloudApiRegistry_GetMcpTool_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-apiregistry/samples/generated/v1/cloud_api_registry.list_mcp_servers.js b/packages/google-cloud-apiregistry/samples/generated/v1/cloud_api_registry.list_mcp_servers.js new file mode 100644 index 00000000000..b2b052fc6b4 --- /dev/null +++ b/packages/google-cloud-apiregistry/samples/generated/v1/cloud_api_registry.list_mcp_servers.js @@ -0,0 +1,84 @@ +// 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START cloudapiregistry_v1_generated_CloudApiRegistry_ListMcpServers_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Parent value for ListMcpServersRequest + */ + // const parent = 'abc123' + /** + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, at most 50 items will be returned. The maximum + * value is 100; values above 100 will be coerced to 100. + */ + // const pageSize = 1234 + /** + * Optional. A token identifying a page of results the server should return. + */ + // const pageToken = 'abc123' + /** + * Optional. An expression that filters the results. + * For syntax, see https://google.aip.dev/160. + */ + // const filter = 'abc123' + /** + * Optional. A comma-separated list of fields to order by, sorted in ascending + * order. Use "desc" after a field name for descending. For syntax, see + * https://google.aip.dev/132#ordering. + */ + // const orderBy = 'abc123' + + // Imports the Apiregistry library + const {CloudApiRegistryClient} = require('@google-cloud/apiregistry').v1; + + // Instantiates a client + const apiregistryClient = new CloudApiRegistryClient(); + + async function callListMcpServers() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = apiregistryClient.listMcpServersAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListMcpServers(); + // [END cloudapiregistry_v1_generated_CloudApiRegistry_ListMcpServers_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-apiregistry/samples/generated/v1/cloud_api_registry.list_mcp_tools.js b/packages/google-cloud-apiregistry/samples/generated/v1/cloud_api_registry.list_mcp_tools.js new file mode 100644 index 00000000000..81cb83b743b --- /dev/null +++ b/packages/google-cloud-apiregistry/samples/generated/v1/cloud_api_registry.list_mcp_tools.js @@ -0,0 +1,84 @@ +// 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START cloudapiregistry_v1_generated_CloudApiRegistry_ListMcpTools_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Parent value for ListMcpToolsRequest + */ + // const parent = 'abc123' + /** + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, at most 50 items will be returned. The maximum + * value is 100; values above 100 will be coerced to 100. + */ + // const pageSize = 1234 + /** + * Optional. A token identifying a page of results the server should return. + */ + // const pageToken = 'abc123' + /** + * Optional. An expression that filters the results. + * For syntax, see https://google.aip.dev/160. + */ + // const filter = 'abc123' + /** + * Optional. A comma-separated list of fields to order by, sorted in ascending + * order. Use "desc" after a field name for descending. For syntax, see + * https://google.aip.dev/132#ordering. + */ + // const orderBy = 'abc123' + + // Imports the Apiregistry library + const {CloudApiRegistryClient} = require('@google-cloud/apiregistry').v1; + + // Instantiates a client + const apiregistryClient = new CloudApiRegistryClient(); + + async function callListMcpTools() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = apiregistryClient.listMcpToolsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListMcpTools(); + // [END cloudapiregistry_v1_generated_CloudApiRegistry_ListMcpTools_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-cloud-apiregistry/samples/generated/v1/snippet_metadata_google.cloud.apiregistry.v1.json b/packages/google-cloud-apiregistry/samples/generated/v1/snippet_metadata_google.cloud.apiregistry.v1.json new file mode 100644 index 00000000000..76f076eefea --- /dev/null +++ b/packages/google-cloud-apiregistry/samples/generated/v1/snippet_metadata_google.cloud.apiregistry.v1.json @@ -0,0 +1,207 @@ +{ + "clientLibrary": { + "name": "nodejs-apiregistry", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.apiregistry.v1", + "version": "v1" + } + ] + }, + "snippets": [ + { + "regionTag": "cloudapiregistry_v1_generated_CloudApiRegistry_GetMcpServer_async", + "title": "CloudApiRegistry getMcpServer Sample", + "origin": "API_DEFINITION", + "description": " Gets a single McpServer.", + "canonical": true, + "file": "cloud_api_registry.get_mcp_server.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetMcpServer", + "fullName": "google.cloud.apiregistry.v1.CloudApiRegistry.GetMcpServer", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.apiregistry.v1.McpServer", + "client": { + "shortName": "CloudApiRegistryClient", + "fullName": "google.cloud.apiregistry.v1.CloudApiRegistryClient" + }, + "method": { + "shortName": "GetMcpServer", + "fullName": "google.cloud.apiregistry.v1.CloudApiRegistry.GetMcpServer", + "service": { + "shortName": "CloudApiRegistry", + "fullName": "google.cloud.apiregistry.v1.CloudApiRegistry" + } + } + } + }, + { + "regionTag": "cloudapiregistry_v1_generated_CloudApiRegistry_ListMcpServers_async", + "title": "CloudApiRegistry listMcpServers Sample", + "origin": "API_DEFINITION", + "description": " Lists McpServers in a given Project.", + "canonical": true, + "file": "cloud_api_registry.list_mcp_servers.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 76, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListMcpServers", + "fullName": "google.cloud.apiregistry.v1.CloudApiRegistry.ListMcpServers", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.apiregistry.v1.ListMcpServersResponse", + "client": { + "shortName": "CloudApiRegistryClient", + "fullName": "google.cloud.apiregistry.v1.CloudApiRegistryClient" + }, + "method": { + "shortName": "ListMcpServers", + "fullName": "google.cloud.apiregistry.v1.CloudApiRegistry.ListMcpServers", + "service": { + "shortName": "CloudApiRegistry", + "fullName": "google.cloud.apiregistry.v1.CloudApiRegistry" + } + } + } + }, + { + "regionTag": "cloudapiregistry_v1_generated_CloudApiRegistry_GetMcpTool_async", + "title": "CloudApiRegistry getMcpTool Sample", + "origin": "API_DEFINITION", + "description": " Gets a single McpTool.", + "canonical": true, + "file": "cloud_api_registry.get_mcp_tool.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetMcpTool", + "fullName": "google.cloud.apiregistry.v1.CloudApiRegistry.GetMcpTool", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.apiregistry.v1.McpTool", + "client": { + "shortName": "CloudApiRegistryClient", + "fullName": "google.cloud.apiregistry.v1.CloudApiRegistryClient" + }, + "method": { + "shortName": "GetMcpTool", + "fullName": "google.cloud.apiregistry.v1.CloudApiRegistry.GetMcpTool", + "service": { + "shortName": "CloudApiRegistry", + "fullName": "google.cloud.apiregistry.v1.CloudApiRegistry" + } + } + } + }, + { + "regionTag": "cloudapiregistry_v1_generated_CloudApiRegistry_ListMcpTools_async", + "title": "CloudApiRegistry listMcpTools Sample", + "origin": "API_DEFINITION", + "description": " Lists McpTools in a given McpServer.", + "canonical": true, + "file": "cloud_api_registry.list_mcp_tools.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 76, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListMcpTools", + "fullName": "google.cloud.apiregistry.v1.CloudApiRegistry.ListMcpTools", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.apiregistry.v1.ListMcpToolsResponse", + "client": { + "shortName": "CloudApiRegistryClient", + "fullName": "google.cloud.apiregistry.v1.CloudApiRegistryClient" + }, + "method": { + "shortName": "ListMcpTools", + "fullName": "google.cloud.apiregistry.v1.CloudApiRegistry.ListMcpTools", + "service": { + "shortName": "CloudApiRegistry", + "fullName": "google.cloud.apiregistry.v1.CloudApiRegistry" + } + } + } + } + ] +} diff --git a/packages/google-cloud-apiregistry/src/index.ts b/packages/google-cloud-apiregistry/src/index.ts index 289db7b22c2..ade957a120a 100644 --- a/packages/google-cloud-apiregistry/src/index.ts +++ b/packages/google-cloud-apiregistry/src/index.ts @@ -16,12 +16,13 @@ // ** https://github.com/googleapis/synthtool ** // ** All changes to this file may be overwritten. ** +import * as v1 from './v1'; import * as v1beta from './v1beta'; -const CloudApiRegistryClient = v1beta.CloudApiRegistryClient; -type CloudApiRegistryClient = v1beta.CloudApiRegistryClient; +const CloudApiRegistryClient = v1.CloudApiRegistryClient; +type CloudApiRegistryClient = v1.CloudApiRegistryClient; -export {v1beta, CloudApiRegistryClient}; -export default {v1beta, CloudApiRegistryClient}; +export {v1, v1beta, CloudApiRegistryClient}; +export default {v1, v1beta, CloudApiRegistryClient}; import * as protos from '../protos/protos'; export {protos}; diff --git a/packages/google-cloud-apiregistry/src/v1/cloud_api_registry_client.ts b/packages/google-cloud-apiregistry/src/v1/cloud_api_registry_client.ts new file mode 100644 index 00000000000..f1e9ea3a1ac --- /dev/null +++ b/packages/google-cloud-apiregistry/src/v1/cloud_api_registry_client.ts @@ -0,0 +1,1449 @@ +// 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import type * as gax from 'google-gax'; +import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall, LocationsClient, LocationProtos} from 'google-gax'; +import {Transform} from 'stream'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; + +/** + * Client JSON configuration object, loaded from + * `src/v1/cloud_api_registry_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './cloud_api_registry_client_config.json'; +const version = require('../../../package.json').version; + +/** + * The Cloud API Registry service provides a central registry for managing API + * Data. + * @class + * @memberof v1 + */ +export class CloudApiRegistryClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + private _universeDomain: string; + private _servicePath: string; + private _log = logging.log('apiregistry'); + + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + locationsClient: LocationsClient; + pathTemplates: {[name: string]: gax.PathTemplate}; + cloudApiRegistryStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of CloudApiRegistryClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new CloudApiRegistryClient({fallback: true}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof CloudApiRegistryClient; + if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { + throw new Error('Please set either universe_domain or universeDomain, but not both.'); + } + const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; + this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; + this._servicePath = 'cloudapiregistry.' + this._universeDomain; + const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; + this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // Request numeric enum values if REST transport is used. + opts.numericEnums = true; + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== this._servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = this._servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === this._servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process === 'object' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + apiNamespacePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/apiNamespaces/{api_namespace}' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + projectLocationApiNamespaceMcpServerMcpToolsPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/apiNamespaces/{api_namespace}/mcpServers/{mcp_server}/mcpTools/{mcp_tool}' + ), + projectLocationApiNamespaceMcpServersPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/apiNamespaces/{api_namespace}/mcpServers/{mcp_server}' + ), + projectLocationMcpServerMcpToolsPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/mcpServers/{mcp_server}/mcpTools/{mcp_tool}' + ), + projectLocationMcpServersPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/mcpServers/{mcp_server}' + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listMcpServers: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'mcpServers'), + listMcpTools: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'mcpTools') + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.apiregistry.v1.CloudApiRegistry', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = this._gaxModule.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.cloudApiRegistryStub) { + return this.cloudApiRegistryStub; + } + + // Put together the "service stub" for + // google.cloud.apiregistry.v1.CloudApiRegistry. + this.cloudApiRegistryStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.apiregistry.v1.CloudApiRegistry') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.apiregistry.v1.CloudApiRegistry, + this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const cloudApiRegistryStubMethods = + ['getMcpServer', 'listMcpServers', 'getMcpTool', 'listMcpTools']; + for (const methodName of cloudApiRegistryStubMethods) { + const callPromise = this.cloudApiRegistryStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.cloudApiRegistryStub; + } + + /** + * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + if (typeof process === 'object' && typeof process.emitWarning === 'function') { + process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); + } + return 'cloudapiregistry.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + if (typeof process === 'object' && typeof process.emitWarning === 'function') { + process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); + } + return 'cloudapiregistry.googleapis.com'; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform' + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId(callback?: Callback): + Promise|void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- +/** + * Gets a single McpServer. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the resource + * Format: projects/{project}/locations/{location}/mcpServers/{mcp_server} + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.apiregistry.v1.McpServer|McpServer}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/cloud_api_registry.get_mcp_server.js + * region_tag:cloudapiregistry_v1_generated_CloudApiRegistry_GetMcpServer_async + */ + getMcpServer( + request?: protos.google.cloud.apiregistry.v1.IGetMcpServerRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.apiregistry.v1.IMcpServer, + protos.google.cloud.apiregistry.v1.IGetMcpServerRequest|undefined, {}|undefined + ]>; + getMcpServer( + request: protos.google.cloud.apiregistry.v1.IGetMcpServerRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.apiregistry.v1.IMcpServer, + protos.google.cloud.apiregistry.v1.IGetMcpServerRequest|null|undefined, + {}|null|undefined>): void; + getMcpServer( + request: protos.google.cloud.apiregistry.v1.IGetMcpServerRequest, + callback: Callback< + protos.google.cloud.apiregistry.v1.IMcpServer, + protos.google.cloud.apiregistry.v1.IGetMcpServerRequest|null|undefined, + {}|null|undefined>): void; + getMcpServer( + request?: protos.google.cloud.apiregistry.v1.IGetMcpServerRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.apiregistry.v1.IMcpServer, + protos.google.cloud.apiregistry.v1.IGetMcpServerRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.apiregistry.v1.IMcpServer, + protos.google.cloud.apiregistry.v1.IGetMcpServerRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.apiregistry.v1.IMcpServer, + protos.google.cloud.apiregistry.v1.IGetMcpServerRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize().catch(err => {throw err}); + this._log.info('getMcpServer request %j', request); + const wrappedCallback: Callback< + protos.google.cloud.apiregistry.v1.IMcpServer, + protos.google.cloud.apiregistry.v1.IGetMcpServerRequest|null|undefined, + {}|null|undefined>|undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('getMcpServer response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls.getMcpServer(request, options, wrappedCallback) + ?.then(([response, options, rawResponse]: [ + protos.google.cloud.apiregistry.v1.IMcpServer, + protos.google.cloud.apiregistry.v1.IGetMcpServerRequest|undefined, + {}|undefined + ]) => { + this._log.info('getMcpServer response %j', response); + return [response, options, rawResponse]; + }).catch((error: any) => { + if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { + const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + } + throw error; + }); + } +/** + * Gets a single McpTool. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the resource + * Format: + * projects/{project}/locations/{location}/mcpServers/{mcp_server}/mcpTools/{mcp_tool} + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.apiregistry.v1.McpTool|McpTool}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/cloud_api_registry.get_mcp_tool.js + * region_tag:cloudapiregistry_v1_generated_CloudApiRegistry_GetMcpTool_async + */ + getMcpTool( + request?: protos.google.cloud.apiregistry.v1.IGetMcpToolRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.apiregistry.v1.IMcpTool, + protos.google.cloud.apiregistry.v1.IGetMcpToolRequest|undefined, {}|undefined + ]>; + getMcpTool( + request: protos.google.cloud.apiregistry.v1.IGetMcpToolRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.apiregistry.v1.IMcpTool, + protos.google.cloud.apiregistry.v1.IGetMcpToolRequest|null|undefined, + {}|null|undefined>): void; + getMcpTool( + request: protos.google.cloud.apiregistry.v1.IGetMcpToolRequest, + callback: Callback< + protos.google.cloud.apiregistry.v1.IMcpTool, + protos.google.cloud.apiregistry.v1.IGetMcpToolRequest|null|undefined, + {}|null|undefined>): void; + getMcpTool( + request?: protos.google.cloud.apiregistry.v1.IGetMcpToolRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.apiregistry.v1.IMcpTool, + protos.google.cloud.apiregistry.v1.IGetMcpToolRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.apiregistry.v1.IMcpTool, + protos.google.cloud.apiregistry.v1.IGetMcpToolRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.apiregistry.v1.IMcpTool, + protos.google.cloud.apiregistry.v1.IGetMcpToolRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize().catch(err => {throw err}); + this._log.info('getMcpTool request %j', request); + const wrappedCallback: Callback< + protos.google.cloud.apiregistry.v1.IMcpTool, + protos.google.cloud.apiregistry.v1.IGetMcpToolRequest|null|undefined, + {}|null|undefined>|undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('getMcpTool response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls.getMcpTool(request, options, wrappedCallback) + ?.then(([response, options, rawResponse]: [ + protos.google.cloud.apiregistry.v1.IMcpTool, + protos.google.cloud.apiregistry.v1.IGetMcpToolRequest|undefined, + {}|undefined + ]) => { + this._log.info('getMcpTool response %j', response); + return [response, options, rawResponse]; + }).catch((error: any) => { + if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { + const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + } + throw error; + }); + } + + /** + * Lists McpServers in a given Project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent value for ListMcpServersRequest + * @param {number} [request.pageSize] + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, at most 50 items will be returned. The maximum + * value is 100; values above 100 will be coerced to 100. + * @param {string} [request.pageToken] + * Optional. A token identifying a page of results the server should return. + * @param {string} [request.filter] + * Optional. An expression that filters the results. + * For syntax, see https://google.aip.dev/160. + * @param {string} [request.orderBy] + * Optional. A comma-separated list of fields to order by, sorted in ascending + * order. Use "desc" after a field name for descending. For syntax, see + * https://google.aip.dev/132#ordering. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link protos.google.cloud.apiregistry.v1.McpServer|McpServer}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listMcpServersAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listMcpServers( + request?: protos.google.cloud.apiregistry.v1.IListMcpServersRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.apiregistry.v1.IMcpServer[], + protos.google.cloud.apiregistry.v1.IListMcpServersRequest|null, + protos.google.cloud.apiregistry.v1.IListMcpServersResponse + ]>; + listMcpServers( + request: protos.google.cloud.apiregistry.v1.IListMcpServersRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.apiregistry.v1.IListMcpServersRequest, + protos.google.cloud.apiregistry.v1.IListMcpServersResponse|null|undefined, + protos.google.cloud.apiregistry.v1.IMcpServer>): void; + listMcpServers( + request: protos.google.cloud.apiregistry.v1.IListMcpServersRequest, + callback: PaginationCallback< + protos.google.cloud.apiregistry.v1.IListMcpServersRequest, + protos.google.cloud.apiregistry.v1.IListMcpServersResponse|null|undefined, + protos.google.cloud.apiregistry.v1.IMcpServer>): void; + listMcpServers( + request?: protos.google.cloud.apiregistry.v1.IListMcpServersRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.apiregistry.v1.IListMcpServersRequest, + protos.google.cloud.apiregistry.v1.IListMcpServersResponse|null|undefined, + protos.google.cloud.apiregistry.v1.IMcpServer>, + callback?: PaginationCallback< + protos.google.cloud.apiregistry.v1.IListMcpServersRequest, + protos.google.cloud.apiregistry.v1.IListMcpServersResponse|null|undefined, + protos.google.cloud.apiregistry.v1.IMcpServer>): + Promise<[ + protos.google.cloud.apiregistry.v1.IMcpServer[], + protos.google.cloud.apiregistry.v1.IListMcpServersRequest|null, + protos.google.cloud.apiregistry.v1.IListMcpServersResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize().catch(err => {throw err}); + const wrappedCallback: PaginationCallback< + protos.google.cloud.apiregistry.v1.IListMcpServersRequest, + protos.google.cloud.apiregistry.v1.IListMcpServersResponse|null|undefined, + protos.google.cloud.apiregistry.v1.IMcpServer>|undefined = callback + ? (error, values, nextPageRequest, rawResponse) => { + this._log.info('listMcpServers values %j', values); + callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. + } + : undefined; + this._log.info('listMcpServers request %j', request); + return this.innerApiCalls + .listMcpServers(request, options, wrappedCallback) + ?.then(([response, input, output]: [ + protos.google.cloud.apiregistry.v1.IMcpServer[], + protos.google.cloud.apiregistry.v1.IListMcpServersRequest|null, + protos.google.cloud.apiregistry.v1.IListMcpServersResponse + ]) => { + this._log.info('listMcpServers values %j', response); + return [response, input, output]; + }); + } + +/** + * Equivalent to `listMcpServers`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent value for ListMcpServersRequest + * @param {number} [request.pageSize] + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, at most 50 items will be returned. The maximum + * value is 100; values above 100 will be coerced to 100. + * @param {string} [request.pageToken] + * Optional. A token identifying a page of results the server should return. + * @param {string} [request.filter] + * Optional. An expression that filters the results. + * For syntax, see https://google.aip.dev/160. + * @param {string} [request.orderBy] + * Optional. A comma-separated list of fields to order by, sorted in ascending + * order. Use "desc" after a field name for descending. For syntax, see + * https://google.aip.dev/132#ordering. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.apiregistry.v1.McpServer|McpServer} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listMcpServersAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listMcpServersStream( + request?: protos.google.cloud.apiregistry.v1.IListMcpServersRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listMcpServers']; + const callSettings = defaultCallSettings.merge(options); + this.initialize().catch(err => {throw err}); + this._log.info('listMcpServers stream %j', request); + return this.descriptors.page.listMcpServers.createStream( + this.innerApiCalls.listMcpServers as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listMcpServers`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent value for ListMcpServersRequest + * @param {number} [request.pageSize] + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, at most 50 items will be returned. The maximum + * value is 100; values above 100 will be coerced to 100. + * @param {string} [request.pageToken] + * Optional. A token identifying a page of results the server should return. + * @param {string} [request.filter] + * Optional. An expression that filters the results. + * For syntax, see https://google.aip.dev/160. + * @param {string} [request.orderBy] + * Optional. A comma-separated list of fields to order by, sorted in ascending + * order. Use "desc" after a field name for descending. For syntax, see + * https://google.aip.dev/132#ordering. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.apiregistry.v1.McpServer|McpServer}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/cloud_api_registry.list_mcp_servers.js + * region_tag:cloudapiregistry_v1_generated_CloudApiRegistry_ListMcpServers_async + */ + listMcpServersAsync( + request?: protos.google.cloud.apiregistry.v1.IListMcpServersRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listMcpServers']; + const callSettings = defaultCallSettings.merge(options); + this.initialize().catch(err => {throw err}); + this._log.info('listMcpServers iterate %j', request); + return this.descriptors.page.listMcpServers.asyncIterate( + this.innerApiCalls['listMcpServers'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Lists McpTools in a given McpServer. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent value for ListMcpToolsRequest + * @param {number} [request.pageSize] + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, at most 50 items will be returned. The maximum + * value is 100; values above 100 will be coerced to 100. + * @param {string} [request.pageToken] + * Optional. A token identifying a page of results the server should return. + * @param {string} [request.filter] + * Optional. An expression that filters the results. + * For syntax, see https://google.aip.dev/160. + * @param {string} [request.orderBy] + * Optional. A comma-separated list of fields to order by, sorted in ascending + * order. Use "desc" after a field name for descending. For syntax, see + * https://google.aip.dev/132#ordering. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link protos.google.cloud.apiregistry.v1.McpTool|McpTool}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listMcpToolsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listMcpTools( + request?: protos.google.cloud.apiregistry.v1.IListMcpToolsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.apiregistry.v1.IMcpTool[], + protos.google.cloud.apiregistry.v1.IListMcpToolsRequest|null, + protos.google.cloud.apiregistry.v1.IListMcpToolsResponse + ]>; + listMcpTools( + request: protos.google.cloud.apiregistry.v1.IListMcpToolsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.apiregistry.v1.IListMcpToolsRequest, + protos.google.cloud.apiregistry.v1.IListMcpToolsResponse|null|undefined, + protos.google.cloud.apiregistry.v1.IMcpTool>): void; + listMcpTools( + request: protos.google.cloud.apiregistry.v1.IListMcpToolsRequest, + callback: PaginationCallback< + protos.google.cloud.apiregistry.v1.IListMcpToolsRequest, + protos.google.cloud.apiregistry.v1.IListMcpToolsResponse|null|undefined, + protos.google.cloud.apiregistry.v1.IMcpTool>): void; + listMcpTools( + request?: protos.google.cloud.apiregistry.v1.IListMcpToolsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.apiregistry.v1.IListMcpToolsRequest, + protos.google.cloud.apiregistry.v1.IListMcpToolsResponse|null|undefined, + protos.google.cloud.apiregistry.v1.IMcpTool>, + callback?: PaginationCallback< + protos.google.cloud.apiregistry.v1.IListMcpToolsRequest, + protos.google.cloud.apiregistry.v1.IListMcpToolsResponse|null|undefined, + protos.google.cloud.apiregistry.v1.IMcpTool>): + Promise<[ + protos.google.cloud.apiregistry.v1.IMcpTool[], + protos.google.cloud.apiregistry.v1.IListMcpToolsRequest|null, + protos.google.cloud.apiregistry.v1.IListMcpToolsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize().catch(err => {throw err}); + const wrappedCallback: PaginationCallback< + protos.google.cloud.apiregistry.v1.IListMcpToolsRequest, + protos.google.cloud.apiregistry.v1.IListMcpToolsResponse|null|undefined, + protos.google.cloud.apiregistry.v1.IMcpTool>|undefined = callback + ? (error, values, nextPageRequest, rawResponse) => { + this._log.info('listMcpTools values %j', values); + callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. + } + : undefined; + this._log.info('listMcpTools request %j', request); + return this.innerApiCalls + .listMcpTools(request, options, wrappedCallback) + ?.then(([response, input, output]: [ + protos.google.cloud.apiregistry.v1.IMcpTool[], + protos.google.cloud.apiregistry.v1.IListMcpToolsRequest|null, + protos.google.cloud.apiregistry.v1.IListMcpToolsResponse + ]) => { + this._log.info('listMcpTools values %j', response); + return [response, input, output]; + }); + } + +/** + * Equivalent to `listMcpTools`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent value for ListMcpToolsRequest + * @param {number} [request.pageSize] + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, at most 50 items will be returned. The maximum + * value is 100; values above 100 will be coerced to 100. + * @param {string} [request.pageToken] + * Optional. A token identifying a page of results the server should return. + * @param {string} [request.filter] + * Optional. An expression that filters the results. + * For syntax, see https://google.aip.dev/160. + * @param {string} [request.orderBy] + * Optional. A comma-separated list of fields to order by, sorted in ascending + * order. Use "desc" after a field name for descending. For syntax, see + * https://google.aip.dev/132#ordering. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.apiregistry.v1.McpTool|McpTool} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listMcpToolsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listMcpToolsStream( + request?: protos.google.cloud.apiregistry.v1.IListMcpToolsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listMcpTools']; + const callSettings = defaultCallSettings.merge(options); + this.initialize().catch(err => {throw err}); + this._log.info('listMcpTools stream %j', request); + return this.descriptors.page.listMcpTools.createStream( + this.innerApiCalls.listMcpTools as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listMcpTools`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. Parent value for ListMcpToolsRequest + * @param {number} [request.pageSize] + * Optional. Requested page size. Server may return fewer items than + * requested. If unspecified, at most 50 items will be returned. The maximum + * value is 100; values above 100 will be coerced to 100. + * @param {string} [request.pageToken] + * Optional. A token identifying a page of results the server should return. + * @param {string} [request.filter] + * Optional. An expression that filters the results. + * For syntax, see https://google.aip.dev/160. + * @param {string} [request.orderBy] + * Optional. A comma-separated list of fields to order by, sorted in ascending + * order. Use "desc" after a field name for descending. For syntax, see + * https://google.aip.dev/132#ordering. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.apiregistry.v1.McpTool|McpTool}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/cloud_api_registry.list_mcp_tools.js + * region_tag:cloudapiregistry_v1_generated_CloudApiRegistry_ListMcpTools_async + */ + listMcpToolsAsync( + request?: protos.google.cloud.apiregistry.v1.IListMcpToolsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listMcpTools']; + const callSettings = defaultCallSettings.merge(options); + this.initialize().catch(err => {throw err}); + this._log.info('listMcpTools iterate %j', request); + return this.descriptors.page.listMcpTools.asyncIterate( + this.innerApiCalls['listMcpTools'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } +/** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + +/** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified apiNamespace resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} api_namespace + * @returns {string} Resource name string. + */ + apiNamespacePath(project:string,location:string,apiNamespace:string) { + return this.pathTemplates.apiNamespacePathTemplate.render({ + project: project, + location: location, + api_namespace: apiNamespace, + }); + } + + /** + * Parse the project from ApiNamespace resource. + * + * @param {string} apiNamespaceName + * A fully-qualified path representing ApiNamespace resource. + * @returns {string} A string representing the project. + */ + matchProjectFromApiNamespaceName(apiNamespaceName: string) { + return this.pathTemplates.apiNamespacePathTemplate.match(apiNamespaceName).project; + } + + /** + * Parse the location from ApiNamespace resource. + * + * @param {string} apiNamespaceName + * A fully-qualified path representing ApiNamespace resource. + * @returns {string} A string representing the location. + */ + matchLocationFromApiNamespaceName(apiNamespaceName: string) { + return this.pathTemplates.apiNamespacePathTemplate.match(apiNamespaceName).location; + } + + /** + * Parse the api_namespace from ApiNamespace resource. + * + * @param {string} apiNamespaceName + * A fully-qualified path representing ApiNamespace resource. + * @returns {string} A string representing the api_namespace. + */ + matchApiNamespaceFromApiNamespaceName(apiNamespaceName: string) { + return this.pathTemplates.apiNamespacePathTemplate.match(apiNamespaceName).api_namespace; + } + + /** + * Return a fully-qualified location resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + locationPath(project:string,location:string) { + return this.pathTemplates.locationPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).project; + } + + /** + * Parse the location from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the location. + */ + matchLocationFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).location; + } + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project:string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified projectLocationApiNamespaceMcpServerMcpTools resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} api_namespace + * @param {string} mcp_server + * @param {string} mcp_tool + * @returns {string} Resource name string. + */ + projectLocationApiNamespaceMcpServerMcpToolsPath(project:string,location:string,apiNamespace:string,mcpServer:string,mcpTool:string) { + return this.pathTemplates.projectLocationApiNamespaceMcpServerMcpToolsPathTemplate.render({ + project: project, + location: location, + api_namespace: apiNamespace, + mcp_server: mcpServer, + mcp_tool: mcpTool, + }); + } + + /** + * Parse the project from ProjectLocationApiNamespaceMcpServerMcpTools resource. + * + * @param {string} projectLocationApiNamespaceMcpServerMcpToolsName + * A fully-qualified path representing project_location_api_namespace_mcp_server_mcpTools resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationApiNamespaceMcpServerMcpToolsName(projectLocationApiNamespaceMcpServerMcpToolsName: string) { + return this.pathTemplates.projectLocationApiNamespaceMcpServerMcpToolsPathTemplate.match(projectLocationApiNamespaceMcpServerMcpToolsName).project; + } + + /** + * Parse the location from ProjectLocationApiNamespaceMcpServerMcpTools resource. + * + * @param {string} projectLocationApiNamespaceMcpServerMcpToolsName + * A fully-qualified path representing project_location_api_namespace_mcp_server_mcpTools resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationApiNamespaceMcpServerMcpToolsName(projectLocationApiNamespaceMcpServerMcpToolsName: string) { + return this.pathTemplates.projectLocationApiNamespaceMcpServerMcpToolsPathTemplate.match(projectLocationApiNamespaceMcpServerMcpToolsName).location; + } + + /** + * Parse the api_namespace from ProjectLocationApiNamespaceMcpServerMcpTools resource. + * + * @param {string} projectLocationApiNamespaceMcpServerMcpToolsName + * A fully-qualified path representing project_location_api_namespace_mcp_server_mcpTools resource. + * @returns {string} A string representing the api_namespace. + */ + matchApiNamespaceFromProjectLocationApiNamespaceMcpServerMcpToolsName(projectLocationApiNamespaceMcpServerMcpToolsName: string) { + return this.pathTemplates.projectLocationApiNamespaceMcpServerMcpToolsPathTemplate.match(projectLocationApiNamespaceMcpServerMcpToolsName).api_namespace; + } + + /** + * Parse the mcp_server from ProjectLocationApiNamespaceMcpServerMcpTools resource. + * + * @param {string} projectLocationApiNamespaceMcpServerMcpToolsName + * A fully-qualified path representing project_location_api_namespace_mcp_server_mcpTools resource. + * @returns {string} A string representing the mcp_server. + */ + matchMcpServerFromProjectLocationApiNamespaceMcpServerMcpToolsName(projectLocationApiNamespaceMcpServerMcpToolsName: string) { + return this.pathTemplates.projectLocationApiNamespaceMcpServerMcpToolsPathTemplate.match(projectLocationApiNamespaceMcpServerMcpToolsName).mcp_server; + } + + /** + * Parse the mcp_tool from ProjectLocationApiNamespaceMcpServerMcpTools resource. + * + * @param {string} projectLocationApiNamespaceMcpServerMcpToolsName + * A fully-qualified path representing project_location_api_namespace_mcp_server_mcpTools resource. + * @returns {string} A string representing the mcp_tool. + */ + matchMcpToolFromProjectLocationApiNamespaceMcpServerMcpToolsName(projectLocationApiNamespaceMcpServerMcpToolsName: string) { + return this.pathTemplates.projectLocationApiNamespaceMcpServerMcpToolsPathTemplate.match(projectLocationApiNamespaceMcpServerMcpToolsName).mcp_tool; + } + + /** + * Return a fully-qualified projectLocationApiNamespaceMcpServers resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} api_namespace + * @param {string} mcp_server + * @returns {string} Resource name string. + */ + projectLocationApiNamespaceMcpServersPath(project:string,location:string,apiNamespace:string,mcpServer:string) { + return this.pathTemplates.projectLocationApiNamespaceMcpServersPathTemplate.render({ + project: project, + location: location, + api_namespace: apiNamespace, + mcp_server: mcpServer, + }); + } + + /** + * Parse the project from ProjectLocationApiNamespaceMcpServers resource. + * + * @param {string} projectLocationApiNamespaceMcpServersName + * A fully-qualified path representing project_location_api_namespace_mcpServers resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationApiNamespaceMcpServersName(projectLocationApiNamespaceMcpServersName: string) { + return this.pathTemplates.projectLocationApiNamespaceMcpServersPathTemplate.match(projectLocationApiNamespaceMcpServersName).project; + } + + /** + * Parse the location from ProjectLocationApiNamespaceMcpServers resource. + * + * @param {string} projectLocationApiNamespaceMcpServersName + * A fully-qualified path representing project_location_api_namespace_mcpServers resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationApiNamespaceMcpServersName(projectLocationApiNamespaceMcpServersName: string) { + return this.pathTemplates.projectLocationApiNamespaceMcpServersPathTemplate.match(projectLocationApiNamespaceMcpServersName).location; + } + + /** + * Parse the api_namespace from ProjectLocationApiNamespaceMcpServers resource. + * + * @param {string} projectLocationApiNamespaceMcpServersName + * A fully-qualified path representing project_location_api_namespace_mcpServers resource. + * @returns {string} A string representing the api_namespace. + */ + matchApiNamespaceFromProjectLocationApiNamespaceMcpServersName(projectLocationApiNamespaceMcpServersName: string) { + return this.pathTemplates.projectLocationApiNamespaceMcpServersPathTemplate.match(projectLocationApiNamespaceMcpServersName).api_namespace; + } + + /** + * Parse the mcp_server from ProjectLocationApiNamespaceMcpServers resource. + * + * @param {string} projectLocationApiNamespaceMcpServersName + * A fully-qualified path representing project_location_api_namespace_mcpServers resource. + * @returns {string} A string representing the mcp_server. + */ + matchMcpServerFromProjectLocationApiNamespaceMcpServersName(projectLocationApiNamespaceMcpServersName: string) { + return this.pathTemplates.projectLocationApiNamespaceMcpServersPathTemplate.match(projectLocationApiNamespaceMcpServersName).mcp_server; + } + + /** + * Return a fully-qualified projectLocationMcpServerMcpTools resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} mcp_server + * @param {string} mcp_tool + * @returns {string} Resource name string. + */ + projectLocationMcpServerMcpToolsPath(project:string,location:string,mcpServer:string,mcpTool:string) { + return this.pathTemplates.projectLocationMcpServerMcpToolsPathTemplate.render({ + project: project, + location: location, + mcp_server: mcpServer, + mcp_tool: mcpTool, + }); + } + + /** + * Parse the project from ProjectLocationMcpServerMcpTools resource. + * + * @param {string} projectLocationMcpServerMcpToolsName + * A fully-qualified path representing project_location_mcp_server_mcpTools resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationMcpServerMcpToolsName(projectLocationMcpServerMcpToolsName: string) { + return this.pathTemplates.projectLocationMcpServerMcpToolsPathTemplate.match(projectLocationMcpServerMcpToolsName).project; + } + + /** + * Parse the location from ProjectLocationMcpServerMcpTools resource. + * + * @param {string} projectLocationMcpServerMcpToolsName + * A fully-qualified path representing project_location_mcp_server_mcpTools resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationMcpServerMcpToolsName(projectLocationMcpServerMcpToolsName: string) { + return this.pathTemplates.projectLocationMcpServerMcpToolsPathTemplate.match(projectLocationMcpServerMcpToolsName).location; + } + + /** + * Parse the mcp_server from ProjectLocationMcpServerMcpTools resource. + * + * @param {string} projectLocationMcpServerMcpToolsName + * A fully-qualified path representing project_location_mcp_server_mcpTools resource. + * @returns {string} A string representing the mcp_server. + */ + matchMcpServerFromProjectLocationMcpServerMcpToolsName(projectLocationMcpServerMcpToolsName: string) { + return this.pathTemplates.projectLocationMcpServerMcpToolsPathTemplate.match(projectLocationMcpServerMcpToolsName).mcp_server; + } + + /** + * Parse the mcp_tool from ProjectLocationMcpServerMcpTools resource. + * + * @param {string} projectLocationMcpServerMcpToolsName + * A fully-qualified path representing project_location_mcp_server_mcpTools resource. + * @returns {string} A string representing the mcp_tool. + */ + matchMcpToolFromProjectLocationMcpServerMcpToolsName(projectLocationMcpServerMcpToolsName: string) { + return this.pathTemplates.projectLocationMcpServerMcpToolsPathTemplate.match(projectLocationMcpServerMcpToolsName).mcp_tool; + } + + /** + * Return a fully-qualified projectLocationMcpServers resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} mcp_server + * @returns {string} Resource name string. + */ + projectLocationMcpServersPath(project:string,location:string,mcpServer:string) { + return this.pathTemplates.projectLocationMcpServersPathTemplate.render({ + project: project, + location: location, + mcp_server: mcpServer, + }); + } + + /** + * Parse the project from ProjectLocationMcpServers resource. + * + * @param {string} projectLocationMcpServersName + * A fully-qualified path representing project_location_mcpServers resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationMcpServersName(projectLocationMcpServersName: string) { + return this.pathTemplates.projectLocationMcpServersPathTemplate.match(projectLocationMcpServersName).project; + } + + /** + * Parse the location from ProjectLocationMcpServers resource. + * + * @param {string} projectLocationMcpServersName + * A fully-qualified path representing project_location_mcpServers resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationMcpServersName(projectLocationMcpServersName: string) { + return this.pathTemplates.projectLocationMcpServersPathTemplate.match(projectLocationMcpServersName).location; + } + + /** + * Parse the mcp_server from ProjectLocationMcpServers resource. + * + * @param {string} projectLocationMcpServersName + * A fully-qualified path representing project_location_mcpServers resource. + * @returns {string} A string representing the mcp_server. + */ + matchMcpServerFromProjectLocationMcpServersName(projectLocationMcpServersName: string) { + return this.pathTemplates.projectLocationMcpServersPathTemplate.match(projectLocationMcpServersName).mcp_server; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + if (this.cloudApiRegistryStub && !this._terminated) { + return this.cloudApiRegistryStub.then(stub => { + this._log.info('ending gRPC channel'); + this._terminated = true; + stub.close(); + this.locationsClient.close().catch(err => {throw err}); + }); + } + return Promise.resolve(); + } +} \ No newline at end of file diff --git a/packages/google-cloud-apiregistry/src/v1/cloud_api_registry_client_config.json b/packages/google-cloud-apiregistry/src/v1/cloud_api_registry_client_config.json new file mode 100644 index 00000000000..64a8700deb7 --- /dev/null +++ b/packages/google-cloud-apiregistry/src/v1/cloud_api_registry_client_config.json @@ -0,0 +1,58 @@ +{ + "interfaces": { + "google.cloud.apiregistry.v1.CloudApiRegistry": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + }, + "ce5b960a6ed052e690863808e4f0deff3dc7d49f": { + "initial_retry_delay_millis": 1000, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 10000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "GetMcpServer": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "ListMcpServers": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "GetMcpTool": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "ListMcpTools": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + } + } + } + } +} diff --git a/packages/google-cloud-apiregistry/src/v1/cloud_api_registry_proto_list.json b/packages/google-cloud-apiregistry/src/v1/cloud_api_registry_proto_list.json new file mode 100644 index 00000000000..bc89c7bf839 --- /dev/null +++ b/packages/google-cloud-apiregistry/src/v1/cloud_api_registry_proto_list.json @@ -0,0 +1,5 @@ +[ + "../../protos/google/cloud/apiregistry/v1/common.proto", + "../../protos/google/cloud/apiregistry/v1/resources.proto", + "../../protos/google/cloud/apiregistry/v1/service.proto" +] diff --git a/packages/google-cloud-apiregistry/src/v1/gapic_metadata.json b/packages/google-cloud-apiregistry/src/v1/gapic_metadata.json new file mode 100644 index 00000000000..9ba018e1b78 --- /dev/null +++ b/packages/google-cloud-apiregistry/src/v1/gapic_metadata.json @@ -0,0 +1,71 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.apiregistry.v1", + "libraryPackage": "@google-cloud/apiregistry", + "services": { + "CloudApiRegistry": { + "clients": { + "grpc": { + "libraryClient": "CloudApiRegistryClient", + "rpcs": { + "GetMcpServer": { + "methods": [ + "getMcpServer" + ] + }, + "GetMcpTool": { + "methods": [ + "getMcpTool" + ] + }, + "ListMcpServers": { + "methods": [ + "listMcpServers", + "listMcpServersStream", + "listMcpServersAsync" + ] + }, + "ListMcpTools": { + "methods": [ + "listMcpTools", + "listMcpToolsStream", + "listMcpToolsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "CloudApiRegistryClient", + "rpcs": { + "GetMcpServer": { + "methods": [ + "getMcpServer" + ] + }, + "GetMcpTool": { + "methods": [ + "getMcpTool" + ] + }, + "ListMcpServers": { + "methods": [ + "listMcpServers", + "listMcpServersStream", + "listMcpServersAsync" + ] + }, + "ListMcpTools": { + "methods": [ + "listMcpTools", + "listMcpToolsStream", + "listMcpToolsAsync" + ] + } + } + } + } + } + } +} diff --git a/packages/google-cloud-apiregistry/src/v1/index.ts b/packages/google-cloud-apiregistry/src/v1/index.ts new file mode 100644 index 00000000000..2c391088d3b --- /dev/null +++ b/packages/google-cloud-apiregistry/src/v1/index.ts @@ -0,0 +1,19 @@ +// 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +export {CloudApiRegistryClient} from './cloud_api_registry_client'; diff --git a/packages/google-cloud-apiregistry/test/gapic_cloud_api_registry_v1.ts b/packages/google-cloud-apiregistry/test/gapic_cloud_api_registry_v1.ts new file mode 100644 index 00000000000..b95dec974a4 --- /dev/null +++ b/packages/google-cloud-apiregistry/test/gapic_cloud_api_registry_v1.ts @@ -0,0 +1,1466 @@ +// 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 +// +// https://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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import {describe, it} from 'mocha'; +import * as cloudapiregistryModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LocationProtos} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1.CloudApiRegistryClient', () => { + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = new cloudapiregistryModule.v1.CloudApiRegistryClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'cloudapiregistry.googleapis.com'); + }); + + it('has universeDomain', () => { + const client = new cloudapiregistryModule.v1.CloudApiRegistryClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, "googleapis.com"); + }); + + if (typeof process === 'object' && typeof process.emitWarning === 'function') { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = cloudapiregistryModule.v1.CloudApiRegistryClient.servicePath; + assert.strictEqual(servicePath, 'cloudapiregistry.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = cloudapiregistryModule.v1.CloudApiRegistryClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'cloudapiregistry.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new cloudapiregistryModule.v1.CloudApiRegistryClient({universeDomain: 'example.com'}); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'cloudapiregistry.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new cloudapiregistryModule.v1.CloudApiRegistryClient({universe_domain: 'example.com'}); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'cloudapiregistry.example.com'); + }); + + if (typeof process === 'object' && 'env' in process) { + describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { + it('sets apiEndpoint from environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = new cloudapiregistryModule.v1.CloudApiRegistryClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'cloudapiregistry.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + + it('value configured in code has priority over environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = new cloudapiregistryModule.v1.CloudApiRegistryClient({universeDomain: 'configured.example.com'}); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'cloudapiregistry.configured.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + }); + } + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { new cloudapiregistryModule.v1.CloudApiRegistryClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); + }); + + it('has port', () => { + const port = cloudapiregistryModule.v1.CloudApiRegistryClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new cloudapiregistryModule.v1.CloudApiRegistryClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new cloudapiregistryModule.v1.CloudApiRegistryClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new cloudapiregistryModule.v1.CloudApiRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.cloudApiRegistryStub, undefined); + await client.initialize(); + assert(client.cloudApiRegistryStub); + }); + + it('has close method for the initialized client', done => { + const client = new cloudapiregistryModule.v1.CloudApiRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize().catch(err => {throw err}); + assert(client.cloudApiRegistryStub); + client.close().then(() => { + done(); + }).catch(err => {throw err}); + }); + + it('has close method for the non-initialized client', done => { + const client = new cloudapiregistryModule.v1.CloudApiRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.cloudApiRegistryStub, undefined); + client.close().then(() => { + done(); + }).catch(err => {throw err}); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new cloudapiregistryModule.v1.CloudApiRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new cloudapiregistryModule.v1.CloudApiRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error|null, projectId?: string|null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + + describe('getMcpServer', () => { + it('invokes getMcpServer without error', async () => { + const client = new cloudapiregistryModule.v1.CloudApiRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apiregistry.v1.GetMcpServerRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apiregistry.v1.GetMcpServerRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.apiregistry.v1.McpServer() + ); + client.innerApiCalls.getMcpServer = stubSimpleCall(expectedResponse); + const [response] = await client.getMcpServer(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getMcpServer as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getMcpServer as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getMcpServer without error using callback', async () => { + const client = new cloudapiregistryModule.v1.CloudApiRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apiregistry.v1.GetMcpServerRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apiregistry.v1.GetMcpServerRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.apiregistry.v1.McpServer() + ); + client.innerApiCalls.getMcpServer = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getMcpServer( + request, + (err?: Error|null, result?: protos.google.cloud.apiregistry.v1.IMcpServer|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getMcpServer as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getMcpServer as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getMcpServer with error', async () => { + const client = new cloudapiregistryModule.v1.CloudApiRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apiregistry.v1.GetMcpServerRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apiregistry.v1.GetMcpServerRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; + const expectedError = new Error('expected'); + client.innerApiCalls.getMcpServer = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getMcpServer(request), expectedError); + const actualRequest = (client.innerApiCalls.getMcpServer as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getMcpServer as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getMcpServer with closed client', async () => { + const client = new cloudapiregistryModule.v1.CloudApiRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apiregistry.v1.GetMcpServerRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apiregistry.v1.GetMcpServerRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch(err => {throw err}); + await assert.rejects(client.getMcpServer(request), expectedError); + }); + }); + + describe('getMcpTool', () => { + it('invokes getMcpTool without error', async () => { + const client = new cloudapiregistryModule.v1.CloudApiRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apiregistry.v1.GetMcpToolRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apiregistry.v1.GetMcpToolRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.apiregistry.v1.McpTool() + ); + client.innerApiCalls.getMcpTool = stubSimpleCall(expectedResponse); + const [response] = await client.getMcpTool(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getMcpTool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getMcpTool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getMcpTool without error using callback', async () => { + const client = new cloudapiregistryModule.v1.CloudApiRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apiregistry.v1.GetMcpToolRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apiregistry.v1.GetMcpToolRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.apiregistry.v1.McpTool() + ); + client.innerApiCalls.getMcpTool = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getMcpTool( + request, + (err?: Error|null, result?: protos.google.cloud.apiregistry.v1.IMcpTool|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getMcpTool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getMcpTool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getMcpTool with error', async () => { + const client = new cloudapiregistryModule.v1.CloudApiRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apiregistry.v1.GetMcpToolRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apiregistry.v1.GetMcpToolRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; + const expectedError = new Error('expected'); + client.innerApiCalls.getMcpTool = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getMcpTool(request), expectedError); + const actualRequest = (client.innerApiCalls.getMcpTool as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getMcpTool as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getMcpTool with closed client', async () => { + const client = new cloudapiregistryModule.v1.CloudApiRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apiregistry.v1.GetMcpToolRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apiregistry.v1.GetMcpToolRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch(err => {throw err}); + await assert.rejects(client.getMcpTool(request), expectedError); + }); + }); + + describe('listMcpServers', () => { + it('invokes listMcpServers without error', async () => { + const client = new cloudapiregistryModule.v1.CloudApiRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apiregistry.v1.ListMcpServersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apiregistry.v1.ListMcpServersRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.apiregistry.v1.McpServer()), + generateSampleMessage(new protos.google.cloud.apiregistry.v1.McpServer()), + generateSampleMessage(new protos.google.cloud.apiregistry.v1.McpServer()), + ]; + client.innerApiCalls.listMcpServers = stubSimpleCall(expectedResponse); + const [response] = await client.listMcpServers(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listMcpServers as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listMcpServers as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listMcpServers without error using callback', async () => { + const client = new cloudapiregistryModule.v1.CloudApiRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apiregistry.v1.ListMcpServersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apiregistry.v1.ListMcpServersRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.apiregistry.v1.McpServer()), + generateSampleMessage(new protos.google.cloud.apiregistry.v1.McpServer()), + generateSampleMessage(new protos.google.cloud.apiregistry.v1.McpServer()), + ]; + client.innerApiCalls.listMcpServers = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listMcpServers( + request, + (err?: Error|null, result?: protos.google.cloud.apiregistry.v1.IMcpServer[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listMcpServers as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listMcpServers as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listMcpServers with error', async () => { + const client = new cloudapiregistryModule.v1.CloudApiRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apiregistry.v1.ListMcpServersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apiregistry.v1.ListMcpServersRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; + const expectedError = new Error('expected'); + client.innerApiCalls.listMcpServers = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listMcpServers(request), expectedError); + const actualRequest = (client.innerApiCalls.listMcpServers as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listMcpServers as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listMcpServersStream without error', async () => { + const client = new cloudapiregistryModule.v1.CloudApiRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apiregistry.v1.ListMcpServersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apiregistry.v1.ListMcpServersRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.apiregistry.v1.McpServer()), + generateSampleMessage(new protos.google.cloud.apiregistry.v1.McpServer()), + generateSampleMessage(new protos.google.cloud.apiregistry.v1.McpServer()), + ]; + client.descriptors.page.listMcpServers.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listMcpServersStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.apiregistry.v1.McpServer[] = []; + stream.on('data', (response: protos.google.cloud.apiregistry.v1.McpServer) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listMcpServers.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listMcpServers, request)); + assert( + (client.descriptors.page.listMcpServers.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listMcpServersStream with error', async () => { + const client = new cloudapiregistryModule.v1.CloudApiRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apiregistry.v1.ListMcpServersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apiregistry.v1.ListMcpServersRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; + const expectedError = new Error('expected'); + client.descriptors.page.listMcpServers.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listMcpServersStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.apiregistry.v1.McpServer[] = []; + stream.on('data', (response: protos.google.cloud.apiregistry.v1.McpServer) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listMcpServers.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listMcpServers, request)); + assert( + (client.descriptors.page.listMcpServers.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listMcpServers without error', async () => { + const client = new cloudapiregistryModule.v1.CloudApiRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apiregistry.v1.ListMcpServersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apiregistry.v1.ListMcpServersRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.apiregistry.v1.McpServer()), + generateSampleMessage(new protos.google.cloud.apiregistry.v1.McpServer()), + generateSampleMessage(new protos.google.cloud.apiregistry.v1.McpServer()), + ]; + client.descriptors.page.listMcpServers.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.apiregistry.v1.IMcpServer[] = []; + const iterable = client.listMcpServersAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listMcpServers.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listMcpServers.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listMcpServers with error', async () => { + const client = new cloudapiregistryModule.v1.CloudApiRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apiregistry.v1.ListMcpServersRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apiregistry.v1.ListMcpServersRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; + const expectedError = new Error('expected'); + client.descriptors.page.listMcpServers.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listMcpServersAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.apiregistry.v1.IMcpServer[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listMcpServers.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listMcpServers.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listMcpTools', () => { + it('invokes listMcpTools without error', async () => { + const client = new cloudapiregistryModule.v1.CloudApiRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apiregistry.v1.ListMcpToolsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apiregistry.v1.ListMcpToolsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.apiregistry.v1.McpTool()), + generateSampleMessage(new protos.google.cloud.apiregistry.v1.McpTool()), + generateSampleMessage(new protos.google.cloud.apiregistry.v1.McpTool()), + ]; + client.innerApiCalls.listMcpTools = stubSimpleCall(expectedResponse); + const [response] = await client.listMcpTools(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listMcpTools as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listMcpTools as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listMcpTools without error using callback', async () => { + const client = new cloudapiregistryModule.v1.CloudApiRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apiregistry.v1.ListMcpToolsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apiregistry.v1.ListMcpToolsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.apiregistry.v1.McpTool()), + generateSampleMessage(new protos.google.cloud.apiregistry.v1.McpTool()), + generateSampleMessage(new protos.google.cloud.apiregistry.v1.McpTool()), + ]; + client.innerApiCalls.listMcpTools = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listMcpTools( + request, + (err?: Error|null, result?: protos.google.cloud.apiregistry.v1.IMcpTool[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listMcpTools as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listMcpTools as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listMcpTools with error', async () => { + const client = new cloudapiregistryModule.v1.CloudApiRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apiregistry.v1.ListMcpToolsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apiregistry.v1.ListMcpToolsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; + const expectedError = new Error('expected'); + client.innerApiCalls.listMcpTools = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listMcpTools(request), expectedError); + const actualRequest = (client.innerApiCalls.listMcpTools as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listMcpTools as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listMcpToolsStream without error', async () => { + const client = new cloudapiregistryModule.v1.CloudApiRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apiregistry.v1.ListMcpToolsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apiregistry.v1.ListMcpToolsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.apiregistry.v1.McpTool()), + generateSampleMessage(new protos.google.cloud.apiregistry.v1.McpTool()), + generateSampleMessage(new protos.google.cloud.apiregistry.v1.McpTool()), + ]; + client.descriptors.page.listMcpTools.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listMcpToolsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.apiregistry.v1.McpTool[] = []; + stream.on('data', (response: protos.google.cloud.apiregistry.v1.McpTool) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert((client.descriptors.page.listMcpTools.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listMcpTools, request)); + assert( + (client.descriptors.page.listMcpTools.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listMcpToolsStream with error', async () => { + const client = new cloudapiregistryModule.v1.CloudApiRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apiregistry.v1.ListMcpToolsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apiregistry.v1.ListMcpToolsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; + const expectedError = new Error('expected'); + client.descriptors.page.listMcpTools.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listMcpToolsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.apiregistry.v1.McpTool[] = []; + stream.on('data', (response: protos.google.cloud.apiregistry.v1.McpTool) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listMcpTools.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listMcpTools, request)); + assert( + (client.descriptors.page.listMcpTools.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listMcpTools without error', async () => { + const client = new cloudapiregistryModule.v1.CloudApiRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apiregistry.v1.ListMcpToolsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apiregistry.v1.ListMcpToolsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.apiregistry.v1.McpTool()), + generateSampleMessage(new protos.google.cloud.apiregistry.v1.McpTool()), + generateSampleMessage(new protos.google.cloud.apiregistry.v1.McpTool()), + ]; + client.descriptors.page.listMcpTools.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.apiregistry.v1.IMcpTool[] = []; + const iterable = client.listMcpToolsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listMcpTools.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listMcpTools.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listMcpTools with error', async () => { + const client = new cloudapiregistryModule.v1.CloudApiRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.apiregistry.v1.ListMcpToolsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.apiregistry.v1.ListMcpToolsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; + const expectedError = new Error('expected'); + client.descriptors.page.listMcpTools.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listMcpToolsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.apiregistry.v1.IMcpTool[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listMcpTools.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listMcpTools.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new cloudapiregistryModule.v1.CloudApiRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getLocation without error using callback', async () => { + const client = new cloudapiregistryModule.v1.CloudApiRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new cloudapiregistryModule.v1.CloudApiRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getLocation(request, expectedOptions), expectedError); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new cloudapiregistryModule.v1.CloudApiRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new cloudapiregistryModule.v1.CloudApiRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('Path templates', () => { + + describe('apiNamespace', async () => { + const fakePath = "/rendered/path/apiNamespace"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + api_namespace: "apiNamespaceValue", + }; + const client = new cloudapiregistryModule.v1.CloudApiRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.apiNamespacePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.apiNamespacePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('apiNamespacePath', () => { + const result = client.apiNamespacePath("projectValue", "locationValue", "apiNamespaceValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.apiNamespacePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromApiNamespaceName', () => { + const result = client.matchProjectFromApiNamespaceName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.apiNamespacePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromApiNamespaceName', () => { + const result = client.matchLocationFromApiNamespaceName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.apiNamespacePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchApiNamespaceFromApiNamespaceName', () => { + const result = client.matchApiNamespaceFromApiNamespaceName(fakePath); + assert.strictEqual(result, "apiNamespaceValue"); + assert((client.pathTemplates.apiNamespacePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('location', async () => { + const fakePath = "/rendered/path/location"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new cloudapiregistryModule.v1.CloudApiRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.locationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.locationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('locationPath', () => { + const result = client.locationPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.locationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromLocationName', () => { + const result = client.matchProjectFromLocationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromLocationName', () => { + const result = client.matchLocationFromLocationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('project', async () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new cloudapiregistryModule.v1.CloudApiRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationApiNamespaceMcpServerMcpTools', async () => { + const fakePath = "/rendered/path/projectLocationApiNamespaceMcpServerMcpTools"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + api_namespace: "apiNamespaceValue", + mcp_server: "mcpServerValue", + mcp_tool: "mcpToolValue", + }; + const client = new cloudapiregistryModule.v1.CloudApiRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectLocationApiNamespaceMcpServerMcpToolsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationApiNamespaceMcpServerMcpToolsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationApiNamespaceMcpServerMcpToolsPath', () => { + const result = client.projectLocationApiNamespaceMcpServerMcpToolsPath("projectValue", "locationValue", "apiNamespaceValue", "mcpServerValue", "mcpToolValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationApiNamespaceMcpServerMcpToolsPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationApiNamespaceMcpServerMcpToolsName', () => { + const result = client.matchProjectFromProjectLocationApiNamespaceMcpServerMcpToolsName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationApiNamespaceMcpServerMcpToolsPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationApiNamespaceMcpServerMcpToolsName', () => { + const result = client.matchLocationFromProjectLocationApiNamespaceMcpServerMcpToolsName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationApiNamespaceMcpServerMcpToolsPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchApiNamespaceFromProjectLocationApiNamespaceMcpServerMcpToolsName', () => { + const result = client.matchApiNamespaceFromProjectLocationApiNamespaceMcpServerMcpToolsName(fakePath); + assert.strictEqual(result, "apiNamespaceValue"); + assert((client.pathTemplates.projectLocationApiNamespaceMcpServerMcpToolsPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMcpServerFromProjectLocationApiNamespaceMcpServerMcpToolsName', () => { + const result = client.matchMcpServerFromProjectLocationApiNamespaceMcpServerMcpToolsName(fakePath); + assert.strictEqual(result, "mcpServerValue"); + assert((client.pathTemplates.projectLocationApiNamespaceMcpServerMcpToolsPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMcpToolFromProjectLocationApiNamespaceMcpServerMcpToolsName', () => { + const result = client.matchMcpToolFromProjectLocationApiNamespaceMcpServerMcpToolsName(fakePath); + assert.strictEqual(result, "mcpToolValue"); + assert((client.pathTemplates.projectLocationApiNamespaceMcpServerMcpToolsPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationApiNamespaceMcpServers', async () => { + const fakePath = "/rendered/path/projectLocationApiNamespaceMcpServers"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + api_namespace: "apiNamespaceValue", + mcp_server: "mcpServerValue", + }; + const client = new cloudapiregistryModule.v1.CloudApiRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectLocationApiNamespaceMcpServersPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationApiNamespaceMcpServersPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationApiNamespaceMcpServersPath', () => { + const result = client.projectLocationApiNamespaceMcpServersPath("projectValue", "locationValue", "apiNamespaceValue", "mcpServerValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationApiNamespaceMcpServersPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationApiNamespaceMcpServersName', () => { + const result = client.matchProjectFromProjectLocationApiNamespaceMcpServersName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationApiNamespaceMcpServersPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationApiNamespaceMcpServersName', () => { + const result = client.matchLocationFromProjectLocationApiNamespaceMcpServersName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationApiNamespaceMcpServersPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchApiNamespaceFromProjectLocationApiNamespaceMcpServersName', () => { + const result = client.matchApiNamespaceFromProjectLocationApiNamespaceMcpServersName(fakePath); + assert.strictEqual(result, "apiNamespaceValue"); + assert((client.pathTemplates.projectLocationApiNamespaceMcpServersPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMcpServerFromProjectLocationApiNamespaceMcpServersName', () => { + const result = client.matchMcpServerFromProjectLocationApiNamespaceMcpServersName(fakePath); + assert.strictEqual(result, "mcpServerValue"); + assert((client.pathTemplates.projectLocationApiNamespaceMcpServersPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationMcpServerMcpTools', async () => { + const fakePath = "/rendered/path/projectLocationMcpServerMcpTools"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + mcp_server: "mcpServerValue", + mcp_tool: "mcpToolValue", + }; + const client = new cloudapiregistryModule.v1.CloudApiRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectLocationMcpServerMcpToolsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationMcpServerMcpToolsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationMcpServerMcpToolsPath', () => { + const result = client.projectLocationMcpServerMcpToolsPath("projectValue", "locationValue", "mcpServerValue", "mcpToolValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationMcpServerMcpToolsPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationMcpServerMcpToolsName', () => { + const result = client.matchProjectFromProjectLocationMcpServerMcpToolsName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationMcpServerMcpToolsPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationMcpServerMcpToolsName', () => { + const result = client.matchLocationFromProjectLocationMcpServerMcpToolsName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationMcpServerMcpToolsPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMcpServerFromProjectLocationMcpServerMcpToolsName', () => { + const result = client.matchMcpServerFromProjectLocationMcpServerMcpToolsName(fakePath); + assert.strictEqual(result, "mcpServerValue"); + assert((client.pathTemplates.projectLocationMcpServerMcpToolsPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMcpToolFromProjectLocationMcpServerMcpToolsName', () => { + const result = client.matchMcpToolFromProjectLocationMcpServerMcpToolsName(fakePath); + assert.strictEqual(result, "mcpToolValue"); + assert((client.pathTemplates.projectLocationMcpServerMcpToolsPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('projectLocationMcpServers', async () => { + const fakePath = "/rendered/path/projectLocationMcpServers"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + mcp_server: "mcpServerValue", + }; + const client = new cloudapiregistryModule.v1.CloudApiRegistryClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectLocationMcpServersPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectLocationMcpServersPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectLocationMcpServersPath', () => { + const result = client.projectLocationMcpServersPath("projectValue", "locationValue", "mcpServerValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectLocationMcpServersPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectLocationMcpServersName', () => { + const result = client.matchProjectFromProjectLocationMcpServersName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectLocationMcpServersPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromProjectLocationMcpServersName', () => { + const result = client.matchLocationFromProjectLocationMcpServersName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.projectLocationMcpServersPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchMcpServerFromProjectLocationMcpServersName', () => { + const result = client.matchMcpServerFromProjectLocationMcpServersName(fakePath); + assert.strictEqual(result, "mcpServerValue"); + assert((client.pathTemplates.projectLocationMcpServersPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +});