opencode-toolbox 0.3.0 → 0.3.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 +20 -48
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -7,17 +7,11 @@ An OpenCode plugin that implements a **tool search tool** pattern, allowing user
|
|
|
7
7
|
OpenCode's MCP servers add tool schemas to LLM context at session start. With many MCPs, this can front-load tens of thousands of tokens, reducing "smart zone" capacity and degrading speed/accuracy.
|
|
8
8
|
|
|
9
9
|
opencode-toolbox solves this by:
|
|
10
|
-
- Exposing a
|
|
10
|
+
- Exposing **a few toolbox tools** instead of 50+ MCP tools
|
|
11
11
|
- Search for tools using natural language (BM25) or regex patterns
|
|
12
12
|
- Execute discovered tools through the same interface
|
|
13
13
|
- Tool schemas are returned in search results for accurate LLM usage
|
|
14
14
|
|
|
15
|
-
## Installation
|
|
16
|
-
|
|
17
|
-
```bash
|
|
18
|
-
bun add opencode-toolbox
|
|
19
|
-
```
|
|
20
|
-
|
|
21
15
|
## Configuration
|
|
22
16
|
|
|
23
17
|
### 1. Add Plugin to OpenCode
|
|
@@ -69,38 +63,27 @@ Create `~/.config/opencode/toolbox.jsonc`:
|
|
|
69
63
|
|
|
70
64
|
## Usage
|
|
71
65
|
|
|
72
|
-
The plugin exposes
|
|
66
|
+
The plugin exposes three tools:
|
|
73
67
|
|
|
74
|
-
###
|
|
68
|
+
### toolbox_search_bm25
|
|
75
69
|
|
|
76
|
-
|
|
70
|
+
Search for tools using natural language:
|
|
77
71
|
|
|
78
|
-
```
|
|
79
|
-
{
|
|
80
|
-
"tool": "toolbox",
|
|
81
|
-
"arguments": {
|
|
82
|
-
"action": "search",
|
|
83
|
-
"query": "get current time in timezone"
|
|
84
|
-
}
|
|
85
|
-
}
|
|
72
|
+
```
|
|
73
|
+
toolbox_search_bm25({ text: "get current time in timezone" })
|
|
86
74
|
```
|
|
87
75
|
|
|
88
|
-
|
|
76
|
+
### toolbox_search_regex
|
|
89
77
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
"action": "search",
|
|
95
|
-
"pattern": "^time_.*",
|
|
96
|
-
"limit": 5
|
|
97
|
-
}
|
|
98
|
-
}
|
|
78
|
+
Search for tools using regex patterns on tool names:
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
toolbox_search_regex({ pattern: "time_.*", limit: 5 })
|
|
99
82
|
```
|
|
100
83
|
|
|
101
84
|
### Search Results
|
|
102
85
|
|
|
103
|
-
|
|
86
|
+
Both search tools return tool schemas so the LLM knows exact parameters:
|
|
104
87
|
|
|
105
88
|
```json
|
|
106
89
|
{
|
|
@@ -122,23 +105,16 @@ Returns tool schemas so the LLM knows exact parameters:
|
|
|
122
105
|
}
|
|
123
106
|
}
|
|
124
107
|
],
|
|
125
|
-
"usage": "Use
|
|
108
|
+
"usage": "Use toolbox_execute({ name: '<tool_name>', arguments: '<json>' }) to run a discovered tool"
|
|
126
109
|
}
|
|
127
110
|
```
|
|
128
111
|
|
|
129
|
-
###
|
|
112
|
+
### toolbox_execute
|
|
130
113
|
|
|
131
|
-
|
|
114
|
+
Execute a discovered tool with JSON-encoded arguments:
|
|
132
115
|
|
|
133
|
-
```
|
|
134
|
-
{
|
|
135
|
-
"tool": "toolbox",
|
|
136
|
-
"arguments": {
|
|
137
|
-
"action": "execute",
|
|
138
|
-
"toolName": "time_get_current_time",
|
|
139
|
-
"toolArgs": "{\"timezone\": \"Asia/Tokyo\"}"
|
|
140
|
-
}
|
|
141
|
-
}
|
|
116
|
+
```
|
|
117
|
+
toolbox_execute({ name: "time_get_current_time", arguments: '{"timezone": "Asia/Tokyo"}' })
|
|
142
118
|
```
|
|
143
119
|
|
|
144
120
|
## Example Flow
|
|
@@ -147,16 +123,12 @@ Call discovered tools with JSON-encoded arguments:
|
|
|
147
123
|
User: "What time is it in Tokyo?"
|
|
148
124
|
|
|
149
125
|
LLM: I need to find a time-related tool.
|
|
150
|
-
|
|
126
|
+
toolbox_search_bm25({ text: "current time timezone" })
|
|
151
127
|
|
|
152
128
|
Toolbox: Returns time_get_current_time with its schema
|
|
153
129
|
|
|
154
130
|
LLM: Now I know the parameters. Let me call it.
|
|
155
|
-
|
|
156
|
-
action: "execute",
|
|
157
|
-
toolName: "time_get_current_time",
|
|
158
|
-
toolArgs: '{"timezone":"Asia/Tokyo"}'
|
|
159
|
-
})
|
|
131
|
+
toolbox_execute({ name: "time_get_current_time", arguments: '{"timezone":"Asia/Tokyo"}' })
|
|
160
132
|
|
|
161
133
|
Toolbox: { "datetime": "2026-01-07T02:15:00+09:00", "timezone": "Asia/Tokyo" }
|
|
162
134
|
|
|
@@ -217,7 +189,7 @@ bun run build
|
|
|
217
189
|
### Execute fails
|
|
218
190
|
|
|
219
191
|
1. Verify the tool name format: `serverName_toolName`
|
|
220
|
-
2. Check `
|
|
192
|
+
2. Check `arguments` is valid JSON
|
|
221
193
|
3. Ensure underlying MCP server is running
|
|
222
194
|
|
|
223
195
|
## License
|
package/package.json
CHANGED