Interface Tool
A tool is a database-side resource managed by the
DBMS_CLOUD_AI_AGENT PL/SQL package. Tools expose callable
functionality to agents or teams and may define an input schema.
A Tool instance can represent an existing database tool or be
configured for creation. The name-only SelectAIAgent.tool(String)
factory verifies that the tool exists and loads its metadata and attributes
before returning. SelectAIAgent.listTools() also returns handles with
loaded metadata and attributes. A handle configured for creation is obtained with
SelectAIAgent.tool(String, ToolAttributes, String, ToolStatus).
A creation-configured handle retains its supplied attributes, description,
and status without querying the database. Only such a handle can call
create(); after creation succeeds, it becomes database-backed.
enable(), disable(), drop(boolean),
describe(), and run(String) require an existing
database-side tool.
Existing tools can update individual attributes with
setAttribute(String, String) or multiple attributes with
setAttributes(ToolAttributes); both operations reload the typed
attributes after the database update succeeds.
Before creation, getStatus() and getToolAttributes() return
the configured values. For a database-backed handle, each call to either
method queries the database. getStatus() does not change the
description returned by getDescription(). The description is
supplied or loaded when the handle is initialized; getDescription()
does not query the database. Use describe() to retrieve
the database-generated tool definition.
Names and required Java arguments are checked locally. Loading metadata and
executing tool operations require database access; the database checks
privileges and validates tool attributes when they are submitted. The input
supplied to run(String) must be a JSON payload accepted by the
configured tool; the Java method checks only that it is not null or blank.
For a complete runnable example, see CreateToolSample source.
- Since:
- 1.1.0
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionbooleancreate()Creates this creation-configured tool in the database.describe()Returns the database-generated tool definition and input metadata as raw JSON.booleandisable()Disables this database-backed tool.booleandrop(boolean force) Drops this database-backed tool.booleanenable()Enables this database-backed tool.Returns the description supplied or loaded when this handle was initialized.Returns the configured status before creation or the current database status for an existing tool.Returns tool attributes for this handle.Returns the configured or database-reported tool name without database access.Runs this tool with a JSON input payload.booleansetAttribute(String attributeName, boolean attributeValue) Updates one boolean tool attribute in the database.booleansetAttribute(String attributeName, Float attributeValue) Updates one floating-point tool attribute in the database.booleansetAttribute(String attributeName, Integer attributeValue) Updates one integer tool attribute in the database.booleansetAttribute(String attributeName, String attributeValue) Updates one tool attribute in the database.booleansetAttributes(ToolAttributes toolAttributes) Updates multiple tool attributes in one database operation.
-
Method Details
-
create
Creates this creation-configured tool in the database. For a runnable example, see CreateToolSample source.- Returns:
truewhen the database creates the tool- Throws:
IllegalStateException- when this handle was loaded from an existing toolSelectAIException- when the database rejects or cannot complete the operation- See Also:
-
enable
Enables this database-backed tool. For a runnable example, see EnableToolSample source.- Returns:
truewhen the database enables the tool- Throws:
IllegalStateException- when this tool has not been createdSelectAIException- when the database operation fails
-
disable
Disables this database-backed tool. For a runnable example, see DisableToolSample source.- Returns:
truewhen the database disables the tool- Throws:
IllegalStateException- when this tool has not been createdSelectAIException- when the database operation fails
-
drop
Drops this database-backed tool. Whenforceistrue, the operation may be retried after the handle has already been dropped; the database force-drop semantics determine the result. For a runnable example, see DropToolSample source.- Parameters:
force- database force-drop option- Returns:
truewhen the drop completes- Throws:
IllegalStateException- whenforceisfalseand this tool has not been createdSelectAIException- when the database operation fails
-
setAttribute
Updates one tool attribute in the database. For a runnable example, see SetToolAttributeSample source.- Parameters:
attributeName- database tool attribute nameattributeValue- string value, ornullwhere supported- Returns:
truewhen the update succeeds- Throws:
IllegalArgumentException- whenattributeNameis null or blankIllegalStateException- when this tool has not been createdSelectAIException- when the database update fails
-
setAttribute
Updates one boolean tool attribute in the database. For a runnable example, see SetToolAttributeSample source.- Parameters:
attributeName- database tool attribute nameattributeValue- boolean value- Returns:
truewhen the update succeeds- Throws:
IllegalArgumentException- whenattributeNameis null or blankIllegalStateException- when this tool has not been createdSelectAIException- when the database update fails
-
setAttribute
Updates one integer tool attribute in the database. For a runnable example, see SetToolAttributeSample source.- Parameters:
attributeName- database tool attribute nameattributeValue- integer value- Returns:
truewhen the update succeeds- Throws:
IllegalArgumentException- whenattributeNameis null or blank, orattributeValueis nullIllegalStateException- when this tool has not been createdSelectAIException- when the database update fails
-
setAttribute
Updates one floating-point tool attribute in the database. For a runnable example, see SetToolAttributeSample source.- Parameters:
attributeName- database tool attribute nameattributeValue- floating-point value- Returns:
truewhen the update succeeds- Throws:
IllegalArgumentException- whenattributeNameis null or blank, orattributeValueis nullIllegalStateException- when this tool has not been createdSelectAIException- when the database update fails
-
setAttributes
Updates multiple tool attributes in one database operation. For a runnable example, see SetToolAttributesSample source.- Parameters:
toolAttributes- tool attributes to update- Returns:
truewhen the update succeeds- Throws:
IllegalArgumentException- whentoolAttributesis nullIllegalStateException- when this tool has not been createdSelectAIException- when the database update fails- See Also:
-
describe
Returns the database-generated tool definition and input metadata as raw JSON. For a runnable example, see DescribeToolSample source.- Returns:
- JSON returned by the database package
- Throws:
IllegalStateException- when this tool has not been createdSelectAIException- when the database operation fails
-
run
Runs this tool with a JSON input payload.The SDK checks only that the payload is non-null and non-blank. The configured tool and database validate the JSON shape and its values. For a runnable example, see RunToolSample source.
- Parameters:
inputJson- JSON input accepted by the configured tool- Returns:
- typed result retaining the raw value returned by the database package
- Throws:
IllegalArgumentException- wheninputJsonis null or blankIllegalStateException- when this tool has not been createdSelectAIException- when the database operation fails
-
getToolName
Returns the configured or database-reported tool name without database access. For a runnable example, see LoadToolSample source.- Returns:
- configured or database-reported tool name
-
getDescription
Returns the description supplied or loaded when this handle was initialized. This method does not access the database and the value is not changed bygetStatus(). For a runnable example, see LoadToolSample source.- Returns:
- supplied or loaded tool description, or
nullwhen absent
-
getStatus
Returns the configured status before creation or the current database status for an existing tool. A pending tool with no configured status returnsnull. This method does not change the description. For a runnable example, see LoadToolSample source.- Returns:
- configured or current tool status
- Throws:
SelectAIException- when current tool metadata cannot be fetched
-
getToolAttributes
Returns tool attributes for this handle.For a database-backed tool, this method reloads the attributes from the database on each call and therefore can fail if the resource was deleted. For a creation-configured tool, it returns the configured attributes without querying the database. Built-in tool parameters use immutable
ToolParamsmodels. Input metadata is exposed as immutableToolInputentries. Unknown parameter fields and newer database schemas are preserved. For a runnable example, see LoadToolSample source.- Returns:
- current tool attributes for an existing tool, or configured attributes for a tool pending creation
- Throws:
SelectAIException- when the tool no longer exists or current attributes cannot be fetched
-