@google/adk 2.3.0 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/agents/agent_engine_client.js +172 -0
- package/dist/cjs/agents/base_agent.js +20 -4
- package/dist/cjs/agents/functions.js +28 -0
- package/dist/cjs/agents/instructions.js +2 -1
- package/dist/cjs/agents/llm_agent.js +19 -6
- package/dist/cjs/agents/processors/basic_llm_request_processor.js +1 -1
- package/dist/cjs/agents/processors/code_execution_request_processor.js +8 -0
- package/dist/cjs/agents/processors/content_processor_utils.js +38 -10
- package/dist/cjs/agents/processors/content_request_processor.js +34 -2
- package/dist/cjs/agents/processors/instructions_llm_request_processor.js +1 -1
- package/dist/cjs/agents/processors/nl_planning_processor.js +12 -3
- package/dist/cjs/cli/utils/logs.js +6 -6
- package/dist/cjs/code_executors/container_code_executor.js +27 -16
- package/dist/cjs/code_executors/unsafe_local_code_executor.js +6 -1
- package/dist/cjs/common.js +9 -20
- package/dist/cjs/errors/input_validation_error.js +3 -2
- package/dist/cjs/index.js +9 -2
- package/dist/cjs/plugins/base_plugin.js +13 -23
- package/dist/cjs/sessions/base_session_service.js +14 -8
- package/dist/cjs/sessions/database_session_service.js +50 -28
- package/dist/cjs/sessions/stale_session_error.js +59 -0
- package/dist/cjs/skills/loader.js +52 -18
- package/dist/cjs/telemetry/setup.js +0 -1
- package/dist/cjs/telemetry/tracing.js +53 -10
- package/dist/cjs/tools/apihub_tool/apihub_toolset.js +18 -23
- package/dist/cjs/tools/application_integration_tool/application_integration_toolset.js +120 -42
- package/dist/cjs/tools/application_integration_tool/clients/connections_client.js +163 -95
- package/dist/cjs/tools/application_integration_tool/clients/integration_client.js +13 -9
- package/dist/cjs/tools/application_integration_tool/integration_connector_tool.js +184 -0
- package/dist/cjs/tools/google_api_tool/google_api_tool.js +4 -1
- package/dist/cjs/tools/google_api_tool/google_api_toolset.js +173 -0
- package/dist/cjs/tools/google_api_tool/google_api_toolsets.js +124 -0
- package/dist/cjs/tools/google_api_tool/googleapi_to_openapi_converter.js +2 -2
- package/dist/cjs/tools/google_api_tool/index.js +20 -23
- package/dist/cjs/tools/load_artifacts_tool.js +12 -6
- package/dist/cjs/tools/load_memory_tool.js +12 -10
- package/dist/cjs/tools/mcp/mcp_toolset.js +1 -14
- package/dist/cjs/tools/openapi_tool/auth/credential_exchangers/oauth2_exchanger.js +2 -2
- package/dist/cjs/tools/openapi_tool/openapi_spec_parser/openapi_spec_parser.js +20 -6
- package/dist/cjs/tools/openapi_tool/openapi_spec_parser/operation_parser.js +17 -6
- package/dist/cjs/tools/openapi_tool/openapi_toolset.js +7 -13
- package/dist/cjs/tools/openapi_tool/rest_api_tool.js +17 -1
- package/dist/cjs/tools/toolbox_toolset.js +174 -0
- package/dist/cjs/tools/webmcp/webmcp_toolset.js +1 -14
- package/dist/cjs/utils/client_labels.js +19 -2
- package/dist/cjs/utils/failover_utils.js +1 -1
- package/dist/cjs/utils/gemini_schema_util.js +24 -6
- package/dist/cjs/utils/logger_node.js +4 -0
- package/dist/cjs/utils/output_schema_utils.js +5 -2
- package/dist/cjs/utils/task.js +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/agents/agent_engine_client.js +144 -0
- package/dist/esm/agents/base_agent.js +20 -4
- package/dist/esm/agents/functions.js +28 -0
- package/dist/esm/agents/instructions.js +2 -1
- package/dist/esm/agents/llm_agent.js +19 -6
- package/dist/esm/agents/processors/basic_llm_request_processor.js +1 -1
- package/dist/esm/agents/processors/code_execution_request_processor.js +8 -0
- package/dist/esm/agents/processors/content_processor_utils.js +38 -10
- package/dist/esm/agents/processors/content_request_processor.js +34 -2
- package/dist/esm/agents/processors/instructions_llm_request_processor.js +1 -1
- package/dist/esm/agents/processors/nl_planning_processor.js +12 -3
- package/dist/esm/cli/utils/logs.js +4 -4
- package/dist/esm/code_executors/container_code_executor.js +27 -16
- package/dist/esm/code_executors/unsafe_local_code_executor.js +6 -1
- package/dist/esm/common.js +10 -13
- package/dist/esm/errors/input_validation_error.js +3 -2
- package/dist/esm/index.js +17 -3
- package/dist/esm/plugins/base_plugin.js +13 -23
- package/dist/esm/sessions/base_session_service.js +12 -7
- package/dist/esm/sessions/database_session_service.js +49 -28
- package/dist/esm/sessions/stale_session_error.js +31 -0
- package/dist/esm/skills/loader.js +51 -17
- package/dist/esm/telemetry/setup.js +1 -2
- package/dist/esm/telemetry/tracing.js +57 -11
- package/dist/esm/tools/apihub_tool/apihub_toolset.js +17 -22
- package/dist/esm/tools/application_integration_tool/application_integration_toolset.js +124 -42
- package/dist/esm/tools/application_integration_tool/clients/connections_client.js +163 -95
- package/dist/esm/tools/application_integration_tool/clients/integration_client.js +13 -9
- package/dist/esm/tools/application_integration_tool/integration_connector_tool.js +158 -0
- package/dist/esm/tools/google_api_tool/google_api_tool.js +4 -1
- package/dist/esm/tools/google_api_tool/google_api_toolset.js +146 -0
- package/dist/esm/tools/google_api_tool/google_api_toolsets.js +94 -0
- package/dist/esm/tools/google_api_tool/googleapi_to_openapi_converter.js +2 -2
- package/dist/esm/tools/google_api_tool/index.js +18 -20
- package/dist/esm/tools/load_artifacts_tool.js +10 -5
- package/dist/esm/tools/load_memory_tool.js +12 -10
- package/dist/esm/tools/mcp/mcp_toolset.js +1 -14
- package/dist/esm/tools/openapi_tool/auth/credential_exchangers/oauth2_exchanger.js +2 -2
- package/dist/esm/tools/openapi_tool/openapi_spec_parser/openapi_spec_parser.js +20 -6
- package/dist/esm/tools/openapi_tool/openapi_spec_parser/operation_parser.js +17 -6
- package/dist/esm/tools/openapi_tool/openapi_toolset.js +6 -12
- package/dist/esm/tools/openapi_tool/rest_api_tool.js +17 -1
- package/dist/esm/tools/toolbox_toolset.js +148 -0
- package/dist/esm/tools/webmcp/webmcp_toolset.js +1 -14
- package/dist/esm/utils/client_labels.js +19 -2
- package/dist/esm/utils/failover_utils.js +1 -1
- package/dist/esm/utils/gemini_schema_util.js +23 -6
- package/dist/esm/utils/logger_node.js +4 -0
- package/dist/esm/utils/output_schema_utils.js +5 -2
- package/dist/esm/utils/task.js +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/types/agents/agent_engine_client.d.ts +37 -0
- package/dist/types/agents/base_agent.d.ts +12 -0
- package/dist/types/agents/llm_agent.d.ts +5 -1
- package/dist/types/agents/processors/content_processor_utils.d.ts +4 -2
- package/dist/types/agents/processors/nl_planning_processor.d.ts +2 -1
- package/dist/types/cli/utils/logs.d.ts +1 -1
- package/dist/types/code_executors/container_code_executor.d.ts +17 -5
- package/dist/types/common.d.ts +5 -9
- package/dist/types/errors/input_validation_error.d.ts +2 -1
- package/dist/types/index.d.ts +4 -2
- package/dist/types/plugins/base_plugin.d.ts +0 -10
- package/dist/types/sessions/base_session_service.d.ts +5 -0
- package/dist/types/sessions/database_session_service.d.ts +17 -1
- package/dist/types/sessions/stale_session_error.d.ts +21 -0
- package/dist/types/skills/loader.d.ts +3 -2
- package/dist/types/telemetry/tracing.d.ts +17 -3
- package/dist/types/tools/apihub_tool/apihub_toolset.d.ts +14 -21
- package/dist/types/tools/application_integration_tool/application_integration_toolset.d.ts +32 -9
- package/dist/types/tools/application_integration_tool/clients/connections_client.d.ts +22 -8
- package/dist/types/tools/application_integration_tool/clients/integration_client.d.ts +3 -3
- package/dist/types/tools/application_integration_tool/integration_connector_tool.d.ts +70 -0
- package/dist/types/tools/base_toolset.d.ts +6 -5
- package/dist/types/tools/google_api_tool/google_api_tool.d.ts +10 -3
- package/dist/types/tools/google_api_tool/google_api_toolset.d.ts +55 -0
- package/dist/types/tools/google_api_tool/google_api_toolsets.d.ts +48 -0
- package/dist/types/tools/google_api_tool/googleapi_to_openapi_converter.d.ts +5 -4
- package/dist/types/tools/google_api_tool/index.d.ts +4 -5
- package/dist/types/tools/load_artifacts_tool.d.ts +14 -1
- package/dist/types/tools/load_memory_tool.d.ts +23 -1
- package/dist/types/tools/openapi_tool/openapi_spec_parser/openapi_spec_parser.d.ts +12 -0
- package/dist/types/tools/openapi_tool/openapi_spec_parser/operation_parser.d.ts +8 -0
- package/dist/types/tools/openapi_tool/openapi_toolset.d.ts +5 -0
- package/dist/types/tools/openapi_tool/rest_api_tool.d.ts +10 -0
- package/dist/types/tools/toolbox_toolset.d.ts +159 -0
- package/dist/types/utils/client_labels.d.ts +2 -1
- package/dist/types/utils/gemini_schema_util.d.ts +8 -0
- package/dist/types/utils/output_schema_utils.d.ts +3 -2
- package/dist/types/utils/simple_zod_to_json.d.ts +1 -2
- package/dist/types/version.d.ts +1 -1
- package/dist/web/index_web.js +74 -66
- package/dist/web/index_web.js.map +4 -4
- package/package.json +34 -27
- package/dist/cjs/agents/remote_agent.js +0 -187
- package/dist/cjs/tools/crewai_tool.js +0 -132
- package/dist/cjs/tools/google_api_tool/google_api_tool_set.js +0 -226
- package/dist/cjs/tools/google_api_tool/google_api_tool_sets.js +0 -58
- package/dist/cjs/tools/langchain_tool.js +0 -172
- package/dist/cjs/tools/toolbox_tool.js +0 -108
- package/dist/esm/agents/remote_agent.js +0 -164
- package/dist/esm/tools/crewai_tool.js +0 -107
- package/dist/esm/tools/google_api_tool/google_api_tool_set.js +0 -188
- package/dist/esm/tools/google_api_tool/google_api_tool_sets.js +0 -24
- package/dist/esm/tools/langchain_tool.js +0 -148
- package/dist/esm/tools/toolbox_tool.js +0 -80
- package/dist/types/agents/remote_agent.d.ts +0 -68
- package/dist/types/tools/crewai_tool.d.ts +0 -85
- package/dist/types/tools/google_api_tool/google_api_tool_set.d.ts +0 -78
- package/dist/types/tools/google_api_tool/google_api_tool_sets.d.ts +0 -33
- package/dist/types/tools/langchain_tool.d.ts +0 -103
- package/dist/types/tools/toolbox_tool.d.ts +0 -73
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { ReadonlyContext } from '../../agents/readonly_context.js';
|
|
7
|
+
import { BaseToolset, ToolPredicate } from '../base_toolset.js';
|
|
8
|
+
import { GoogleApiTool } from './google_api_tool.js';
|
|
9
|
+
declare const GOOGLE_API_TOOLSET_SIGNATURE_SYMBOL: unique symbol;
|
|
10
|
+
/**
|
|
11
|
+
* Options for constructing a {@link GoogleApiToolset}.
|
|
12
|
+
*/
|
|
13
|
+
export interface GoogleApiToolsetOptions {
|
|
14
|
+
apiName?: string;
|
|
15
|
+
apiVersion?: string;
|
|
16
|
+
clientId?: string;
|
|
17
|
+
clientSecret?: string;
|
|
18
|
+
toolFilter?: ToolPredicate | string[];
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Type guard to check if an object is an instance of {@link GoogleApiToolset}.
|
|
22
|
+
*/
|
|
23
|
+
export declare function isGoogleApiToolset(obj: unknown): obj is GoogleApiToolset;
|
|
24
|
+
/**
|
|
25
|
+
* Toolset that wraps Google Discovery API operations as {@link GoogleApiTool}
|
|
26
|
+
* instances configured for Google OpenID Connect authentication.
|
|
27
|
+
*/
|
|
28
|
+
export declare class GoogleApiToolset extends BaseToolset {
|
|
29
|
+
readonly [GOOGLE_API_TOOLSET_SIGNATURE_SYMBOL] = true;
|
|
30
|
+
toolFilter: ToolPredicate | string[];
|
|
31
|
+
readonly apiName?: string;
|
|
32
|
+
readonly apiVersion?: string;
|
|
33
|
+
private clientId?;
|
|
34
|
+
private clientSecret?;
|
|
35
|
+
private openapiToolset?;
|
|
36
|
+
private loadingPromise?;
|
|
37
|
+
private tools;
|
|
38
|
+
constructor(options?: GoogleApiToolsetOptions);
|
|
39
|
+
private loadToolsetWithOidcAuth;
|
|
40
|
+
private ensureToolsLoaded;
|
|
41
|
+
/**
|
|
42
|
+
* Returns all tools in the toolset matching the active `toolFilter`.
|
|
43
|
+
*/
|
|
44
|
+
getTools(context?: ReadonlyContext): Promise<GoogleApiTool[]>;
|
|
45
|
+
/**
|
|
46
|
+
* Updates the tool filter used by {@link getTools}.
|
|
47
|
+
*/
|
|
48
|
+
setToolFilter(toolFilter: ToolPredicate | string[]): void;
|
|
49
|
+
/**
|
|
50
|
+
* Configures OAuth2 client ID and secret across all tools in the toolset.
|
|
51
|
+
*/
|
|
52
|
+
configureAuth(clientId?: string, clientSecret?: string): void;
|
|
53
|
+
close(): Promise<void>;
|
|
54
|
+
}
|
|
55
|
+
export {};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { GoogleApiToolset, type GoogleApiToolsetOptions } from './google_api_toolset.js';
|
|
7
|
+
/**
|
|
8
|
+
* Toolset for the Google BigQuery v2 API.
|
|
9
|
+
*/
|
|
10
|
+
export declare class BigQueryToolset extends GoogleApiToolset {
|
|
11
|
+
constructor(options?: GoogleApiToolsetOptions);
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Toolset for the Google Calendar v3 API.
|
|
15
|
+
*/
|
|
16
|
+
export declare class CalendarToolset extends GoogleApiToolset {
|
|
17
|
+
constructor(options?: GoogleApiToolsetOptions);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Toolset for the Gmail v1 API.
|
|
21
|
+
*/
|
|
22
|
+
export declare class GmailToolset extends GoogleApiToolset {
|
|
23
|
+
constructor(options?: GoogleApiToolsetOptions);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Toolset for the YouTube Data v3 API.
|
|
27
|
+
*/
|
|
28
|
+
export declare class YoutubeToolset extends GoogleApiToolset {
|
|
29
|
+
constructor(options?: GoogleApiToolsetOptions);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Toolset for the Google Slides v1 API.
|
|
33
|
+
*/
|
|
34
|
+
export declare class SlidesToolset extends GoogleApiToolset {
|
|
35
|
+
constructor(options?: GoogleApiToolsetOptions);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Toolset for the Google Sheets v4 API.
|
|
39
|
+
*/
|
|
40
|
+
export declare class SheetsToolset extends GoogleApiToolset {
|
|
41
|
+
constructor(options?: GoogleApiToolsetOptions);
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Toolset for the Google Docs v1 API.
|
|
45
|
+
*/
|
|
46
|
+
export declare class DocsToolset extends GoogleApiToolset {
|
|
47
|
+
constructor(options?: GoogleApiToolsetOptions);
|
|
48
|
+
}
|
|
@@ -49,6 +49,7 @@ export interface GoogleApiSchema {
|
|
|
49
49
|
export interface GoogleApiMethod {
|
|
50
50
|
id?: string;
|
|
51
51
|
path?: string;
|
|
52
|
+
flatPath?: string;
|
|
52
53
|
httpMethod?: string;
|
|
53
54
|
description?: string;
|
|
54
55
|
parameters?: Record<string, GoogleApiParameter>;
|
|
@@ -144,10 +145,10 @@ export declare function convertResources(resources: Record<string, GoogleApiReso
|
|
|
144
145
|
* Converts Google API Discovery documents into OpenAPI v3.0.0 specifications.
|
|
145
146
|
*/
|
|
146
147
|
export declare class GoogleApiToOpenApiConverter {
|
|
147
|
-
readonly apiName
|
|
148
|
-
readonly apiVersion
|
|
149
|
-
googleApiSpec
|
|
150
|
-
openapiSpec
|
|
148
|
+
private readonly apiName;
|
|
149
|
+
private readonly apiVersion;
|
|
150
|
+
private googleApiSpec;
|
|
151
|
+
private openapiSpec;
|
|
151
152
|
constructor(apiName: string, apiVersion: string);
|
|
152
153
|
/**
|
|
153
154
|
* Fetches the Google API specification from the Google Discovery service.
|
|
@@ -4,8 +4,7 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
export { GoogleApiTool, isGoogleApiTool } from './google_api_tool.js';
|
|
7
|
-
export {
|
|
8
|
-
export
|
|
9
|
-
export {
|
|
10
|
-
export {
|
|
11
|
-
export type { GoogleApiMethod, GoogleApiOAuth2Scope, GoogleApiParameter, GoogleApiResource, GoogleApiSchema, GoogleApiSpec, } from './googleapi_to_openapi_converter.js';
|
|
7
|
+
export type { GoogleApiToolOptions } from './google_api_tool.js';
|
|
8
|
+
export { GoogleApiToolset, isGoogleApiToolset } from './google_api_toolset.js';
|
|
9
|
+
export type { GoogleApiToolsetOptions } from './google_api_toolset.js';
|
|
10
|
+
export { BigQueryToolset, CalendarToolset, DocsToolset, GmailToolset, SheetsToolset, SlidesToolset, YoutubeToolset, } from './google_api_toolsets.js';
|
|
@@ -3,8 +3,21 @@
|
|
|
3
3
|
* Copyright 2026 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import { FunctionDeclaration } from '@google/genai';
|
|
6
|
+
import { FunctionDeclaration, Part } from '@google/genai';
|
|
7
7
|
import { BaseTool, RunAsyncToolRequest, ToolProcessLlmRequest } from './base_tool.js';
|
|
8
|
+
/**
|
|
9
|
+
* Returns a part that the model can read for the given artifact.
|
|
10
|
+
*
|
|
11
|
+
* Parts without inline data, and inline data that Gemini accepts (images,
|
|
12
|
+
* audio, video and PDF), are returned as they are. Other inline data becomes a
|
|
13
|
+
* text part: the decoded content for text-like types, and a placeholder for
|
|
14
|
+
* binary or missing data.
|
|
15
|
+
*
|
|
16
|
+
* @param artifact The artifact to convert.
|
|
17
|
+
* @param artifactName The artifact name used in the placeholder text.
|
|
18
|
+
* @return The artifact itself, or a text part that replaces it.
|
|
19
|
+
*/
|
|
20
|
+
export declare function asSafePartForLlm(artifact: Part, artifactName: string): Part;
|
|
8
21
|
/**
|
|
9
22
|
* A tool that loads the artifacts and adds them to the session.
|
|
10
23
|
*/
|
|
@@ -4,14 +4,36 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
import { FunctionDeclaration } from '@google/genai';
|
|
7
|
+
import type { MemoryEntry } from '../memory/memory_entry.js';
|
|
7
8
|
import { BaseTool, RunAsyncToolRequest, ToolProcessLlmRequest } from './base_tool.js';
|
|
9
|
+
/**
|
|
10
|
+
* Configuration options for {@link LoadMemoryTool}.
|
|
11
|
+
*/
|
|
12
|
+
export interface LoadMemoryToolOptions {
|
|
13
|
+
/**
|
|
14
|
+
* Whether to flatten memory content into space-separated text strings.
|
|
15
|
+
*
|
|
16
|
+
* @deprecated Set `textOnlyContent: true` only to retain legacy string content. The default is `false`, returning complete {@link MemoryEntry} objects. This option will be removed in a future release.
|
|
17
|
+
*/
|
|
18
|
+
readonly textOnlyContent?: boolean;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Response returned by {@link LoadMemoryTool}.
|
|
22
|
+
*
|
|
23
|
+
* When {@link LoadMemoryToolOptions.textOnlyContent} is enabled, entries contain
|
|
24
|
+
* string content instead of a `Content` object.
|
|
25
|
+
*/
|
|
26
|
+
export interface LoadMemoryResponse {
|
|
27
|
+
memories: MemoryEntry[];
|
|
28
|
+
}
|
|
8
29
|
/**
|
|
9
30
|
* A tool that loads the memory for the current user.
|
|
10
31
|
*
|
|
11
32
|
* NOTE: Currently this tool only uses text part from the memory.
|
|
12
33
|
*/
|
|
13
34
|
export declare class LoadMemoryTool extends BaseTool {
|
|
14
|
-
|
|
35
|
+
private readonly textOnlyContent;
|
|
36
|
+
constructor(options?: LoadMemoryToolOptions);
|
|
15
37
|
_getDeclaration(): FunctionDeclaration | undefined;
|
|
16
38
|
runAsync({ args, toolContext, }: RunAsyncToolRequest): Promise<unknown>;
|
|
17
39
|
processLlmRequest(request: ToolProcessLlmRequest): Promise<void>;
|
|
@@ -28,8 +28,20 @@ export interface ParsedOperation {
|
|
|
28
28
|
}
|
|
29
29
|
export declare class OpenApiSpecParser {
|
|
30
30
|
private preservePropertyNames;
|
|
31
|
+
private unconstrainedObjectBodyAsParameter;
|
|
32
|
+
/**
|
|
33
|
+
* @param options.preservePropertyNames Keeps the original parameter and
|
|
34
|
+
* function names instead of converting them to snake_case.
|
|
35
|
+
* @param options.unconstrainedObjectBodyAsParameter Emits a whole-body
|
|
36
|
+
* parameter named `body` when an object request body schema has no
|
|
37
|
+
* properties. Defaults to `false`.
|
|
38
|
+
* @deprecated Retained for backwards compatibility; empty object schemas
|
|
39
|
+
* produce no parameters by default. This option will be removed in a
|
|
40
|
+
* future release.
|
|
41
|
+
*/
|
|
31
42
|
constructor(options?: {
|
|
32
43
|
preservePropertyNames?: boolean;
|
|
44
|
+
unconstrainedObjectBodyAsParameter?: boolean;
|
|
33
45
|
});
|
|
34
46
|
/**
|
|
35
47
|
* Parses an OpenAPI specification document and extracts a list of operations.
|
|
@@ -22,6 +22,7 @@ export declare class OperationParser {
|
|
|
22
22
|
private params;
|
|
23
23
|
private returnValue?;
|
|
24
24
|
private preservePropertyNames;
|
|
25
|
+
private unconstrainedObjectBodyAsParameter;
|
|
25
26
|
private readonly operation;
|
|
26
27
|
/**
|
|
27
28
|
* @param operation The operation to parse. A string is parsed as JSON, and a
|
|
@@ -30,10 +31,17 @@ export declare class OperationParser {
|
|
|
30
31
|
* function names instead of converting them to snake_case.
|
|
31
32
|
* @param options.shouldParse Whether to parse the operation during
|
|
32
33
|
* construction. Defaults to `true`.
|
|
34
|
+
* @param options.unconstrainedObjectBodyAsParameter Emits a whole-body
|
|
35
|
+
* parameter named `body` when an object request body schema has no
|
|
36
|
+
* properties. Defaults to `false`.
|
|
37
|
+
* @deprecated Retained for backwards compatibility; empty object schemas
|
|
38
|
+
* produce no parameters by default. This option will be removed in a
|
|
39
|
+
* future release.
|
|
33
40
|
*/
|
|
34
41
|
constructor(operation: OpenAPIV3.OperationObject | Record<string, unknown> | string, options?: {
|
|
35
42
|
preservePropertyNames?: boolean;
|
|
36
43
|
shouldParse?: boolean;
|
|
44
|
+
unconstrainedObjectBodyAsParameter?: boolean;
|
|
37
45
|
});
|
|
38
46
|
/**
|
|
39
47
|
* Builds a parser from parameters that were already parsed, without walking
|
|
@@ -22,6 +22,11 @@ export declare class OpenAPIToolset extends BaseToolset {
|
|
|
22
22
|
authCredential?: AuthCredential;
|
|
23
23
|
credentialKey?: string;
|
|
24
24
|
headerProvider?: (context: ReadonlyContext) => Record<string, string>;
|
|
25
|
+
/**
|
|
26
|
+
* @deprecated Emits a whole-body parameter for unconstrained object schemas.
|
|
27
|
+
* Will be removed in a future release.
|
|
28
|
+
*/
|
|
29
|
+
unconstrainedObjectBodyAsParameter?: boolean;
|
|
25
30
|
});
|
|
26
31
|
getTools(context?: ReadonlyContext): Promise<BaseTool[]>;
|
|
27
32
|
/**
|
|
@@ -41,6 +41,11 @@ export declare class RestApiTool extends BaseTool {
|
|
|
41
41
|
headerProvider?: (context: ReadonlyContext) => Record<string, string>;
|
|
42
42
|
credentialKey?: string;
|
|
43
43
|
operationParser?: OperationParser;
|
|
44
|
+
/**
|
|
45
|
+
* @deprecated Emits a whole-body parameter for unconstrained object schemas.
|
|
46
|
+
* Will be removed in a future release.
|
|
47
|
+
*/
|
|
48
|
+
unconstrainedObjectBodyAsParameter?: boolean;
|
|
44
49
|
});
|
|
45
50
|
configureAuthScheme(authScheme: OpenAPIV3.SecuritySchemeObject): void;
|
|
46
51
|
configureAuthCredential(authCredential: AuthCredential): void;
|
|
@@ -69,6 +74,11 @@ export declare function createRestApiTool(parsed: ParsedOperationInput, options?
|
|
|
69
74
|
preservePropertyNames?: boolean;
|
|
70
75
|
headerProvider?: (context: ReadonlyContext) => Record<string, string>;
|
|
71
76
|
credentialKey?: string;
|
|
77
|
+
/**
|
|
78
|
+
* @deprecated Emits a whole-body parameter for unconstrained object schemas.
|
|
79
|
+
* Will be removed in a future release.
|
|
80
|
+
*/
|
|
81
|
+
unconstrainedObjectBodyAsParameter?: boolean;
|
|
72
82
|
}): RestApiTool;
|
|
73
83
|
/**
|
|
74
84
|
* Builds a `RestApiTool` from the JSON string form of a parsed operation.
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { ReadonlyContext } from '../agents/readonly_context.js';
|
|
7
|
+
import { BaseTool } from './base_tool.js';
|
|
8
|
+
import { BaseToolset, ToolPredicate } from './base_toolset.js';
|
|
9
|
+
import { ToolInputParameters } from './function_tool.js';
|
|
10
|
+
/**
|
|
11
|
+
* Structural interface for a tool loaded from a Toolbox client.
|
|
12
|
+
*/
|
|
13
|
+
export interface ToolboxToolLike {
|
|
14
|
+
/**
|
|
15
|
+
* The name of the tool.
|
|
16
|
+
*/
|
|
17
|
+
name?: string;
|
|
18
|
+
/**
|
|
19
|
+
* The description of the tool.
|
|
20
|
+
*/
|
|
21
|
+
description?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Optional parameter schema for the tool.
|
|
24
|
+
*/
|
|
25
|
+
parameters?: ToolInputParameters;
|
|
26
|
+
/**
|
|
27
|
+
* Executes the tool with the given arguments.
|
|
28
|
+
*/
|
|
29
|
+
execute?(...args: never[]): unknown | Promise<unknown>;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Options forwarded to a Toolbox client when loading a tool or toolset.
|
|
33
|
+
*/
|
|
34
|
+
export interface ToolboxLoadOptions {
|
|
35
|
+
/**
|
|
36
|
+
* Mapping of authentication service names to callables that return the
|
|
37
|
+
* corresponding authentication token.
|
|
38
|
+
*/
|
|
39
|
+
authTokenGetters?: Record<string, () => string | Promise<string>>;
|
|
40
|
+
/**
|
|
41
|
+
* Mapping of parameter names to bind to fixed values or callables that
|
|
42
|
+
* produce values as needed.
|
|
43
|
+
*/
|
|
44
|
+
boundParams?: Record<string, unknown>;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Structural interface for an asynchronous or synchronous Toolbox client
|
|
48
|
+
* instance used by {@link ToolboxToolset}.
|
|
49
|
+
*/
|
|
50
|
+
export interface ToolboxToolsetClientLike {
|
|
51
|
+
/**
|
|
52
|
+
* Loads a single tool by name (camelCase convention).
|
|
53
|
+
*/
|
|
54
|
+
loadTool?: (toolName: string, options?: ToolboxLoadOptions) => BaseTool | ToolboxToolLike | ((...args: never[]) => unknown) | Promise<BaseTool | ToolboxToolLike | ((...args: never[]) => unknown)>;
|
|
55
|
+
/**
|
|
56
|
+
* Loads a single tool by name (snake_case convention).
|
|
57
|
+
*/
|
|
58
|
+
load_tool?: (toolName: string, options?: ToolboxLoadOptions) => BaseTool | ToolboxToolLike | ((...args: never[]) => unknown) | Promise<BaseTool | ToolboxToolLike | ((...args: never[]) => unknown)>;
|
|
59
|
+
/**
|
|
60
|
+
* Loads a toolset by name (camelCase convention).
|
|
61
|
+
*/
|
|
62
|
+
loadToolset?: (toolsetName: string, options?: ToolboxLoadOptions) => Array<BaseTool | ToolboxToolLike | ((...args: never[]) => unknown)> | Promise<Array<BaseTool | ToolboxToolLike | ((...args: never[]) => unknown)>>;
|
|
63
|
+
/**
|
|
64
|
+
* Loads a toolset by name (snake_case convention).
|
|
65
|
+
*/
|
|
66
|
+
load_toolset?: (toolsetName: string, options?: ToolboxLoadOptions) => Array<BaseTool | ToolboxToolLike | ((...args: never[]) => unknown)> | Promise<Array<BaseTool | ToolboxToolLike | ((...args: never[]) => unknown)>>;
|
|
67
|
+
/**
|
|
68
|
+
* Closes the underlying client resources.
|
|
69
|
+
*/
|
|
70
|
+
close?: () => void | Promise<void>;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Configuration options for {@link ToolboxToolset}.
|
|
74
|
+
*/
|
|
75
|
+
export interface ToolboxToolsetOptions {
|
|
76
|
+
/**
|
|
77
|
+
* The URL of the Toolbox server.
|
|
78
|
+
*/
|
|
79
|
+
serverUrl: string;
|
|
80
|
+
/**
|
|
81
|
+
* The name of the Toolbox toolset to load.
|
|
82
|
+
*/
|
|
83
|
+
toolsetName?: string;
|
|
84
|
+
/**
|
|
85
|
+
* The names of the individual tools to load.
|
|
86
|
+
*/
|
|
87
|
+
toolNames?: readonly string[];
|
|
88
|
+
/**
|
|
89
|
+
* Mapping of authentication service names to callables that return the
|
|
90
|
+
* corresponding authentication token.
|
|
91
|
+
*/
|
|
92
|
+
authTokenGetters?: Record<string, () => string | Promise<string>>;
|
|
93
|
+
/**
|
|
94
|
+
* Mapping of parameter names to bind to fixed values or callables that
|
|
95
|
+
* produce values as needed.
|
|
96
|
+
*/
|
|
97
|
+
boundParams?: Record<string, unknown>;
|
|
98
|
+
/**
|
|
99
|
+
* Optional pre-configured Toolbox client instance.
|
|
100
|
+
*/
|
|
101
|
+
client?: ToolboxToolsetClientLike;
|
|
102
|
+
/**
|
|
103
|
+
* Optional filter to select which tools are exposed to the LLM.
|
|
104
|
+
*/
|
|
105
|
+
toolFilter?: ToolPredicate | string[];
|
|
106
|
+
/**
|
|
107
|
+
* Optional prefix prepended (`${prefix}_`) to loaded tool names.
|
|
108
|
+
*/
|
|
109
|
+
prefix?: string;
|
|
110
|
+
}
|
|
111
|
+
declare const TOOLBOX_TOOLSET_SIGNATURE_SYMBOL: unique symbol;
|
|
112
|
+
/**
|
|
113
|
+
* Type guard to check if an object is an instance of {@link ToolboxToolset}.
|
|
114
|
+
*/
|
|
115
|
+
export declare function isToolboxToolset(obj: unknown): obj is ToolboxToolset;
|
|
116
|
+
/**
|
|
117
|
+
* Provides asynchronous access to Toolbox tools and toolsets as a
|
|
118
|
+
* {@link BaseToolset}.
|
|
119
|
+
*/
|
|
120
|
+
export declare class ToolboxToolset extends BaseToolset {
|
|
121
|
+
/** A unique symbol to identify ADK ToolboxToolset class. */
|
|
122
|
+
readonly [TOOLBOX_TOOLSET_SIGNATURE_SYMBOL] = true;
|
|
123
|
+
/**
|
|
124
|
+
* The URL of the Toolbox server.
|
|
125
|
+
*/
|
|
126
|
+
readonly serverUrl: string;
|
|
127
|
+
/**
|
|
128
|
+
* The name of the Toolbox toolset to load, if configured.
|
|
129
|
+
*/
|
|
130
|
+
readonly toolsetName?: string;
|
|
131
|
+
/**
|
|
132
|
+
* The names of the individual tools to load, if configured.
|
|
133
|
+
*/
|
|
134
|
+
readonly toolNames?: readonly string[];
|
|
135
|
+
/**
|
|
136
|
+
* Mapping of authentication service names to token getters.
|
|
137
|
+
*/
|
|
138
|
+
readonly authTokenGetters: Record<string, () => string | Promise<string>>;
|
|
139
|
+
/**
|
|
140
|
+
* Mapping of parameter names to bound values or value getters.
|
|
141
|
+
*/
|
|
142
|
+
readonly boundParams: Record<string, unknown>;
|
|
143
|
+
/**
|
|
144
|
+
* The underlying Toolbox client instance.
|
|
145
|
+
*/
|
|
146
|
+
readonly toolboxClient: ToolboxToolsetClientLike;
|
|
147
|
+
constructor(options: ToolboxToolsetOptions);
|
|
148
|
+
constructor(serverUrl: string, options: Omit<ToolboxToolsetOptions, 'serverUrl'>);
|
|
149
|
+
/**
|
|
150
|
+
* Loads the configured toolset and/or individual tools from the Toolbox
|
|
151
|
+
* client and returns the selected {@link BaseTool} instances.
|
|
152
|
+
*/
|
|
153
|
+
getTools(context?: ReadonlyContext): Promise<BaseTool[]>;
|
|
154
|
+
/**
|
|
155
|
+
* Closes the underlying Toolbox client.
|
|
156
|
+
*/
|
|
157
|
+
close(): Promise<void>;
|
|
158
|
+
}
|
|
159
|
+
export {};
|
|
@@ -41,7 +41,8 @@ export declare function getTrackingHeaders(): Record<string, string>;
|
|
|
41
41
|
* single space, so the two differ only for values with repeated or non-space
|
|
42
42
|
* whitespace. Commas are not treated as separators, so a `Headers` object that
|
|
43
43
|
* joined two values of one header with `, ` keeps the comma on the first
|
|
44
|
-
* token.
|
|
44
|
+
* token. Other repeated header names use the platform `Headers` semantics;
|
|
45
|
+
* for example, repeated `Cookie` values are joined with `; `.
|
|
45
46
|
*
|
|
46
47
|
* The input is never mutated.
|
|
47
48
|
*
|
|
@@ -10,6 +10,14 @@ export type MCPToolSchema = {
|
|
|
10
10
|
required?: string[];
|
|
11
11
|
};
|
|
12
12
|
export declare function toGeminiSchema(mcpSchema?: MCPToolSchema): Schema | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* Normalizes a JSON Schema `type` value into a single non-null type name and a
|
|
15
|
+
* `nullable` flag.
|
|
16
|
+
*
|
|
17
|
+
* When `type` is an array containing multiple non-null types, the first
|
|
18
|
+
* non-null entry is selected as the primary Gemini schema type.
|
|
19
|
+
*/
|
|
20
|
+
export declare function normalizeJsonSchemaType(jsonSchemaType?: unknown): [string | undefined, boolean];
|
|
13
21
|
/**
|
|
14
22
|
* Converts an OpenAPI schema to a Gemini `Schema`.
|
|
15
23
|
*
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* Copyright 2026 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
+
import { BaseLlm } from '../models/base_llm.js';
|
|
6
7
|
/**
|
|
7
8
|
* Returns whether the model can natively accept an output schema at the same
|
|
8
9
|
* time as tools, which is strictly more reliable than the prompt-based
|
|
@@ -12,7 +13,7 @@
|
|
|
12
13
|
* `false` for them even on Vertex AI, where they do support the capability.
|
|
13
14
|
* That under-reporting is a known gap.
|
|
14
15
|
*
|
|
15
|
-
* @param
|
|
16
|
+
* @param model A simple or path-based model name, or a `BaseLlm` instance.
|
|
16
17
|
* @return True if the model supports an output schema alongside tools.
|
|
17
18
|
*/
|
|
18
|
-
export declare function canUseOutputSchemaWithTools(
|
|
19
|
+
export declare function canUseOutputSchemaWithTools(model: string | BaseLlm): boolean;
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import { Schema } from '@google/genai';
|
|
7
7
|
import { z as z3 } from 'zod/v3';
|
|
8
8
|
import { z as z4 } from 'zod/v4';
|
|
9
|
-
type ZodSchema<T = unknown> = z3.ZodType<T> | z4.ZodType<T>;
|
|
9
|
+
export type ZodSchema<T = unknown> = z3.ZodType<T> | z4.ZodType<T>;
|
|
10
10
|
/** Returns true if the value is a Zod schema (v3 or v4). */
|
|
11
11
|
export declare function isZodSchema(obj: unknown): obj is ZodSchema;
|
|
12
12
|
/** Returns true if the value is a Zod v3 schema. */
|
|
@@ -18,4 +18,3 @@ export declare function isZodV4Schema(obj: unknown): obj is z4.ZodType;
|
|
|
18
18
|
*/
|
|
19
19
|
export declare function isZodObject(obj: unknown): obj is z3.ZodObject<z3.ZodRawShape> | z4.ZodObject<z4.ZodRawShape>;
|
|
20
20
|
export declare function zodObjectToSchema(schema: z3.ZodObject<z3.ZodRawShape> | z4.ZodObject<z4.ZodRawShape>): Schema;
|
|
21
|
-
export {};
|
package/dist/types/version.d.ts
CHANGED