@easynet/agent-tool 1.0.92 → 1.0.94
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 +35 -28
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,55 +1,62 @@
|
|
|
1
1
|
# @easynet/agent-tool
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
## Introduction
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
`@easynet/agent-tool` loads tool definitions from `tool.yaml`, creates LangChain-compatible tools, and registers them into the default `AgentContext`.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
import { createAgentTools } from "@easynet/agent-tool";
|
|
7
|
+
## API Reference
|
|
9
8
|
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
| API | What it does | Minimal usage |
|
|
10
|
+
| --- | --- | --- |
|
|
11
|
+
| `createAgentTools` | Load tools and register them into `AgentContext`. | `const tools = createAgentTools({ configFilePath: "./tool.yaml" })` |
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
const tools = createAgentTools({ configFilePath: "./tool.yaml" });
|
|
15
|
-
console.log(tools.map((t) => t.name));
|
|
16
|
-
```
|
|
13
|
+
## Usage
|
|
17
14
|
|
|
18
|
-
|
|
15
|
+
Create `tool.yaml`:
|
|
19
16
|
|
|
20
17
|
```yaml
|
|
21
18
|
tools:
|
|
22
|
-
# FS 工具沙箱根目录(相对路径按当前项目解析)
|
|
23
19
|
sandboxedPath: .
|
|
24
|
-
|
|
25
|
-
# HTTP 允许列表。先给空数组,表示默认禁用外网请求(更安全)
|
|
26
20
|
allowedHosts: []
|
|
27
21
|
blockedHosts: []
|
|
28
|
-
|
|
29
|
-
# 最小起步:直接加载内置工具包(全部工具)
|
|
30
22
|
list:
|
|
31
23
|
- npm:@easynet/agent-tool-buildin
|
|
32
24
|
```
|
|
33
25
|
|
|
34
|
-
|
|
26
|
+
Load tools:
|
|
35
27
|
|
|
36
28
|
```ts
|
|
37
29
|
import { createAgentTools } from "@easynet/agent-tool";
|
|
38
30
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
console.log("loaded tools:", tools.map((t) => t.name));
|
|
43
|
-
}
|
|
31
|
+
const tools = createAgentTools({
|
|
32
|
+
configFilePath: "./tool.yaml",
|
|
33
|
+
});
|
|
44
34
|
|
|
45
|
-
|
|
35
|
+
console.log(tools.map((tool) => tool.name));
|
|
46
36
|
```
|
|
47
37
|
|
|
48
|
-
|
|
38
|
+
### YAML config
|
|
39
|
+
|
|
40
|
+
Example `tool.yaml`:
|
|
49
41
|
|
|
50
|
-
|
|
51
|
-
|
|
42
|
+
```yaml
|
|
43
|
+
apiVersion: easynet.world/v1
|
|
44
|
+
kind: ToolConfig
|
|
45
|
+
metadata:
|
|
46
|
+
name: agent-tool-default
|
|
47
|
+
spec:
|
|
48
|
+
tools:
|
|
49
|
+
sandboxedPath: .
|
|
50
|
+
allowedHosts: []
|
|
51
|
+
blockedHosts: []
|
|
52
|
+
list:
|
|
53
|
+
- npm:@easynet/agent-tool-buildin
|
|
54
|
+
```
|
|
52
55
|
|
|
53
|
-
|
|
56
|
+
Explanation:
|
|
54
57
|
|
|
55
|
-
-
|
|
58
|
+
- `spec.tools.sandboxedPath`: root directory allowed for filesystem tools.
|
|
59
|
+
- `spec.tools.allowedHosts`: allowlist for outbound HTTP tools.
|
|
60
|
+
- `spec.tools.blockedHosts`: denylist for outbound HTTP tools.
|
|
61
|
+
- `spec.tools.list`: tool packages or tool descriptors to load.
|
|
62
|
+
- `npm:@easynet/agent-tool-buildin`: load the built-in tool extension package.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@easynet/agent-tool",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.94",
|
|
4
4
|
"description": "MCP build: init → build → run. Turn your project (@tool, SKILL, n8n) into a standalone MCP npm server (no framework embedding, no package conflict).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|