Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | /** * # Installation * * ```bash * # Using npm * npm install @stackone/ai * * # Using yarn * yarn add @stackone/ai * * # Using pnpm * pnpm add @stackone/ai * ``` * * # Authentication * * Set the `STACKONE_API_KEY` environment variable: * * ```bash * export STACKONE_API_KEY=<your-api-key> * ``` * * or load from a .env file: */ /** * # Account IDs * * StackOne uses account IDs to identify different integrations. * Replace the placeholder below with your actual account ID from the StackOne dashboard. */ import process from 'node:process'; // Replace with your actual account ID from StackOne dashboard const accountId = 'your-hris-account-id'; /** * # Quickstart */ import assert from 'node:assert'; import { StackOneToolSet } from '@stackone/ai'; const apiKey = process.env.STACKONE_API_KEY; if (!apiKey) { console.error('STACKONE_API_KEY environment variable is required'); process.exit(1); } const quickstart = async (): Promise<void> => { const toolset = new StackOneToolSet({ accountId, baseUrl: process.env.STACKONE_BASE_URL ?? 'https://api.stackone.com', }); // Fetch HRIS-related tools via MCP const tools = await toolset.fetchTools({ actions: ['hris_*'], }); // Verify we have tools assert(tools.length > 0, 'Expected to find HRIS tools'); // Use a specific tool const employeeTool = tools.getTool('hris_list_employees'); assert(employeeTool !== undefined, 'Expected to find hris_list_employees tool'); // Execute the tool and verify the response const result = await employeeTool.execute(); assert(Array.isArray(result.data), 'Expected employees to be an array'); assert(result.data.length > 0, 'Expected to find at least one employee'); }; // Run the example await quickstart(); /** * # Next Steps * * Check out some more examples: * * - [OpenAI Integration](openai-integration.md) * - [AI SDK Integration](ai-sdk-integration.md) * - [Fetch Tools](fetch-tools.md) * - [Meta Tools](meta-tools.md) */ |