@copilotkit/runtime 1.8.8-next.0 → 1.8.8-next.1

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.
Files changed (36) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/{chunk-62XKONGF.mjs → chunk-3UU33HF6.mjs} +2 -2
  3. package/dist/{chunk-XXKM3PJL.mjs → chunk-HBCCZQBE.mjs} +9 -7
  4. package/dist/{chunk-XXKM3PJL.mjs.map → chunk-HBCCZQBE.mjs.map} +1 -1
  5. package/dist/{chunk-YM7JEVJF.mjs → chunk-O4WMMGSX.mjs} +2 -2
  6. package/dist/{chunk-5TUGSSSM.mjs → chunk-QF6GPOZV.mjs} +2 -2
  7. package/dist/index.d.ts +1 -1
  8. package/dist/index.js +8 -6
  9. package/dist/index.js.map +1 -1
  10. package/dist/index.mjs +4 -4
  11. package/dist/lib/index.d.ts +1 -1
  12. package/dist/lib/index.js +8 -6
  13. package/dist/lib/index.js.map +1 -1
  14. package/dist/lib/index.mjs +4 -4
  15. package/dist/lib/integrations/index.d.ts +2 -2
  16. package/dist/lib/integrations/index.js +1 -1
  17. package/dist/lib/integrations/index.js.map +1 -1
  18. package/dist/lib/integrations/index.mjs +4 -4
  19. package/dist/lib/integrations/nest/index.d.ts +1 -1
  20. package/dist/lib/integrations/nest/index.js +1 -1
  21. package/dist/lib/integrations/nest/index.js.map +1 -1
  22. package/dist/lib/integrations/nest/index.mjs +2 -2
  23. package/dist/lib/integrations/node-express/index.d.ts +1 -1
  24. package/dist/lib/integrations/node-express/index.js +1 -1
  25. package/dist/lib/integrations/node-express/index.js.map +1 -1
  26. package/dist/lib/integrations/node-express/index.mjs +2 -2
  27. package/dist/lib/integrations/node-http/index.d.ts +1 -1
  28. package/dist/lib/integrations/node-http/index.js +1 -1
  29. package/dist/lib/integrations/node-http/index.js.map +1 -1
  30. package/dist/lib/integrations/node-http/index.mjs +1 -1
  31. package/dist/{shared-e61e0ebb.d.ts → shared-32a46e93.d.ts} +3 -2
  32. package/package.json +2 -2
  33. package/src/lib/runtime/mcp-tools-utils.ts +16 -5
  34. /package/dist/{chunk-62XKONGF.mjs.map → chunk-3UU33HF6.mjs.map} +0 -0
  35. /package/dist/{chunk-YM7JEVJF.mjs.map → chunk-O4WMMGSX.mjs.map} +0 -0
  36. /package/dist/{chunk-5TUGSSSM.mjs.map → chunk-QF6GPOZV.mjs.map} +0 -0
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  copilotRuntimeNodeHttpEndpoint
3
- } from "../../../chunk-XXKM3PJL.mjs";
3
+ } from "../../../chunk-HBCCZQBE.mjs";
4
4
  import "../../../chunk-EY6RUVB7.mjs";
5
5
  import "../../../chunk-5BIEM2UU.mjs";
6
6
  import "../../../chunk-SHBDMA63.mjs";
@@ -137,6 +137,7 @@ interface MCPTool {
137
137
  parameters?: {
138
138
  properties?: Record<string, any>;
139
139
  required?: string[];
140
+ jsonSchema?: Record<string, any>;
140
141
  };
141
142
  };
142
143
  /** The function to call to execute the tool on the MCP server. */
@@ -162,10 +163,10 @@ interface MCPEndpointConfig {
162
163
  }
163
164
  /**
164
165
  * Extracts CopilotKit-compatible parameters from an MCP tool schema.
165
- * @param toolSchema The schema object from an MCPTool.
166
+ * @param toolOrSchema The schema object from an MCPTool or the full MCPTool object.
166
167
  * @returns An array of Parameter objects.
167
168
  */
168
- declare function extractParametersFromSchema(toolSchema?: MCPTool["schema"]): Parameter[];
169
+ declare function extractParametersFromSchema(toolOrSchema?: MCPTool | MCPTool["schema"]): Parameter[];
169
170
  /**
170
171
  * Converts a map of MCPTools into an array of CopilotKit Actions.
171
172
  * @param mcpTools A record mapping tool names to MCPTool objects.
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "publishConfig": {
10
10
  "access": "public"
11
11
  },
12
- "version": "1.8.8-next.0",
12
+ "version": "1.8.8-next.1",
13
13
  "sideEffects": false,
14
14
  "main": "./dist/index.js",
15
15
  "module": "./dist/index.mjs",
@@ -63,7 +63,7 @@
63
63
  "rxjs": "^7.8.1",
64
64
  "type-graphql": "2.0.0-rc.1",
65
65
  "zod": "^3.23.3",
66
- "@copilotkit/shared": "1.8.8-next.0"
66
+ "@copilotkit/shared": "1.8.8-next.1"
67
67
  },
68
68
  "keywords": [
69
69
  "copilotkit",
@@ -10,6 +10,7 @@ export interface MCPTool {
10
10
  parameters?: {
11
11
  properties?: Record<string, any>;
12
12
  required?: string[];
13
+ jsonSchema?: Record<string, any>;
13
14
  };
14
15
  };
15
16
  /** The function to call to execute the tool on the MCP server. */
@@ -36,13 +37,23 @@ export interface MCPEndpointConfig {
36
37
 
37
38
  /**
38
39
  * Extracts CopilotKit-compatible parameters from an MCP tool schema.
39
- * @param toolSchema The schema object from an MCPTool.
40
+ * @param toolOrSchema The schema object from an MCPTool or the full MCPTool object.
40
41
  * @returns An array of Parameter objects.
41
42
  */
42
- export function extractParametersFromSchema(toolSchema?: MCPTool["schema"]): Parameter[] {
43
+ export function extractParametersFromSchema(
44
+ toolOrSchema?: MCPTool | MCPTool["schema"],
45
+ ): Parameter[] {
43
46
  const parameters: Parameter[] = [];
44
- const properties = toolSchema?.parameters?.properties;
45
- const requiredParams = new Set(toolSchema?.parameters?.required || []);
47
+
48
+ // Handle either full tool object or just schema
49
+ const schema =
50
+ "schema" in (toolOrSchema || {})
51
+ ? (toolOrSchema as MCPTool).schema
52
+ : (toolOrSchema as MCPTool["schema"]);
53
+
54
+ const toolParameters = schema?.parameters || schema?.parameters?.jsonSchema;
55
+ const properties = toolParameters?.properties;
56
+ const requiredParams = new Set(toolParameters?.required || []);
46
57
 
47
58
  if (!properties) {
48
59
  return parameters;
@@ -80,7 +91,7 @@ export function convertMCPToolsToActions(
80
91
  const actions: Action<any>[] = [];
81
92
 
82
93
  for (const [toolName, tool] of Object.entries(mcpTools)) {
83
- const parameters = extractParametersFromSchema(tool.schema);
94
+ const parameters = extractParametersFromSchema(tool);
84
95
 
85
96
  const handler = async (params: any): Promise<any> => {
86
97
  try {