@agentforge/tools 0.9.1 → 0.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +192 -9
- package/dist/index.cjs +2588 -1498
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4572 -991
- package/dist/index.d.ts +4572 -991
- package/dist/index.js +2413 -1496
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @agentforge/tools
|
|
2
2
|
|
|
3
|
-
> Production-ready tools collection for AgentForge -
|
|
3
|
+
> Production-ready tools collection for AgentForge - 81 tools for web, data, file, utility, and agent operations
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/@agentforge/tools)
|
|
6
6
|
[](https://www.typescriptlang.org/)
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
## 🎉 Status: Production Ready & Published
|
|
10
10
|
|
|
11
|
-
**
|
|
11
|
+
**81 production-ready tools** | **Full TypeScript support** | **Comprehensive documentation** | **LangChain compatible**
|
|
12
12
|
|
|
13
13
|
## 📦 Installation
|
|
14
14
|
|
|
@@ -22,9 +22,9 @@ yarn add @agentforge/tools
|
|
|
22
22
|
|
|
23
23
|
## 🎯 Overview
|
|
24
24
|
|
|
25
|
-
This package provides **
|
|
25
|
+
This package provides **81 ready-to-use tools** organized into 5 categories:
|
|
26
26
|
|
|
27
|
-
- **🌐 Web Tools** (
|
|
27
|
+
- **🌐 Web Tools** (22 tools) - HTTP requests, web search, web scraping, HTML parsing, URL manipulation, Slack integration, Confluence integration
|
|
28
28
|
- **📊 Data Tools** (18 tools) - JSON, CSV, XML processing and data transformation
|
|
29
29
|
- **📁 File Tools** (18 tools) - File operations, directory management, path utilities
|
|
30
30
|
- **🔧 Utility Tools** (22 tools) - Date/time, strings, math, validation
|
|
@@ -69,9 +69,9 @@ const result = await calculator.execute({
|
|
|
69
69
|
|
|
70
70
|
## 📚 Tool Categories
|
|
71
71
|
|
|
72
|
-
### 🌐 Web Tools (
|
|
72
|
+
### 🌐 Web Tools (22 tools)
|
|
73
73
|
|
|
74
|
-
Tools for web interactions
|
|
74
|
+
Tools for web interactions, HTTP operations, and integrations.
|
|
75
75
|
|
|
76
76
|
#### Web Search
|
|
77
77
|
- **`webSearch`** - Search the web using DuckDuckGo (free) or Serper API (optional premium)
|
|
@@ -103,6 +103,16 @@ Tools for web interactions and HTTP operations.
|
|
|
103
103
|
- **`getSlackMessages`** - Read message history from channels
|
|
104
104
|
- **`createSlackTools()`** - Factory function for custom Slack configuration
|
|
105
105
|
|
|
106
|
+
#### Confluence Tools
|
|
107
|
+
- **`searchConfluence`** - Search Confluence using CQL (Confluence Query Language)
|
|
108
|
+
- **`getConfluencePage`** - Get full page content by ID
|
|
109
|
+
- **`listConfluenceSpaces`** - List all available Confluence spaces
|
|
110
|
+
- **`getSpacePages`** - Get all pages from a specific space
|
|
111
|
+
- **`createConfluencePage`** - Create new Confluence pages
|
|
112
|
+
- **`updateConfluencePage`** - Update existing Confluence pages
|
|
113
|
+
- **`archiveConfluencePage`** - Archive pages (move to trash)
|
|
114
|
+
- **`createConfluenceTools()`** - Factory function for custom Confluence configuration
|
|
115
|
+
|
|
106
116
|
### 📊 Data Tools (18 tools)
|
|
107
117
|
|
|
108
118
|
Tools for data processing and transformation.
|
|
@@ -359,6 +369,99 @@ SLACK_BOT_TOKEN=xoxb-your-bot-token
|
|
|
359
369
|
4. Install app to workspace
|
|
360
370
|
5. Copy the token (starts with `xoxb-` for bot or `xoxp-` for user)
|
|
361
371
|
|
|
372
|
+
### Confluence Integration Example
|
|
373
|
+
|
|
374
|
+
```typescript
|
|
375
|
+
import {
|
|
376
|
+
searchConfluence,
|
|
377
|
+
getConfluencePage,
|
|
378
|
+
listConfluenceSpaces,
|
|
379
|
+
getSpacePages,
|
|
380
|
+
createConfluencePage,
|
|
381
|
+
updateConfluencePage,
|
|
382
|
+
archiveConfluencePage,
|
|
383
|
+
createConfluenceTools
|
|
384
|
+
} from '@agentforge/tools';
|
|
385
|
+
|
|
386
|
+
// Search for pages
|
|
387
|
+
const searchResults = await searchConfluence.execute({
|
|
388
|
+
cql: 'type=page AND space=DOCS',
|
|
389
|
+
limit: 10
|
|
390
|
+
});
|
|
391
|
+
console.log(`Found ${searchResults.results.length} pages`);
|
|
392
|
+
|
|
393
|
+
// Get a specific page
|
|
394
|
+
const page = await getConfluencePage.execute({
|
|
395
|
+
page_id: '123456'
|
|
396
|
+
});
|
|
397
|
+
console.log(`Page title: ${page.page.title}`);
|
|
398
|
+
console.log(`Content: ${page.page.content}`);
|
|
399
|
+
|
|
400
|
+
// List all spaces
|
|
401
|
+
const spaces = await listConfluenceSpaces.execute({
|
|
402
|
+
limit: 50
|
|
403
|
+
});
|
|
404
|
+
console.log(`Found ${spaces.spaces.length} spaces`);
|
|
405
|
+
|
|
406
|
+
// Get pages from a space
|
|
407
|
+
const spacePages = await getSpacePages.execute({
|
|
408
|
+
space_key: 'DOCS',
|
|
409
|
+
limit: 25
|
|
410
|
+
});
|
|
411
|
+
console.log(`Found ${spacePages.pages.length} pages in DOCS space`);
|
|
412
|
+
|
|
413
|
+
// Create a new page
|
|
414
|
+
const newPage = await createConfluencePage.execute({
|
|
415
|
+
space_key: 'DOCS',
|
|
416
|
+
title: 'My New Page',
|
|
417
|
+
content: '<p>This is the page content in HTML format</p>',
|
|
418
|
+
parent_page_id: '789012' // Optional parent page
|
|
419
|
+
});
|
|
420
|
+
console.log(`Created page with ID: ${newPage.page.id}`);
|
|
421
|
+
|
|
422
|
+
// Update an existing page
|
|
423
|
+
const updated = await updateConfluencePage.execute({
|
|
424
|
+
page_id: newPage.page.id,
|
|
425
|
+
title: 'Updated Page Title',
|
|
426
|
+
content: '<p>Updated content</p>'
|
|
427
|
+
});
|
|
428
|
+
console.log(`Updated to version ${updated.page.version}`);
|
|
429
|
+
|
|
430
|
+
// Archive a page
|
|
431
|
+
const archived = await archiveConfluencePage.execute({
|
|
432
|
+
page_id: newPage.page.id,
|
|
433
|
+
reason: 'No longer needed'
|
|
434
|
+
});
|
|
435
|
+
console.log(archived.archived.note);
|
|
436
|
+
|
|
437
|
+
// Custom configuration (for multiple Confluence instances)
|
|
438
|
+
const customTools = createConfluenceTools({
|
|
439
|
+
apiKey: 'your-api-key',
|
|
440
|
+
email: 'your-email@example.com',
|
|
441
|
+
siteUrl: 'https://your-domain.atlassian.net'
|
|
442
|
+
});
|
|
443
|
+
|
|
444
|
+
await customTools.searchConfluence.execute({
|
|
445
|
+
cql: 'type=page',
|
|
446
|
+
limit: 5
|
|
447
|
+
});
|
|
448
|
+
```
|
|
449
|
+
|
|
450
|
+
**Environment Setup:**
|
|
451
|
+
```bash
|
|
452
|
+
# Add to your .env file
|
|
453
|
+
ATLASSIAN_API_KEY=your-api-key-here
|
|
454
|
+
ATLASSIAN_EMAIL=your-email@example.com
|
|
455
|
+
ATLASSIAN_SITE_URL=https://your-domain.atlassian.net
|
|
456
|
+
```
|
|
457
|
+
|
|
458
|
+
**Getting a Confluence API Key:**
|
|
459
|
+
1. Go to [Atlassian Account Settings](https://id.atlassian.com/manage-profile/security/api-tokens)
|
|
460
|
+
2. Click "Create API token"
|
|
461
|
+
3. Give it a label (e.g., "AgentForge")
|
|
462
|
+
4. Copy the generated token
|
|
463
|
+
5. Use your Atlassian email and the API token for authentication
|
|
464
|
+
|
|
362
465
|
### Data Processing Example
|
|
363
466
|
|
|
364
467
|
```typescript
|
|
@@ -573,6 +676,86 @@ const result = await httpGet.execute({
|
|
|
573
676
|
console.log(result.data);
|
|
574
677
|
```
|
|
575
678
|
|
|
679
|
+
## 🏗️ Code Organization
|
|
680
|
+
|
|
681
|
+
All tools follow a consistent directory structure pattern for better maintainability and discoverability:
|
|
682
|
+
|
|
683
|
+
### Directory Structure
|
|
684
|
+
|
|
685
|
+
Each tool category is organized into its own directory with the following structure:
|
|
686
|
+
|
|
687
|
+
```
|
|
688
|
+
tool-category/
|
|
689
|
+
├── index.ts # Main exports, factory functions, default instances
|
|
690
|
+
├── types.ts # TypeScript interfaces, Zod schemas, configuration types
|
|
691
|
+
├── auth.ts # Authentication helpers (for API tools)
|
|
692
|
+
└── tools/ # Individual tool implementations
|
|
693
|
+
├── tool-1.ts
|
|
694
|
+
├── tool-2.ts
|
|
695
|
+
└── tool-3.ts
|
|
696
|
+
```
|
|
697
|
+
|
|
698
|
+
### Example: Slack Tools
|
|
699
|
+
|
|
700
|
+
```
|
|
701
|
+
slack/
|
|
702
|
+
├── index.ts # Exports: sendSlackMessage, notifySlack, getSlackChannels, getSlackMessages, createSlackTools()
|
|
703
|
+
├── types.ts # SlackConfig, SlackMessageSchema, SlackChannelSchema, etc.
|
|
704
|
+
├── auth.ts # getSlackToken(), validateSlackConfig()
|
|
705
|
+
└── tools/
|
|
706
|
+
├── send-message.ts
|
|
707
|
+
├── notify.ts
|
|
708
|
+
├── get-channels.ts
|
|
709
|
+
└── get-messages.ts
|
|
710
|
+
```
|
|
711
|
+
|
|
712
|
+
### Benefits
|
|
713
|
+
|
|
714
|
+
- **Modularity**: Each tool is in its own file, making it easy to find and modify
|
|
715
|
+
- **Consistency**: All tool categories follow the same pattern
|
|
716
|
+
- **Maintainability**: Changes to one tool don't affect others
|
|
717
|
+
- **Discoverability**: Clear structure makes it easy to understand what's available
|
|
718
|
+
- **Type Safety**: Shared types in `types.ts` ensure consistency across tools
|
|
719
|
+
- **Testability**: Each tool can be tested independently
|
|
720
|
+
|
|
721
|
+
### Factory Functions
|
|
722
|
+
|
|
723
|
+
Each tool category provides a factory function for custom configuration:
|
|
724
|
+
|
|
725
|
+
```typescript
|
|
726
|
+
import { createSlackTools } from '@agentforge/tools';
|
|
727
|
+
|
|
728
|
+
// Custom configuration
|
|
729
|
+
const customTools = createSlackTools({
|
|
730
|
+
token: 'xoxb-your-custom-token',
|
|
731
|
+
botName: 'My Custom Bot',
|
|
732
|
+
botIcon: ':rocket:'
|
|
733
|
+
});
|
|
734
|
+
|
|
735
|
+
// Use custom tools
|
|
736
|
+
await customTools.sendMessage.execute({
|
|
737
|
+
channel: 'general',
|
|
738
|
+
message: 'Hello from custom bot!'
|
|
739
|
+
});
|
|
740
|
+
```
|
|
741
|
+
|
|
742
|
+
Available factory functions:
|
|
743
|
+
- `createSlackTools(config?)` - Slack integration tools
|
|
744
|
+
- `createConfluenceTools(config?)` - Confluence integration tools
|
|
745
|
+
- `createHttpTools(config?)` - HTTP client tools
|
|
746
|
+
- `createScraperTools(config?)` - Web scraping tools
|
|
747
|
+
- `createCsvTools(config?)` - CSV processing tools
|
|
748
|
+
- `createJsonTools(config?)` - JSON processing tools
|
|
749
|
+
- `createXmlTools(config?)` - XML processing tools
|
|
750
|
+
- `createTransformerTools(config?)` - Data transformation tools
|
|
751
|
+
- `createFileOperationTools(config?)` - File operation tools
|
|
752
|
+
- `createDirectoryOperationTools(config?)` - Directory operation tools
|
|
753
|
+
- `createPathUtilityTools(config?)` - Path utility tools
|
|
754
|
+
- `createDateTimeTools(config?)` - Date/time tools
|
|
755
|
+
- `createStringUtilityTools(config?)` - String utility tools
|
|
756
|
+
- `createMathOperationTools(config?)` - Math operation tools
|
|
757
|
+
- `createValidationTools(config?)` - Validation tools
|
|
758
|
+
|
|
576
759
|
## 🛠️ Development
|
|
577
760
|
|
|
578
761
|
```bash
|
|
@@ -594,13 +777,13 @@ pnpm lint
|
|
|
594
777
|
|
|
595
778
|
## 📊 Tool Statistics
|
|
596
779
|
|
|
597
|
-
- **Total Tools**:
|
|
598
|
-
- **Web Tools**:
|
|
780
|
+
- **Total Tools**: 81
|
|
781
|
+
- **Web Tools**: 22 (includes 4 Slack tools + 7 Confluence tools)
|
|
599
782
|
- **Data Tools**: 18
|
|
600
783
|
- **File Tools**: 18
|
|
601
784
|
- **Utility Tools**: 22
|
|
602
785
|
- **Agent Tools**: 1
|
|
603
|
-
- **Lines of Code**: ~
|
|
786
|
+
- **Lines of Code**: ~4,000
|
|
604
787
|
- **Full TypeScript Support**: ✅
|
|
605
788
|
- **Zod Validation**: ✅
|
|
606
789
|
- **LangChain Compatible**: ✅
|