@a4hgehad/weave-mcp 0.9.7 → 0.9.8
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/dist/index.js +22 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -513,8 +513,18 @@ class ConfigHandler {
|
|
|
513
513
|
return result;
|
|
514
514
|
}
|
|
515
515
|
applyAgentMcpDefaults(agentName, agentConfig) {
|
|
516
|
-
const
|
|
517
|
-
|
|
516
|
+
const weaveConfig = agentConfig;
|
|
517
|
+
const userMcps = weaveConfig.mcps ?? weaveConfig.mcp;
|
|
518
|
+
const hasUserTools = agentConfig.tools !== undefined;
|
|
519
|
+
let mcpsToApply;
|
|
520
|
+
if (userMcps && userMcps.length > 0) {
|
|
521
|
+
mcpsToApply = userMcps;
|
|
522
|
+
} else if (hasUserTools) {
|
|
523
|
+
return agentConfig;
|
|
524
|
+
} else {
|
|
525
|
+
mcpsToApply = getAgentMcpDefaults(agentName);
|
|
526
|
+
}
|
|
527
|
+
if (mcpsToApply.length === 0) {
|
|
518
528
|
return agentConfig;
|
|
519
529
|
}
|
|
520
530
|
const mcpTools = {
|
|
@@ -522,7 +532,16 @@ class ConfigHandler {
|
|
|
522
532
|
context7: "context7_query_docs",
|
|
523
533
|
grep_app: "grep_app_search"
|
|
524
534
|
};
|
|
525
|
-
const
|
|
535
|
+
const mcpToolEntries = {};
|
|
536
|
+
for (const mcp of mcpsToApply) {
|
|
537
|
+
const toolName = mcpTools[mcp];
|
|
538
|
+
if (toolName) {
|
|
539
|
+
mcpToolEntries[toolName] = true;
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
const existingTools = agentConfig.tools || {};
|
|
543
|
+
const mergedTools = { ...existingTools, ...mcpToolEntries };
|
|
544
|
+
const mcpInfo = this.buildMcpInfoSection(mcpsToApply);
|
|
526
545
|
let prompt = agentConfig.prompt || "";
|
|
527
546
|
if (!prompt.includes("<MCPs>")) {
|
|
528
547
|
prompt = prompt + `
|