GeezerVison is showing adk.dev — OpenAPIToolset | ADK for TypeScript: API Reference - v2.5.0
Base class for toolset.
A toolset is a collection of tools that can be used by an agent.
Constructors
constructor
-
new OpenAPIToolset( options?: { authCredential?: AuthCredential; authScheme?: SecuritySchemeObject; credentialKey?: string; headerProvider?: (context: ReadonlyContext) => Record<string, string>; prefix?: string; preservePropertyNames?: boolean; specDict?: Document<{}>; specStr?: string; specType?: "json" | "yaml"; toolFilter?: | string[] | (
(tool: BaseTool, readonlyContext?: ReadonlyContext) => boolean)
; unconstrainedObjectBodyAsParameter?: boolean; },): OpenAPIToolset
Parameters
- options: {
authCredential?: AuthCredential;
authScheme?: SecuritySchemeObject;
credentialKey?: string;
headerProvider?: (context: ReadonlyContext) => Record<string, string>;
prefix?: string;
preservePropertyNames?: boolean;
specDict?: Document<{}>;
specStr?: string;
specType?: "json" | "yaml";
toolFilter?:
| string[]
| ((tool: BaseTool, readonlyContext?: ReadonlyContext) => boolean);
unconstrainedObjectBodyAsParameter?: boolean;
} = {}
-
-
OptionalauthScheme?: SecuritySchemeObject
-
OptionalcredentialKey?: string
-
OptionalheaderProvider?: (context: ReadonlyContext) => Record<string, string>
-
Optionalprefix?: string
-
OptionalpreservePropertyNames?: boolean
-
OptionalspecDict?: Document<{}>
-
OptionalspecStr?: string
-
OptionalspecType?: "json" | "yaml"
-
OptionaltoolFilter?: string[] | ((tool: BaseTool, readonlyContext?: ReadonlyContext) => boolean)
-
OptionalunconstrainedObjectBodyAsParameter?: boolean
Deprecated
Emits a whole-body parameter for unconstrained object schemas.
Will be removed in a future release.
Returns OpenAPIToolset
Properties
Readonly[BASE_TOOLSET_SIGNATURE_SYMBOL]
"[BASE_TOOLSET_SIGNATURE_SYMBOL]": true
Optional Readonlyprefix
prefix?: string
Methods
close
-
Closes the toolset.
NOTE: This method is invoked, for example, at the end of an agent server's
lifecycle or when the toolset is no longer needed. Implementations
should ensure that any open connections, files, or other managed
resources are properly released to prevent leaks.
Returns Promise<void>
A Promise that resolves when the toolset is closed.
getTool
-
Returns the parsed tool with the given name, or undefined when the spec
produced no such tool.
The lookup is over every tool parsed from the spec and does not apply
toolFilter, which selects what an agent exposes to the model rather than
what the toolset holds. When the toolset was constructed with prefix,
pass the prefixed name.
getTools
-
Returns the tools that should be exposed to LLM.
Parameters
Optionalcontext: ReadonlyContext
Context used to filter tools available to the agent. If
not defined, all tools in the toolset are returned.
Returns Promise<BaseTool[]>
A Promise that resolves to the list of tools.
ProtectedisToolSelected
-
Returns whether the tool should be exposed to LLM.
Returns boolean
Whether the tool should be exposed to LLM.
processLlmRequest
-
Processes the outgoing LLM request for this toolset. This method will be
called before each tool processes the llm request.
Use cases:
- Instead of let each tool process the llm request, we can let the toolset
process the llm request. e.g. ComputerUseToolset can add computer use
tool to the llm request.
Parameters
- _toolContext: Context
- _llmRequest: LlmRequest
The outgoing LLM request, mutable this method.
Returns Promise<void>
Constructors
Properties
Methods