@a4hgehad/weave-mcp 0.9.6 → 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 +17 -8
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -513,11 +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) {
|
|
518
523
|
return agentConfig;
|
|
524
|
+
} else {
|
|
525
|
+
mcpsToApply = getAgentMcpDefaults(agentName);
|
|
519
526
|
}
|
|
520
|
-
if (
|
|
527
|
+
if (mcpsToApply.length === 0) {
|
|
521
528
|
return agentConfig;
|
|
522
529
|
}
|
|
523
530
|
const mcpTools = {
|
|
@@ -525,14 +532,16 @@ class ConfigHandler {
|
|
|
525
532
|
context7: "context7_query_docs",
|
|
526
533
|
grep_app: "grep_app_search"
|
|
527
534
|
};
|
|
528
|
-
const
|
|
529
|
-
for (const mcp of
|
|
535
|
+
const mcpToolEntries = {};
|
|
536
|
+
for (const mcp of mcpsToApply) {
|
|
530
537
|
const toolName = mcpTools[mcp];
|
|
531
538
|
if (toolName) {
|
|
532
|
-
|
|
539
|
+
mcpToolEntries[toolName] = true;
|
|
533
540
|
}
|
|
534
541
|
}
|
|
535
|
-
const
|
|
542
|
+
const existingTools = agentConfig.tools || {};
|
|
543
|
+
const mergedTools = { ...existingTools, ...mcpToolEntries };
|
|
544
|
+
const mcpInfo = this.buildMcpInfoSection(mcpsToApply);
|
|
536
545
|
let prompt = agentConfig.prompt || "";
|
|
537
546
|
if (!prompt.includes("<MCPs>")) {
|
|
538
547
|
prompt = prompt + `
|
|
@@ -541,7 +550,7 @@ class ConfigHandler {
|
|
|
541
550
|
}
|
|
542
551
|
return {
|
|
543
552
|
...agentConfig,
|
|
544
|
-
tools:
|
|
553
|
+
tools: mergedTools,
|
|
545
554
|
prompt
|
|
546
555
|
};
|
|
547
556
|
}
|