@@ -26,6 +26,61 @@ pnpm add @stackone/ai
2626bun add @stackone/ai
2727```
2828
29+ ## Usage
30+
31+ ``` typescript
32+ import { StackOneToolSet } from " @stackone/ai" ;
33+
34+ const toolset = new StackOneToolSet ({
35+ baseUrl: " https://api.stackone.com" ,
36+ accountId: " your-account-id" ,
37+ });
38+
39+ const tools = await toolset .fetchTools ();
40+ const employeeTool = tools .getTool (" bamboohr_list_employees" );
41+ const employees = await employeeTool .execute ();
42+ ```
43+
44+ [ View full example] ( examples/index.ts )
45+
46+ ### Authentication
47+
48+ Set the ` STACKONE_API_KEY ` environment variable:
49+
50+ ``` bash
51+ export STACKONE_API_KEY=< your-api-key>
52+ ```
53+
54+ or load from a .env file using your preferred environment variable library.
55+
56+ ### Account IDs
57+
58+ StackOne uses account IDs to identify different integrations. You can specify the account ID at different levels:
59+
60+ ``` typescript
61+ import { StackOneToolSet } from " @stackone/ai" ;
62+
63+ // Single account - simplest approach
64+ const toolset = new StackOneToolSet ({ accountId: " your-bamboohr-account" });
65+ const tools = await toolset .fetchTools ();
66+
67+ // Multiple accounts - returns tools from both integrations
68+ const multiAccountToolset = new StackOneToolSet ();
69+ const allTools = await multiAccountToolset .fetchTools ({
70+ accountIds: [" bamboohr-account-123" , " workday-account-456" ],
71+ });
72+
73+ // Filter to specific integration when using multiple accounts
74+ const bamboohrOnly = await multiAccountToolset .fetchTools ({
75+ accountIds: [" bamboohr-account-123" , " workday-account-456" ],
76+ actions: [" bamboohr_*" ], // Only BambooHR tools
77+ });
78+
79+ // Set directly on a tool instance
80+ tools .setAccountId (" direct-account-id" );
81+ const currentAccountId = tools .getAccountId (); // Get the current account ID
82+ ```
83+
2984## Integrations
3085
3186The StackOneToolSet makes it super easy to use StackOne APIs as tools in your AI applications.
@@ -168,61 +223,6 @@ await generateText({
168223
169224</details >
170225
171- ## Usage
172-
173- ``` typescript
174- import { StackOneToolSet } from " @stackone/ai" ;
175-
176- const toolset = new StackOneToolSet ({
177- baseUrl: " https://api.stackone.com" ,
178- accountId: " your-account-id" ,
179- });
180-
181- const tools = await toolset .fetchTools ();
182- const employeeTool = tools .getTool (" bamboohr_list_employees" );
183- const employees = await employeeTool .execute ();
184- ```
185-
186- [ View full example] ( examples/index.ts )
187-
188- ### Authentication
189-
190- Set the ` STACKONE_API_KEY ` environment variable:
191-
192- ``` bash
193- export STACKONE_API_KEY=< your-api-key>
194- ```
195-
196- or load from a .env file using your preferred environment variable library.
197-
198- ### Account IDs
199-
200- StackOne uses account IDs to identify different integrations. You can specify the account ID at different levels:
201-
202- ``` typescript
203- import { StackOneToolSet } from " @stackone/ai" ;
204-
205- // Single account - simplest approach
206- const toolset = new StackOneToolSet ({ accountId: " your-bamboohr-account" });
207- const tools = await toolset .fetchTools ();
208-
209- // Multiple accounts - returns tools from both integrations
210- const multiAccountToolset = new StackOneToolSet ();
211- const allTools = await multiAccountToolset .fetchTools ({
212- accountIds: [" bamboohr-account-123" , " workday-account-456" ],
213- });
214-
215- // Filter to specific integration when using multiple accounts
216- const bamboohrOnly = await multiAccountToolset .fetchTools ({
217- accountIds: [" bamboohr-account-123" , " workday-account-456" ],
218- actions: [" bamboohr_*" ], // Only BambooHR tools
219- });
220-
221- // Set directly on a tool instance
222- tools .setAccountId (" direct-account-id" );
223- const currentAccountId = tools .getAccountId (); // Get the current account ID
224- ```
225-
226226## Features
227227
228228### Filtering Tools with fetchTools()
0 commit comments