---
schema_version: "1"
id: 8650d3c73c05167bbdb783908fd5c68eb2a1255a214d5234c9c0d20d0503431f
title: Configuring Tools Operations for Einstein AI Connector 2.0
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/einstein-ai-connector/latest/configuring-tools-operations.md
canonical_url: https://docs.mulesoft.com/einstein-ai-connector/latest/configuring-tools-operations
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 21c113f0b668737d2885de1384b7ca6e8ddaf160ef3e63cb02d8737ccadead80
description: MuleSoft Documentation Site
release: "2.0"
latest: true
---
---
product: Einstein AI Connector
version: 2.0
is-latest-version: true
---

# Configuring Tools Operations for Einstein AI Connector 2.0

> For the full documentation index, see: https://docs.mulesoft.com/llms.txt

Use the **Tools use AI service** operation to create autonomous agents that can use external tools
whenever a prompt can’t be answered directly by the AI model.

## Before You Begin

To use Tools operations, you must create a `tools.config.json` file that includes all the necessary
API information for the operation to execute APIs successfully, for example:

```json
[
  {
    "action": "Execute POST requests for API endpoints.",
    "url": "http://check-inventory-material.cloudhub.io/mmbe",
    "name": "Check Inventory",
    "method": "POST",
    "headers": "Basic XXX",
    "example-payload": "{\n \"materialNo\": \"paramValue\"}",
    "query": [
      "Check inventory in SAP",
      "Check Stock Overview",
      "Show product availability for MULETEST0",
      "Check the inventory for MULETEST0",
      "Check Stock for 400-110"
    ],
    "description": "Check inventory details for material in SAP by providing the materialNo as input for paramValue. Please use the materialNo and not materialNumber. This action applies whenever users' intent is 'Stock overview', 'product availability', 'Inventory', 'available stock'. Use the headers to perform the request."
  },
  {
    "action": "Execute GET requests for API endpoints.",
    "url": "https://anypoint.mulesoft.com/mocking/api/v1/sources/exchange/assets/612eb739-4266-4f4c-bf2f-29953c153d80/accounts-api/1.0.1/m/accounts",
    "name": "Show Accounts",
    "method": "GET",
    "headers": "",
    "example-payload": "{}",
    "query": ["Get all accounts", "Show all accounts from CRM"],
    "description": "Get all accounts from a CRM. This action applies whenever users' intent is 'CRM accounts', 'customers', 'customer accounts', 'accounts'."
  },
  {
    "action": "Execute GET requests for API endpoints.",
    "url": "https://anypoint.mulesoft.com/mocking/api/v1/sources/exchange/assets/7b99cead-a984-497b-9e6c-c16a3b4dcb76/employee-api/1.0.1/m/employees",
    "name": "Show Employees",
    "method": "GET",
    "headers": "",
    "example-payload": "{}",
    "query": [
      "Get all employee information",
      "Show employees for the country Switzerland",
      "How many employees do we have",
      "Show a list of all employees"
    ],
    "description": "Get all information about employees. This action applies whenever users' intent is 'employees', 'workforce'."
  }
]
```

Each object in the tools array represents a tool that the autonomous agent can use, so it is
important to describe each field as accurately as possible.

- `action`

  This field supports the following options:

  - `Execute GET` requests for API endpoints.

  - `Execute POST` requests for API endpoints.

- `url`

  The complete URL to the endpoint, including the resource path.

- `name`

  The name of the action in natural language.

- `method`

  The HTTP method for the endpoint. Only POST and GET are supported.

- `headers`

  The HTTP headers required for authorization to the endpoint. Only Basic Auth is supported.

- `example-payload`

  The example payload in JSON format.

- `query`

  Example queries a user might use to invoke this action.

- `description`

  A detailed description of how to use the tool. The description should be comprehensive enough for
  the LLM to understand its purpose and usage.

Ensure that the file path to the `tools.config.json` is accessible to the application at runtime.

## Configure the Tools Use AI Service Operation

To configure the **Tools use AI service** operation:

1.  Select the operation on the Anypoint Code Builder or Studio canvas.

2.  In the **General** properties tab for the operation, enter these values:

    - **Prompt**

      The prompt to send to the LLM.

    - **Input Stream**

### Output Configuration

This operation responds with a JSON payload that contains the main LLM response. Additionally,
attributes such as token usage and tool usage (boolean value) are included as part of the
attributes, but not within the main payload.

This is an example response of the JSON payload if the prompt is "What is the capital of
Switzerland?":

```json
{
  "response": "The capital of Switzerland is Bern."
}
```

If the prompt requires accessing external data through a tool, for example, "Show me the latest
account created in Salesforce", the AI model uses the configured tool to fetch the information,
resulting in:

```json
{
  "response": "The latest account created in Salesforce is:\n\n- **Name:** MuleTalks\n- **Id:** 0010600002JKf42AAD\n- **Created Date:** 2024-07-10T20:21:36.000Z\n\nIf you have any further questions or need additional assistance, feel free to ask!"
}
```

Along with the JSON payload, the operation returns attributes, which include information about token
and tool usage, for example:

```json
{
    "tokenUsage": { (1)
        "outputCount": 9,
        "totalCount": 18,
        "inputCount": 9
    },
    "additionalAttributes": { (2)
        "toolsUsed": "true"
    }
}
```

<table><tbody><tr><td><i data-value="1"></i><b>1</b></td><td>tokenUsage: Provides information on the token usage for the operation:<div><ul><li><p><code>outputCount</code></p><div><p>Number of tokens generated in the response</p></div></li><li><p><code>totalCount</code></p><div><p>Total number of tokens processed for the entire operation, including input and output</p></div></li><li><p><code>inputCount</code></p><div><p>Number of tokens processed from the input query or document</p></div></li></ul></div></td></tr><tr><td><i data-value="2"></i><b>2</b></td><td><code>additionalAttributes</code> includes the boolean value for <code>toolsUsed</code>:<div><ul><li><p><code>true</code></p><div><p>External tools, such as APIs or integrations, were used to gather or generate the response.</p></div></li><li><p><code>false</code></p><div><p>No external tools were used, and the response was based on internal knowledge only.</p></div></li></ul></div></td></tr></tbody></table>

## See Also

- [Using Anypoint Code Builder to Configure a Connector](https://docs.mulesoft.com/connectors/introduction/intro-config-use-acb)

- [Using Studio to Configure a Connector](https://docs.mulesoft.com/connectors/introduction/intro-config-use-studio)

- [Einstein AI Connector Overview](https://docs.mulesoft.com/einstein-ai-connector/latest/)

- [Einstein AI Connector Reference](https://docs.mulesoft.com/einstein-ai-connector/latest/einstein-ai-connector-reference)

- [Salesforce Help](https://help.salesforce.com)
