@elizaos/plugin-mcp 1.3.4 → 1.7.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/dist/actions/callToolAction.d.ts.map +1 -1
- package/dist/cjs/index.cjs +19 -13
- package/dist/cjs/index.js.map +10 -10
- package/dist/index.js +19 -13
- package/dist/index.js.map +10 -10
- package/dist/service.d.ts.map +1 -1
- package/dist/types.d.ts +1 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/processing.d.ts +1 -1
- package/dist/utils/processing.d.ts.map +1 -1
- package/dist/utils/validation.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -804,7 +804,9 @@ function buildMcpProviderData(servers) {
|
|
|
804
804
|
}
|
|
805
805
|
}
|
|
806
806
|
return {
|
|
807
|
-
values: { mcp: mcpData
|
|
807
|
+
values: { mcp: mcpData, mcpText: `# MCP Configuration
|
|
808
|
+
|
|
809
|
+
${textContent}` },
|
|
808
810
|
data: { mcp: mcpData },
|
|
809
811
|
text: `# MCP Configuration
|
|
810
812
|
|
|
@@ -927,6 +929,7 @@ async function handleToolResponse(runtime2, message, serverName, toolName, toolA
|
|
|
927
929
|
attachments: hasAttachments && attachments.length > 0 ? attachments : undefined
|
|
928
930
|
});
|
|
929
931
|
}
|
|
932
|
+
return replyMemory;
|
|
930
933
|
}
|
|
931
934
|
async function sendInitialResponse(callback) {
|
|
932
935
|
if (callback) {
|
|
@@ -1077,9 +1080,10 @@ ${JSON.stringify(parsedJson, null, 2)}`);
|
|
|
1077
1080
|
}
|
|
1078
1081
|
function getMaxRetries(runtime2) {
|
|
1079
1082
|
try {
|
|
1080
|
-
const
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
+
const rawSettings = runtime2.getSetting("mcp");
|
|
1084
|
+
const settings = rawSettings;
|
|
1085
|
+
if (settings && typeof settings.maxRetries === "number") {
|
|
1086
|
+
const configValue = settings.maxRetries;
|
|
1083
1087
|
if (!Number.isNaN(configValue) && configValue >= 0) {
|
|
1084
1088
|
logger3.debug(`[WITH-MODEL-RETRY] Using configured selection retries: ${configValue}`);
|
|
1085
1089
|
return configValue;
|
|
@@ -1496,15 +1500,16 @@ var callToolAction = {
|
|
|
1496
1500
|
${JSON.stringify(toolSelectionArgument, null, 2)}`);
|
|
1497
1501
|
const result = await mcpService.callTool(serverName, toolName, toolSelectionArgument.toolArguments);
|
|
1498
1502
|
const { toolOutput, hasAttachments, attachments } = processToolResult(result, serverName, toolName, runtime2, message.entityId);
|
|
1499
|
-
await handleToolResponse(runtime2, message, serverName, toolName, toolSelectionArgument.toolArguments, toolOutput, hasAttachments, attachments, composedState, mcpProvider, callback);
|
|
1503
|
+
const replyMemory = await handleToolResponse(runtime2, message, serverName, toolName, toolSelectionArgument.toolArguments, toolOutput, hasAttachments, attachments, composedState, mcpProvider, callback);
|
|
1500
1504
|
return {
|
|
1501
|
-
text: `Successfully called tool: ${serverName}/${toolName}`,
|
|
1505
|
+
text: `Successfully called tool: ${serverName}/${toolName}. Reasoned response: ${replyMemory.content.text}`,
|
|
1502
1506
|
values: {
|
|
1503
1507
|
success: true,
|
|
1504
1508
|
toolExecuted: true,
|
|
1505
1509
|
serverName,
|
|
1506
1510
|
toolName,
|
|
1507
|
-
hasAttachments
|
|
1511
|
+
hasAttachments,
|
|
1512
|
+
output: toolOutput
|
|
1508
1513
|
},
|
|
1509
1514
|
data: {
|
|
1510
1515
|
actionName: "CALL_MCP_TOOL",
|
|
@@ -1785,7 +1790,7 @@ class McpService extends Service {
|
|
|
1785
1790
|
connections = new Map;
|
|
1786
1791
|
connectionStates = new Map;
|
|
1787
1792
|
mcpProvider = {
|
|
1788
|
-
values: { mcp: {} },
|
|
1793
|
+
values: { mcp: {}, mcpText: "" },
|
|
1789
1794
|
data: { mcp: {} },
|
|
1790
1795
|
text: ""
|
|
1791
1796
|
};
|
|
@@ -1867,16 +1872,17 @@ class McpService extends Service {
|
|
|
1867
1872
|
}
|
|
1868
1873
|
}
|
|
1869
1874
|
getMcpSettings() {
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1875
|
+
const rawSettings = this.runtime.getSetting("mcp");
|
|
1876
|
+
let settings = rawSettings;
|
|
1877
|
+
logger7.info(`[McpService] getSetting("mcp") result: type=${typeof rawSettings} isNull=${rawSettings === null} hasServers=${!!settings?.servers}`);
|
|
1878
|
+
if (!settings || !settings.servers) {
|
|
1873
1879
|
const characterSettings = this.runtime.character?.settings;
|
|
1874
1880
|
if (characterSettings?.mcp) {
|
|
1875
1881
|
logger7.info("[McpService] Found MCP settings in character.settings.mcp (fallback)");
|
|
1876
1882
|
settings = characterSettings.mcp;
|
|
1877
1883
|
}
|
|
1878
1884
|
}
|
|
1879
|
-
if (!settings ||
|
|
1885
|
+
if (!settings || !settings.servers) {
|
|
1880
1886
|
const runtimeSettings = this.runtime.settings;
|
|
1881
1887
|
if (runtimeSettings?.mcp) {
|
|
1882
1888
|
logger7.info("[McpService] Found MCP settings in runtime.settings.mcp (fallback)");
|
|
@@ -2293,4 +2299,4 @@ export {
|
|
|
2293
2299
|
BACKOFF_MULTIPLIER
|
|
2294
2300
|
};
|
|
2295
2301
|
|
|
2296
|
-
//# debugId=
|
|
2302
|
+
//# debugId=73694D75D6553EC464756E2164756E21
|