@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.
@@ -1 +1 @@
1
- {"version":3,"file":"callToolAction.d.ts","sourceRoot":"","sources":["../../src/actions/callToolAction.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,MAAM,EAOZ,MAAM,eAAe,CAAC;AAQvB,eAAO,MAAM,cAAc,EAAE,MAqK5B,CAAC"}
1
+ {"version":3,"file":"callToolAction.d.ts","sourceRoot":"","sources":["../../src/actions/callToolAction.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,MAAM,EAOZ,MAAM,eAAe,CAAC;AAQvB,eAAO,MAAM,cAAc,EAAE,MAsK5B,CAAC"}
@@ -843,7 +843,9 @@ function buildMcpProviderData(servers) {
843
843
  }
844
844
  }
845
845
  return {
846
- values: { mcp: mcpData },
846
+ values: { mcp: mcpData, mcpText: `# MCP Configuration
847
+
848
+ ${textContent}` },
847
849
  data: { mcp: mcpData },
848
850
  text: `# MCP Configuration
849
851
 
@@ -966,6 +968,7 @@ async function handleToolResponse(runtime2, message, serverName, toolName, toolA
966
968
  attachments: hasAttachments && attachments.length > 0 ? attachments : undefined
967
969
  });
968
970
  }
971
+ return replyMemory;
969
972
  }
970
973
  async function sendInitialResponse(callback) {
971
974
  if (callback) {
@@ -1109,9 +1112,10 @@ ${JSON.stringify(parsedJson, null, 2)}`);
1109
1112
  }
1110
1113
  function getMaxRetries(runtime2) {
1111
1114
  try {
1112
- const settings = runtime2.getSetting("mcp");
1113
- if (settings && "maxRetries" in settings && settings.maxRetries !== undefined) {
1114
- const configValue = Number(settings.maxRetries);
1115
+ const rawSettings = runtime2.getSetting("mcp");
1116
+ const settings = rawSettings;
1117
+ if (settings && typeof settings.maxRetries === "number") {
1118
+ const configValue = settings.maxRetries;
1115
1119
  if (!Number.isNaN(configValue) && configValue >= 0) {
1116
1120
  import_core4.logger.debug(`[WITH-MODEL-RETRY] Using configured selection retries: ${configValue}`);
1117
1121
  return configValue;
@@ -1528,15 +1532,16 @@ var callToolAction = {
1528
1532
  ${JSON.stringify(toolSelectionArgument, null, 2)}`);
1529
1533
  const result = await mcpService.callTool(serverName, toolName, toolSelectionArgument.toolArguments);
1530
1534
  const { toolOutput, hasAttachments, attachments } = processToolResult(result, serverName, toolName, runtime2, message.entityId);
1531
- await handleToolResponse(runtime2, message, serverName, toolName, toolSelectionArgument.toolArguments, toolOutput, hasAttachments, attachments, composedState, mcpProvider, callback);
1535
+ const replyMemory = await handleToolResponse(runtime2, message, serverName, toolName, toolSelectionArgument.toolArguments, toolOutput, hasAttachments, attachments, composedState, mcpProvider, callback);
1532
1536
  return {
1533
- text: `Successfully called tool: ${serverName}/${toolName}`,
1537
+ text: `Successfully called tool: ${serverName}/${toolName}. Reasoned response: ${replyMemory.content.text}`,
1534
1538
  values: {
1535
1539
  success: true,
1536
1540
  toolExecuted: true,
1537
1541
  serverName,
1538
1542
  toolName,
1539
- hasAttachments
1543
+ hasAttachments,
1544
+ output: toolOutput
1540
1545
  },
1541
1546
  data: {
1542
1547
  actionName: "CALL_MCP_TOOL",
@@ -1813,7 +1818,7 @@ class McpService extends import_core8.Service {
1813
1818
  connections = new Map;
1814
1819
  connectionStates = new Map;
1815
1820
  mcpProvider = {
1816
- values: { mcp: {} },
1821
+ values: { mcp: {}, mcpText: "" },
1817
1822
  data: { mcp: {} },
1818
1823
  text: ""
1819
1824
  };
@@ -1895,16 +1900,17 @@ class McpService extends import_core8.Service {
1895
1900
  }
1896
1901
  }
1897
1902
  getMcpSettings() {
1898
- let settings = this.runtime.getSetting("mcp");
1899
- import_core8.logger.info(`[McpService] getSetting("mcp") result: type=${typeof settings} isNull=${settings === null} hasServers=${!!settings?.servers}`);
1900
- if (!settings || typeof settings === "object" && !settings.servers) {
1903
+ const rawSettings = this.runtime.getSetting("mcp");
1904
+ let settings = rawSettings;
1905
+ import_core8.logger.info(`[McpService] getSetting("mcp") result: type=${typeof rawSettings} isNull=${rawSettings === null} hasServers=${!!settings?.servers}`);
1906
+ if (!settings || !settings.servers) {
1901
1907
  const characterSettings = this.runtime.character?.settings;
1902
1908
  if (characterSettings?.mcp) {
1903
1909
  import_core8.logger.info("[McpService] Found MCP settings in character.settings.mcp (fallback)");
1904
1910
  settings = characterSettings.mcp;
1905
1911
  }
1906
1912
  }
1907
- if (!settings || typeof settings === "object" && !settings.servers) {
1913
+ if (!settings || !settings.servers) {
1908
1914
  const runtimeSettings = this.runtime.settings;
1909
1915
  if (runtimeSettings?.mcp) {
1910
1916
  import_core8.logger.info("[McpService] Found MCP settings in runtime.settings.mcp (fallback)");
@@ -2303,4 +2309,4 @@ var mcpPlugin = {
2303
2309
  };
2304
2310
  var src_default = mcpPlugin;
2305
2311
 
2306
- //# debugId=FA18EC8DEF85C3D964756E2164756E21
2312
+ //# debugId=362D3DF72359421664756E2164756E21