@copilotkit/runtime 0.0.0-suhas-interface-change-20250423234940 → 0.0.0-suhas-interface-change-20250424035200

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/CHANGELOG.md CHANGED
@@ -1,12 +1,12 @@
1
1
  # @copilotkit/runtime
2
2
 
3
- ## 0.0.0-suhas-interface-change-20250423234940
3
+ ## 0.0.0-suhas-interface-change-20250424035200
4
4
 
5
5
  ### Patch Changes
6
6
 
7
7
  - 42559af: - refactor: rename mcpEndpoints to mcpServers for naming consistency
8
8
  - doc changes
9
- - @copilotkit/shared@0.0.0-suhas-interface-change-20250423234940
9
+ - @copilotkit/shared@0.0.0-suhas-interface-change-20250424035200
10
10
 
11
11
  ## 1.8.7
12
12
 
@@ -2,7 +2,7 @@ import {
2
2
  copilotRuntimeNodeHttpEndpoint,
3
3
  getRuntimeInstanceTelemetryInfo,
4
4
  telemetry_client_default
5
- } from "./chunk-OLYHRN2L.mjs";
5
+ } from "./chunk-RC6U6XYT.mjs";
6
6
  import {
7
7
  __name
8
8
  } from "./chunk-FHD4JECV.mjs";
@@ -22,4 +22,4 @@ __name(copilotRuntimeNodeExpressEndpoint, "copilotRuntimeNodeExpressEndpoint");
22
22
  export {
23
23
  copilotRuntimeNodeExpressEndpoint
24
24
  };
25
- //# sourceMappingURL=chunk-3YAUSR7B.mjs.map
25
+ //# sourceMappingURL=chunk-5HVHO7RU.mjs.map
@@ -2,7 +2,7 @@ import {
2
2
  copilotRuntimeNodeHttpEndpoint,
3
3
  getRuntimeInstanceTelemetryInfo,
4
4
  telemetry_client_default
5
- } from "./chunk-OLYHRN2L.mjs";
5
+ } from "./chunk-RC6U6XYT.mjs";
6
6
  import {
7
7
  __name
8
8
  } from "./chunk-FHD4JECV.mjs";
@@ -22,4 +22,4 @@ __name(copilotRuntimeNestEndpoint, "copilotRuntimeNestEndpoint");
22
22
  export {
23
23
  copilotRuntimeNestEndpoint
24
24
  };
25
- //# sourceMappingURL=chunk-BFZGAMCC.mjs.map
25
+ //# sourceMappingURL=chunk-6PTNRPRY.mjs.map
@@ -3063,7 +3063,11 @@ var CopilotRuntime = class {
3063
3063
  if (!mcpActionsForRequest || mcpActionsForRequest.length === 0) {
3064
3064
  return messages;
3065
3065
  }
3066
- const mcpToolInstructions = mcpActionsForRequest.map((action) => {
3066
+ const uniqueMcpTools = /* @__PURE__ */ new Map();
3067
+ mcpActionsForRequest.forEach((action) => {
3068
+ uniqueMcpTools.set(action.name, action);
3069
+ });
3070
+ const mcpToolInstructions = Array.from(uniqueMcpTools.values()).map((action) => {
3067
3071
  const paramsString = action.parameters && action.parameters.length > 0 ? ` Parameters: ${action.parameters.map((p) => `${p.name}${p.required ? "*" : ""}(${p.type})`).join(", ")}` : "";
3068
3072
  return `- ${action.name}:${paramsString} ${action.description || ""}`;
3069
3073
  }).join("\n");
@@ -3646,7 +3650,7 @@ please use an LLM adapter instead.`
3646
3650
  }
3647
3651
  }
3648
3652
  async getServerSideActions(request) {
3649
- var _a;
3653
+ var _a, _b;
3650
3654
  const { graphqlContext, messages: rawMessages, agentStates, url } = request;
3651
3655
  const inputMessages = convertGqlInputToMessages(rawMessages);
3652
3656
  const langserveFunctions = [];
@@ -3677,10 +3681,16 @@ please use an LLM adapter instead.`
3677
3681
  const requestSpecificMCPActions = [];
3678
3682
  if (this.createMCPClientImpl) {
3679
3683
  const baseEndpoints = this.mcpServersConfig || [];
3680
- const requestEndpoints = ((_a = graphqlContext.properties) == null ? void 0 : _a.mcpServers) || [];
3684
+ const requestEndpoints = ((_a = graphqlContext.properties) == null ? void 0 : _a.mcpServers) || ((_b = graphqlContext.properties) == null ? void 0 : _b.mcpEndpoints) || [];
3681
3685
  const effectiveEndpointsMap = /* @__PURE__ */ new Map();
3682
3686
  [
3683
- ...baseEndpoints,
3687
+ ...baseEndpoints
3688
+ ].forEach((ep) => {
3689
+ if (ep && ep.endpoint) {
3690
+ effectiveEndpointsMap.set(ep.endpoint, ep);
3691
+ }
3692
+ });
3693
+ [
3684
3694
  ...requestEndpoints
3685
3695
  ].forEach((ep) => {
3686
3696
  if (ep && ep.endpoint) {
@@ -3694,12 +3704,10 @@ please use an LLM adapter instead.`
3694
3704
  if (!actionsForEndpoint) {
3695
3705
  let client = null;
3696
3706
  try {
3697
- console.log(`MCP: Cache miss. Fetching tools for endpoint: ${endpointUrl}`);
3698
3707
  client = await this.createMCPClientImpl(config);
3699
3708
  const tools = await client.tools();
3700
3709
  actionsForEndpoint = convertMCPToolsToActions(tools, endpointUrl);
3701
3710
  this.mcpActionCache.set(endpointUrl, actionsForEndpoint);
3702
- console.log(`MCP: Fetched and cached ${actionsForEndpoint.length} tools for ${endpointUrl}`);
3703
3711
  } catch (error) {
3704
3712
  console.error(`MCP: Failed to fetch tools from endpoint ${endpointUrl}. Skipping. Error:`, error);
3705
3713
  actionsForEndpoint = [];
@@ -4987,4 +4995,4 @@ export {
4987
4995
  getCommonConfig,
4988
4996
  copilotRuntimeNodeHttpEndpoint
4989
4997
  };
4990
- //# sourceMappingURL=chunk-OLYHRN2L.mjs.map
4998
+ //# sourceMappingURL=chunk-RC6U6XYT.mjs.map