Register Your Tools
Once you have built your own tools or imported community tools, you need to register your tools. To register tools, you need to have the watsonx.ai Flows Engine CLI installed and sign up for a free account.
Register a Tool
Once you've got a GraphQL schema for your data source, you need to run the following command from your watsonx.ai Flows Engine project to register the tool:
wxflows-py init --endpoint-name "api/my-project" \
--import-name my-tool \
--import-directory "path/to/graphql" \
--import-tool-name "my-tool" \
--import-tool-description "The description for my custom tool" \
--import-tool-fields "fieldA|fieldC"
The values you provide are used to generate the tool definition:
- : Sets the identifier for your tool.
- : Sets the name for your tool.
- : The path to the directory with the GraphQL schemas for your tool.
- : The description of what your tool does.
- : The top-leveland/orfields that the tool gets access to.
Both the values for
and
will be used by the LLM to decide if it should call the tool based on the user's message. The description will include the relevant parts of the GraphQL schema, based on the included fields in
.
Running the above command generates the tool definition for the tool called "my-tool" in the
file in your project. You can edit this tool definition or proceed to deploying your watsonx.ai Flows Engine endpoint (by running
) to use it in your application.
Edit Tool Definition
You can edit the tool definition that was generated in the
file, or register a new tool by creating the tool definition for a new tool in the
file manually:
# wxflows.toml
# ...
[[wxflows.deployment.endpoint.imports]]
name = "my-tool"
directory = "path/to/graphql"
[[wxflows.deployment.endpoint.imports.tools]]
name = "my-tool"
description = """The description for my custom tool"""
fields = "fieldA|fieldB"
After editing the
file, run
to make your tools available.