# Truto LLM Tools Overview

> Source: https://truto.one/docs/guides/tools/overview/

Truto provides all the resources defined on an Integration as tools for your LLM frameworks to use.

We currently support the following LLM frameworks:

- Langchain.js - [truto-langchainjs-toolset](https://github.com/trutohq/truto-langchainjs-toolset)

Please reach out to us at support@truto.one if you need support for additional frameworks.

## How it works

Every integration on Truto is essentially a comprehensive JSON object that represents how an underlying product's API behaves. Think of it as a Swagger file, but built specifically with integrations in mind.

Integrations have a concept of `Resources`, which map to the endpoints on the underlying product's API. Resources enable us to map any API into a REST-based CRUD API.

> For example, you could have a `members` resource on the Cloudflare integration that maps to `/client/v4/accounts/:id/members` API on Cloudflare.

Every Resource has `Methods` defined on them. These can be standard ones like List, Get, Create, Update, and Delete, as well as custom ones like "Send Email".

> Taking the example further, we could define `GET /client/v4/accounts/:id/members` as a List method to retrieve all members in a Cloudflare account, and `POST /client/v4/accounts/:id/members` as a Create method to add a new member to a Cloudflare account.

The `Methods` on the `Resources` are what we currently provide as Proxy APIs, where Truto handles all pagination, authentication, and query parameter processing. They always return data in a predefined format. They are the first level of abstraction that Truto provides.

Unified APIs are built on top of these Proxy APIs with data transformation added to normalize the structure of the data into a common format across a product category. The second level of abstraction.

> We could define a User Directory Unified API that calls the `members` resource for Cloudflare integration and might call the `users` resource for Hubspot. As a consumer of the Unified API, you simply need to call the `/user-directory/users` endpoint.

Unified APIs are particularly helpful when building integrations programmatically. However, when solving problems agentically, Proxy APIs are sufficient because they can handle data normalization on their own using the raw data from the underlying product's APIs.

Truto provides a set of tools for your LLM frameworks by offering a description and schema for all the `Methods` defined on the `Resources` for an integration. We then call the [/integrated-account/:id/tools](/docs/api-reference/admin/integrated-accounts/tools) endpoint on the Truto API to return all of these Proxy APIs with their descriptions and schemas, creating Tools that LLM frameworks can use.

## Adding tools to an integration

The Truto team provides basic tool definitions for each `Resource` and `Method` by default. **Following the true Truto ethos, all of this is customizable by anyone using Truto.**

Let's walk through the steps of adding a tool definition for the Cloudflare integration:

We'll add the tool definition for the List Members endpoint on the Cloudflare integration and then call the `/tools` endpoint to see the output of what we've added.

1. Go to the Cloudflare integration in your Truto account.
![Tools cloudflare integration](https://docs-assets.truto.one/tools%20cloudflare%20integration.png)
2. Click the Edit integration button in the top right.
![Tools edit cloudflare integration](https://docs-assets.truto.one/tools_edit_integration.png)
3. Scroll down to the Resources section, expand the `members` resource, and then expand the List method.
![Tools scroll down to resource cloudflare integration](https://docs-assets.truto.one/tools_scroll_to_description.png)
4. Enter a description for the method, which will be used as the description for the tool.
![Tools add description cloudflare integration](https://docs-assets.truto.one/tools_add_description.png)
5. Next, switch to the Query Schema tab where you can specify the query parameters that the API accepts.
![Tools add query schema cloudflare integration](https://docs-assets.truto.one/tools_add_query_schema.png)
6. Scroll back to the top of the screen and click Save (Note: we're working on making this a sticky header).
7. Now connect a Cloudflare account using Truto and make a note of the integrated account ID. You can refer to our [guide on connecting accounts](https://truto.one/docs/guides/integrated-accounts/connecting-an-account#connecting-an-account-via-truto-interface).
8. After you have the integrated account ID for a Cloudflare integration, you can call the following endpoint: `GET https://api.truto.one/integrated-account/<id>/tools` ([API Reference](/docs/api-reference/admin/integrated-accounts/tools)).
![Tools tools response cloudflare integration](https://docs-assets.truto.one/tools_endpoint_response.png)

You'll receive the List Members Proxy API as a tool in the response, which can now be used with LLM providers of your choice. Our LLM SDKs use this [/tools](/docs/api-reference/admin/integrated-accounts/tools) endpoint to register tools in the LLM framework. You can refer to our [Langchain SDK](https://github.com/trutohq/truto-langchainjs-toolset) to see how it works.

These tool definitions update automatically as soon as you make changes in the Truto integration UI.

For completeness, let's improve the tool description for the List Member endpoint.

![Tools udpate description cloudflare integration](https://docs-assets.truto.one/tool_edit_description.png)

And then call the [/tools](/docs/api-reference/admin/integrated-accounts/tools) endpoint again.

![Tools updated tools response cloudflare integration](https://docs-assets.truto.one/tools_endpoint_response_2.png)

You'll see that the description has been updated in real-time!

## Seeing it in action

We've created an example file in the [Truto Langchain.js SDK repo](https://github.com/trutohq/truto-langchainjs-toolset). You can install Bun and run `bun run examples/index.ts` to see it in action.

![Tool calling](https://docs-assets.truto.one/tool_calling.gif)

## Tools API reference

You can refer to the API reference for the tools endpoint [here](/docs/api-reference/admin/integrated-accounts/tools).

The tools endpoint accepts the following query parameters to help you filter the tools based on your requirements:

- `methods` - an array of strings to filter the tools based on the type of method. For example, if you just want read-only and custom tools, you can specify `methods[0]=read&methods[1]=custom`. This will return any non-write tools available on the integrated account.
