@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.
- package/CHANGELOG.md +7 -0
- package/dist/{chunk-62XKONGF.mjs → chunk-3UU33HF6.mjs} +2 -2
- package/dist/{chunk-XXKM3PJL.mjs → chunk-HBCCZQBE.mjs} +9 -7
- package/dist/{chunk-XXKM3PJL.mjs.map → chunk-HBCCZQBE.mjs.map} +1 -1
- package/dist/{chunk-YM7JEVJF.mjs → chunk-O4WMMGSX.mjs} +2 -2
- package/dist/{chunk-5TUGSSSM.mjs → chunk-QF6GPOZV.mjs} +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +8 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4 -4
- package/dist/lib/index.d.ts +1 -1
- package/dist/lib/index.js +8 -6
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/index.mjs +4 -4
- package/dist/lib/integrations/index.d.ts +2 -2
- package/dist/lib/integrations/index.js +1 -1
- package/dist/lib/integrations/index.js.map +1 -1
- package/dist/lib/integrations/index.mjs +4 -4
- package/dist/lib/integrations/nest/index.d.ts +1 -1
- package/dist/lib/integrations/nest/index.js +1 -1
- package/dist/lib/integrations/nest/index.js.map +1 -1
- package/dist/lib/integrations/nest/index.mjs +2 -2
- package/dist/lib/integrations/node-express/index.d.ts +1 -1
- package/dist/lib/integrations/node-express/index.js +1 -1
- package/dist/lib/integrations/node-express/index.js.map +1 -1
- package/dist/lib/integrations/node-express/index.mjs +2 -2
- package/dist/lib/integrations/node-http/index.d.ts +1 -1
- package/dist/lib/integrations/node-http/index.js +1 -1
- package/dist/lib/integrations/node-http/index.js.map +1 -1
- package/dist/lib/integrations/node-http/index.mjs +1 -1
- package/dist/{shared-e61e0ebb.d.ts → shared-32a46e93.d.ts} +3 -2
- package/package.json +2 -2
- package/src/lib/runtime/mcp-tools-utils.ts +16 -5
- /package/dist/{chunk-62XKONGF.mjs.map → chunk-3UU33HF6.mjs.map} +0 -0
- /package/dist/{chunk-YM7JEVJF.mjs.map → chunk-O4WMMGSX.mjs.map} +0 -0
- /package/dist/{chunk-5TUGSSSM.mjs.map → chunk-QF6GPOZV.mjs.map} +0 -0
|
@@ -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
|
|
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(
|
|
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.
|
|
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.
|
|
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
|
|
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(
|
|
43
|
+
export function extractParametersFromSchema(
|
|
44
|
+
toolOrSchema?: MCPTool | MCPTool["schema"],
|
|
45
|
+
): Parameter[] {
|
|
43
46
|
const parameters: Parameter[] = [];
|
|
44
|
-
|
|
45
|
-
|
|
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
|
|
94
|
+
const parameters = extractParametersFromSchema(tool);
|
|
84
95
|
|
|
85
96
|
const handler = async (params: any): Promise<any> => {
|
|
86
97
|
try {
|
|
File without changes
|
|
File without changes
|
|
File without changes
|