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 Node.js CLI installed and sign up for a free account.
Register a Tool
To use a tool in your AI application, you need to register it first. Registering a tool will make it available to the
SDK to be used in an agentic framework.
When you generate a GraphQL schema for your data source, a placeholder tool definition will be added to the
file in your project. Open the file and uncomment the generated tool definition, or create your own tool definition from scratch. For example:
extend type Query {
google_books: TC_GraphQL
@supplies(query: "tc_tools")
@materializer(
query: "tc_graphql_tool"
arguments: [
{name: "name", const: "google_books"}
{
name: "description"
const: "Retrieve information from Google Books. Find books by search string, for example to search for Daniel Keyes 'Flowers for Algernon' use q: 'intitle:flowers+inauthor:keyes'"
}
{name: "fields", const: "books|book"}
]
)
}
The above are used to generate the tool definition:
- : Sets the identifier and name 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
.
After updating the tool definition you can proceed to deploying your watsonx.ai Flows Engine endpoint (by running
) to use it in your application. Click here to learn more about deploying your tools