Skip to contentSkip to navigationSkip to topbar
On this page

Tools Resource


Create and configure Tools that an AI Assistant can use.


Tool Properties

tool-properties page anchor
Property nameTypeRequiredDescriptionChild properties
account_sidSID<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

descriptionstringrequired

The description of the tool.


enabledbooleanrequired

True if the tool is enabled.


idstringrequired

The tool ID.

Pattern: ^aia_tool_*$

metaobjectrequired

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


namestringrequired

The name of the tool.


requires_authbooleanrequired

The authentication requirement for the tool.


typestringrequired

The type of the tool. ('WEBHOOK')


urlstringOptional

The url of the tool resource.


date_updatedstring<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.


POST https://assistants.twilio.com/v1/Tools

Request body parameters

request-body-parameters page anchor
Encoding type:application/json
Schema
Property nameTypeRequiredDescriptionChild properties
assistant_idstringOptional

The Assistant ID.

Pattern: ^aia_asst_*$

descriptionstringOptional

The description of the tool.


enabledbooleanrequired

True if the tool is enabled.


metaobjectOptional

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


namestringrequired

The name of the tool.


policyobjectOptional

The policy associated with the tool.


typestringrequired

The description of the tool.

Create a ToolLink to code sample: Create a Tool
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 createTool() {
11
const tool = await client.assistants.v1.tools.create({
12
name: "name",
13
type: "type",
14
enabled: false,
15
});
16
17
console.log(tool.accountSid);
18
}
19
20
createTool();

Output

1
{
2
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
3
"date_created": "2009-07-06T20:30:00Z",
4
"date_updated": "2009-07-06T20:30:00Z",
5
"description": "description",
6
"enabled": false,
7
"id": "aia_tool",
8
"meta": {},
9
"name": "name",
10
"requires_auth": false,
11
"type": "type",
12
"url": "url"
13
}

GET https://assistants.twilio.com/v1/Tools

Property nameTypeRequiredPIIDescription
AssistantIdstringOptional

PageintegerOptional

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

Minimum: 0

PageSizeintegerOptional

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

Minimum: 1Maximum: 1000

PageTokenstringOptional

The page token. This is provided by the API.

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 listTools() {
11
const tools = await client.assistants.v1.tools.list({ limit: 20 });
12
13
tools.forEach((t) => console.log(t.accountSid));
14
}
15
16
listTools();

Output

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": "url",
22
"date_created": "2009-07-06T20:30:00Z",
23
"date_updated": "2009-07-06T20:30:00Z"
24
}
25
]
26
}

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

Property nameTypeRequiredPIIDescription
idstringrequired

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 deleteTool() {
11
await client.assistants.v1.tools("id").remove();
12
}
13
14
deleteTool();

Need some help?

Terms of service

Copyright © 2024 Twilio Inc.