Skip to contentSkip to navigationSkip to topbar
On this page

Assistant Tools Resource


Manage Tools connected to an Assistant


Tool Properties

tool-properties page anchor
Property nameTypeRequiredDescriptionChild properties
accountSidSID<AC>

Optional

Not PII

The SID of the Account that created the Tool resource.

Pattern: ^AC[0-9a-fA-F]{32}$Min length: 34Max length: 34

descriptionstring
required

The description of the tool.


enabledboolean
required

True if the tool is enabled.


idstring
required

The tool ID.

Pattern: ^aia_tool_*$

metaobject
required

The metadata related to method, url, input_schema to used with the Tool.


namestring
required

The name of the tool.


requiresAuthboolean
required

The authentication requirement for the tool.


typestring
required

The type of the tool. ('WEBHOOK')


urlstring

Optional

The url of the tool resource.


dateUpdatedstring<date-time>
required

The date and time in GMT when the Tool was last updated specified in ISO 8601(link takes you to an external page) format.


List all Tools connected to an Assistant

list-all-tools-connected-to-an-assistant page anchor

GET https://assistants.twilio.com/v1/Assistants/{assistantId}/Tools

Path parameters

path-parameters page anchor
Property nameTypeRequiredPIIDescription
assistantIdstring
required

The assistant ID.

Property nameTypeRequiredPIIDescription
pageinteger

Optional

The page index. This value is simply for client state.

Minimum: 0

pageSizeinteger

Optional

How many resources to return in each list page. The default is 50, and the maximum is 1000.

Minimum: 1Maximum: 1000

pageTokenstring

Optional

The page token. This is provided by the API.

List all Tools connected to an AssistantLink to code sample: List all Tools connected to an Assistant
1
// Download the helper library from https://www.twilio.com/docs/node/install
2
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
3
4
// Find your Account SID and Auth Token at twilio.com/console
5
// and set the environment variables. See http://twil.io/secure
6
const accountSid = process.env.TWILIO_ACCOUNT_SID;
7
const authToken = process.env.TWILIO_AUTH_TOKEN;
8
const client = twilio(accountSid, authToken);
9
10
async function listToolsByAssistant() {
11
const assistantsTools = await client.assistants.v1
12
.assistants("aia_asst_00000000-1111-2222-3333-444444444444")
13
.assistantsTools.list({ limit: 20 });
14
15
assistantsTools.forEach((a) => console.log(a.accountSid));
16
}
17
18
listToolsByAssistant();

Response

1
{
2
"meta": {
3
"first_page_url": "https://www.example.com",
4
"key": "key",
5
"next_page_url": "https://www.example.com",
6
"page": 42,
7
"page_size": 42,
8
"previous_page_url": "https://www.example.com",
9
"url": "https://www.example.com"
10
},
11
"tools": [
12
{
13
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
14
"description": "description",
15
"enabled": false,
16
"id": "aia_tool",
17
"meta": {},
18
"name": "name",
19
"requires_auth": false,
20
"type": "type",
21
"url": "https://www.example.com",
22
"date_created": "2009-07-06T20:30:00Z",
23
"date_updated": "2009-07-06T20:30:00Z"
24
}
25
]
26
}

Connect a Tool to an Assistant

connect-a-tool-to-an-assistant page anchor

POST https://assistants.twilio.com/v1/Assistants/{assistantId}/Tools/{id}

Once you've created a tool using the /v1/Tools endpoint, you must connect it to an Assistant to allow your Assistant to call the tool.

Property nameTypeRequiredPIIDescription
assistantIdstring
required

The assistant ID.


idstring
required

The tool ID.

1
// Download the helper library from https://www.twilio.com/docs/node/install
2
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
3
4
// Find your Account SID and Auth Token at twilio.com/console
5
// and set the environment variables. See http://twil.io/secure
6
const accountSid = process.env.TWILIO_ACCOUNT_SID;
7
const authToken = process.env.TWILIO_AUTH_TOKEN;
8
const client = twilio(accountSid, authToken);
9
10
async function createAssistantToolAttachment() {
11
const assistantsTool = await client.assistants.v1
12
.assistants("aia_asst_00000000-1111-2222-3333-444444444444")
13
.assistantsTools("aia_tool")
14
.create();
15
16
console.log(assistantsTool.sid);
17
}
18
19
createAssistantToolAttachment();

Detach a Tool from an Assistant

detach-a-tool-from-an-assistant page anchor

DELETE https://assistants.twilio.com/v1/Assistants/{assistantId}/Tools/{id}

This endpoint removes a Tool from your Assistant's configuration, so it can no longer be called by that Assistant.

Property nameTypeRequiredPIIDescription
assistantIdstring
required

The assistant ID.


idstring
required

The tool ID.

1
// Download the helper library from https://www.twilio.com/docs/node/install
2
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
3
4
// Find your Account SID and Auth Token at twilio.com/console
5
// and set the environment variables. See http://twil.io/secure
6
const accountSid = process.env.TWILIO_ACCOUNT_SID;
7
const authToken = process.env.TWILIO_AUTH_TOKEN;
8
const client = twilio(accountSid, authToken);
9
10
async function deleteAssistantToolAttachment() {
11
await client.assistants.v1
12
.assistants("aia_asst_00000000-1111-2222-3333-444444444444")
13
.assistantsTools("aia_tool")
14
.remove();
15
}
16
17
deleteAssistantToolAttachment();