opencode-toolbox 0.3.1 → 0.4.0
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 +1 -1
- package/dist/index.js +12 -13
- package/package.json +1 -1
package/README.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -32817,7 +32817,7 @@ var SettingsConfigSchema = exports_external2.object({
|
|
|
32817
32817
|
defaultLimit: exports_external2.number().min(1).max(20).default(5)
|
|
32818
32818
|
});
|
|
32819
32819
|
var ConfigSchema = exports_external2.object({
|
|
32820
|
-
|
|
32820
|
+
mcp: exports_external2.record(exports_external2.string(), ServerConfigSchema),
|
|
32821
32821
|
settings: SettingsConfigSchema.optional()
|
|
32822
32822
|
});
|
|
32823
32823
|
// node_modules/jsonc-parser/lib/esm/impl/scanner.js
|
|
@@ -37952,10 +37952,8 @@ var SYSTEM_PROMPT_BASE = `# Extended Toolbox
|
|
|
37952
37952
|
|
|
37953
37953
|
You have access to an extended toolbox with additional capabilities (web search, time utilities, code search, etc.).
|
|
37954
37954
|
|
|
37955
|
-
##
|
|
37956
|
-
|
|
37957
|
-
2. ALWAYS toolbox_search_* if you think that user wants you to use some tools
|
|
37958
|
-
3. ALWAYS toolbox_search_* if you think that user may refer specific tool name which is not exist in the context
|
|
37955
|
+
## Rule
|
|
37956
|
+
ALWAYS search before saying "I cannot do that" or "I don't have access to."
|
|
37959
37957
|
|
|
37960
37958
|
## Workflow
|
|
37961
37959
|
1. Search: toolbox_search_bm25({ text: "what you need" }) or toolbox_search_regex({ pattern: "prefix_.*" })
|
|
@@ -37965,21 +37963,22 @@ function generateSystemPrompt(mcpManager) {
|
|
|
37965
37963
|
if (servers.length === 0) {
|
|
37966
37964
|
return SYSTEM_PROMPT_BASE;
|
|
37967
37965
|
}
|
|
37968
|
-
const
|
|
37966
|
+
const toolboxSchema = {};
|
|
37969
37967
|
for (const server of servers) {
|
|
37970
37968
|
if (server.status === "connected" && server.tools.length > 0) {
|
|
37971
|
-
|
|
37972
|
-
serverLines.push(`- ${server.name}: ${toolNames}`);
|
|
37969
|
+
toolboxSchema[server.name] = server.tools.map((t) => t.idString);
|
|
37973
37970
|
}
|
|
37974
37971
|
}
|
|
37975
|
-
if (
|
|
37972
|
+
if (Object.keys(toolboxSchema).length === 0) {
|
|
37976
37973
|
return SYSTEM_PROMPT_BASE;
|
|
37977
37974
|
}
|
|
37978
37975
|
return `${SYSTEM_PROMPT_BASE}
|
|
37979
37976
|
|
|
37980
|
-
##
|
|
37981
|
-
|
|
37982
|
-
|
|
37977
|
+
## Toolbox Schema
|
|
37978
|
+
Tool names use \`<server>_<tool>\` format. Pass exact names to toolbox_execute().
|
|
37979
|
+
\`\`\`json
|
|
37980
|
+
${JSON.stringify(toolboxSchema, null, 2)}
|
|
37981
|
+
\`\`\``;
|
|
37983
37982
|
}
|
|
37984
37983
|
var ToolboxPlugin = async (ctx) => {
|
|
37985
37984
|
const configPath = process.env.OPENCODE_TOOLBOX_CONFIG || DEFAULT_CONFIG_PATH;
|
|
@@ -37996,7 +37995,7 @@ var ToolboxPlugin = async (ctx) => {
|
|
|
37996
37995
|
if (initialized)
|
|
37997
37996
|
return;
|
|
37998
37997
|
try {
|
|
37999
|
-
await mcpManager.initialize(config3.
|
|
37998
|
+
await mcpManager.initialize(config3.mcp);
|
|
38000
37999
|
const allTools = mcpManager.getAllCatalogTools();
|
|
38001
38000
|
bm25Index.indexTools(allTools);
|
|
38002
38001
|
initialized = true;
|
package/package.json
CHANGED