OpenApiTool class
A tool that retrieves information using OpenAPI specs. Initialized with an initial API definition (name, description, spec, auth), this class also supports adding and removing additional API definitions dynamically.
Constructors
| Open |
Constructor initializes the tool with a primary API definition. |
Properties
| definitions | Get the list of all API definitions for the tool. |
| resources | Get the tool resources for the agent. OpenApiTool doesn't have specific resources so an empty object is returned. |
Methods
| add |
Adds a new API definition dynamically. Throws if a definition with the same name already exists. |
| create |
Creates a new API definition. |
| remove |
Removes an API definition based on its name. Throws if the definition does not exist. |
Constructor Details
OpenApiTool(OpenApiFunctionDefinition)
Constructor initializes the tool with a primary API definition.
new OpenApiTool(openApiFunctionDefinition: OpenApiFunctionDefinition)
Parameters
- openApiFunctionDefinition
- OpenApiFunctionDefinition
Property Details
definitions
Get the list of all API definitions for the tool.
OpenApiToolDefinition[] definitions
Property Value
resources
Get the tool resources for the agent. OpenApiTool doesn't have specific resources so an empty object is returned.
ToolResources resources
Property Value
Method Details
addDefinition(OpenApiFunctionDefinition)
Adds a new API definition dynamically. Throws if a definition with the same name already exists.
function addDefinition(openApiFunctionDefinition: OpenApiFunctionDefinition)
Parameters
- openApiFunctionDefinition
- OpenApiFunctionDefinition
createDefinition(OpenApiFunctionDefinition)
Creates a new API definition.
static function createDefinition(openapi: OpenApiFunctionDefinition): OpenApiToolDefinition
Parameters
- openapi
- OpenApiFunctionDefinition
OpenApi function definition
Returns
The created API definition
removeDefinition(string)
Removes an API definition based on its name. Throws if the definition does not exist.
function removeDefinition(name: string)
Parameters
- name
-
string