@mondaydotcomorg/atp-mcp-adapter 0.19.7 → 0.19.8
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/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/mcp-connector.d.ts.map +1 -1
- package/dist/mcp-connector.js +3 -6
- package/dist/mcp-connector.js.map +1 -1
- package/dist/schema-utils.d.ts +21 -0
- package/dist/schema-utils.d.ts.map +1 -0
- package/dist/schema-utils.js +36 -0
- package/dist/schema-utils.js.map +1 -0
- package/package.json +3 -3
- package/src/index.ts +2 -0
- package/src/mcp-connector.ts +3 -17
- package/src/schema-utils.ts +71 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export { MCPConnector } from './mcp-connector.js';
|
|
2
2
|
export { MCPHttpConnector } from './http-connector.js';
|
|
3
3
|
export { registerATPTools, registerToolsWithMCP } from './atp-to-mcp.js';
|
|
4
|
+
export { convertMCPInputSchema, convertMCPToolToFunction } from './schema-utils.js';
|
|
4
5
|
export type { MCPTool, MCPPrompt } from './types.js';
|
|
5
6
|
export type { MCPToolResult, MCPServerLike } from './atp-to-mcp.js';
|
|
7
|
+
export type { MCPToolSchema, MCPToolDefinition } from './schema-utils.js';
|
|
6
8
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACzE,YAAY,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACrD,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACzE,OAAO,EAAE,qBAAqB,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AACpF,YAAY,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACrD,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACpE,YAAY,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { MCPConnector } from './mcp-connector.js';
|
|
2
2
|
export { MCPHttpConnector } from './http-connector.js';
|
|
3
3
|
export { registerATPTools, registerToolsWithMCP } from './atp-to-mcp.js';
|
|
4
|
+
export { convertMCPInputSchema, convertMCPToolToFunction } from './schema-utils.js';
|
|
4
5
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACzE,OAAO,EAAE,qBAAqB,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-connector.d.ts","sourceRoot":"","sources":["../src/mcp-connector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAEnE,OAAO,KAAK,EAAE,cAAc,EAAqB,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"mcp-connector.d.ts","sourceRoot":"","sources":["../src/mcp-connector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAEnE,OAAO,KAAK,EAAE,cAAc,EAAqB,MAAM,+BAA+B,CAAC;AAGvF,UAAU,eAAe;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC7B;AAED;;GAEG;AACH,qBAAa,YAAY;IACxB,OAAO,CAAC,OAAO,CAAkC;IACjD,OAAO,CAAC,aAAa,CAAuB;IAC5C,OAAO,CAAC,iBAAiB,CAAuB;IAEhD;;;;OAIG;IACG,kBAAkB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC;IAmD1E;;;;OAIG;IACG,wBAAwB,CAAC,OAAO,EAAE,eAAe,EAAE,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;IAIrF;;OAEG;IACG,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;IAUpC;;;;OAIG;IACH,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAI3C;;;OAGG;IACG,SAAS,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;IAQjC;;;OAGG;IACG,WAAW,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;IAYnC;;;;;OAKG;IACG,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC;CAU9E"}
|
package/dist/mcp-connector.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
|
|
2
2
|
import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js';
|
|
3
|
+
import { convertMCPInputSchema } from './schema-utils.js';
|
|
3
4
|
/**
|
|
4
5
|
* MCPConnector connects to MCP servers and converts their tools to Agent Tool Protocol format.
|
|
5
6
|
*/
|
|
@@ -31,15 +32,11 @@ export class MCPConnector {
|
|
|
31
32
|
const toolsResult = await client.listTools();
|
|
32
33
|
const tools = toolsResult.tools || [];
|
|
33
34
|
const functions = tools.map((tool) => {
|
|
34
|
-
const
|
|
35
|
-
const inputSchema = schema || { type: 'object', properties: {} };
|
|
36
|
-
if (!inputSchema.type) {
|
|
37
|
-
inputSchema.type = 'object';
|
|
38
|
-
}
|
|
35
|
+
const inputSchema = convertMCPInputSchema(tool.inputSchema);
|
|
39
36
|
return {
|
|
40
37
|
name: tool.name,
|
|
41
38
|
description: tool.description || `MCP tool: ${tool.name}`,
|
|
42
|
-
inputSchema
|
|
39
|
+
inputSchema,
|
|
43
40
|
handler: async (input) => {
|
|
44
41
|
const result = await client.callTool({
|
|
45
42
|
name: tool.name,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-connector.js","sourceRoot":"","sources":["../src/mcp-connector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CA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,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,SAAS;QACd,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC;YACzB,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;QACpD,CAAC;QACD,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,SAAS,EAAE,CAAC;QACzD,OAAO,WAAW,CAAC,KAAK,IAAI,EAAE,CAAC;IAChC,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,WAAW;QAChB,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC;YACzB,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;QACpD,CAAC;QACD,IAAI,CAAC;YACJ,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,WAAW,EAAE,CAAC;YAC7D,OAAO,aAAa,CAAC,OAAO,IAAI,EAAE,CAAC;QACpC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,OAAO,EAAE,CAAC;QACX,CAAC;IACF,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,QAAQ,CAAC,IAAY,EAAE,KAA8B;QAC1D,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC;YACzB,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;QACpD,CAAC;QACD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC;YAChD,IAAI;YACJ,SAAS,EAAE,KAAK;SAChB,CAAC,CAAC;QACH,OAAO,MAAM,CAAC,OAAO,CAAC;IACvB,CAAC;CACD"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { CustomFunctionDef } from '@mondaydotcomorg/atp-protocol';
|
|
2
|
+
export interface MCPToolSchema {
|
|
3
|
+
type?: string;
|
|
4
|
+
properties?: Record<string, unknown>;
|
|
5
|
+
required?: string[];
|
|
6
|
+
description?: string;
|
|
7
|
+
[key: string]: unknown;
|
|
8
|
+
}
|
|
9
|
+
export interface MCPToolDefinition {
|
|
10
|
+
name: string;
|
|
11
|
+
description?: string;
|
|
12
|
+
inputSchema?: MCPToolSchema;
|
|
13
|
+
}
|
|
14
|
+
export declare function convertMCPInputSchema(inputSchema: unknown): {
|
|
15
|
+
type: string;
|
|
16
|
+
properties?: Record<string, unknown>;
|
|
17
|
+
required?: string[];
|
|
18
|
+
[key: string]: unknown;
|
|
19
|
+
};
|
|
20
|
+
export declare function convertMCPToolToFunction(tool: MCPToolDefinition, handler: (input: unknown) => Promise<unknown>): CustomFunctionDef;
|
|
21
|
+
//# sourceMappingURL=schema-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-utils.d.ts","sourceRoot":"","sources":["../src/schema-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAEvE,MAAM,WAAW,aAAa;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACvB;AAED,MAAM,WAAW,iBAAiB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,aAAa,CAAC;CAC5B;AAED,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,OAAO,GAAG;IAC5D,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACvB,CAqCA;AAED,wBAAgB,wBAAwB,CACvC,IAAI,EAAE,iBAAiB,EACvB,OAAO,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC,OAAO,CAAC,GAC3C,iBAAiB,CAOnB"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export function convertMCPInputSchema(inputSchema) {
|
|
2
|
+
const schema = inputSchema;
|
|
3
|
+
if (!schema) {
|
|
4
|
+
return { type: 'object', properties: {} };
|
|
5
|
+
}
|
|
6
|
+
const result = {};
|
|
7
|
+
result.type = schema.type || 'object';
|
|
8
|
+
if (result.type === 'object') {
|
|
9
|
+
result.properties = schema.properties || {};
|
|
10
|
+
}
|
|
11
|
+
else if (schema.properties) {
|
|
12
|
+
result.properties = schema.properties;
|
|
13
|
+
}
|
|
14
|
+
if (schema.required && schema.required.length > 0) {
|
|
15
|
+
result.required = schema.required;
|
|
16
|
+
}
|
|
17
|
+
if (schema.description) {
|
|
18
|
+
result.description = schema.description;
|
|
19
|
+
}
|
|
20
|
+
const knownFields = new Set(['type', 'properties', 'required', 'description']);
|
|
21
|
+
for (const [key, value] of Object.entries(schema)) {
|
|
22
|
+
if (!knownFields.has(key) && value !== undefined) {
|
|
23
|
+
result[key] = value;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return result;
|
|
27
|
+
}
|
|
28
|
+
export function convertMCPToolToFunction(tool, handler) {
|
|
29
|
+
return {
|
|
30
|
+
name: tool.name,
|
|
31
|
+
description: tool.description || `MCP tool: ${tool.name}`,
|
|
32
|
+
inputSchema: convertMCPInputSchema(tool.inputSchema),
|
|
33
|
+
handler,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=schema-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-utils.js","sourceRoot":"","sources":["../src/schema-utils.ts"],"names":[],"mappings":"AAgBA,MAAM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AAwB,CACvC,IAAuB,EACvB,OAA6C;IAE7C,OAAO;QACN,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,WAAW,EAAE,IAAI,CAAC,WAAW,IAAI,aAAa,IAAI,CAAC,IAAI,EAAE;QACzD,WAAW,EAAE,qBAAqB,CAAC,IAAI,CAAC,WAAW,CAAC;QACpD,OAAO;KACP,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mondaydotcomorg/atp-mcp-adapter",
|
|
3
|
-
"version": "0.19.
|
|
3
|
+
"version": "0.19.8",
|
|
4
4
|
"description": "MCP compatibility adapter for Agent Tool Protocol",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -41,8 +41,8 @@
|
|
|
41
41
|
],
|
|
42
42
|
"license": "MIT",
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@mondaydotcomorg/atp-protocol": "0.19.
|
|
45
|
-
"@mondaydotcomorg/atp-server": "0.19.
|
|
44
|
+
"@mondaydotcomorg/atp-protocol": "0.19.7",
|
|
45
|
+
"@mondaydotcomorg/atp-server": "0.19.8"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
48
|
"@modelcontextprotocol/sdk": ">=0.5.0",
|
package/src/index.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export { MCPConnector } from './mcp-connector.js';
|
|
2
2
|
export { MCPHttpConnector } from './http-connector.js';
|
|
3
3
|
export { registerATPTools, registerToolsWithMCP } from './atp-to-mcp.js';
|
|
4
|
+
export { convertMCPInputSchema, convertMCPToolToFunction } from './schema-utils.js';
|
|
4
5
|
export type { MCPTool, MCPPrompt } from './types.js';
|
|
5
6
|
export type { MCPToolResult, MCPServerLike } from './atp-to-mcp.js';
|
|
7
|
+
export type { MCPToolSchema, MCPToolDefinition } from './schema-utils.js';
|
package/src/mcp-connector.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
|
|
2
2
|
import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js';
|
|
3
3
|
import type { APIGroupConfig, CustomFunctionDef } from '@mondaydotcomorg/atp-protocol';
|
|
4
|
+
import { convertMCPInputSchema } from './schema-utils.js';
|
|
4
5
|
|
|
5
6
|
interface MCPServerConfig {
|
|
6
7
|
name: string;
|
|
@@ -49,27 +50,12 @@ export class MCPConnector {
|
|
|
49
50
|
|
|
50
51
|
const functions: CustomFunctionDef[] = tools.map(
|
|
51
52
|
(tool: { name: string; description?: string; inputSchema: unknown }) => {
|
|
52
|
-
const
|
|
53
|
-
| {
|
|
54
|
-
type?: string;
|
|
55
|
-
properties?: Record<string, any>;
|
|
56
|
-
required?: string[];
|
|
57
|
-
}
|
|
58
|
-
| undefined;
|
|
59
|
-
|
|
60
|
-
const inputSchema = schema || { type: 'object', properties: {} };
|
|
61
|
-
if (!inputSchema.type) {
|
|
62
|
-
inputSchema.type = 'object';
|
|
63
|
-
}
|
|
53
|
+
const inputSchema = convertMCPInputSchema(tool.inputSchema);
|
|
64
54
|
|
|
65
55
|
return {
|
|
66
56
|
name: tool.name,
|
|
67
57
|
description: tool.description || `MCP tool: ${tool.name}`,
|
|
68
|
-
inputSchema
|
|
69
|
-
type: string;
|
|
70
|
-
properties?: Record<string, any>;
|
|
71
|
-
required?: string[];
|
|
72
|
-
},
|
|
58
|
+
inputSchema,
|
|
73
59
|
handler: async (input: unknown) => {
|
|
74
60
|
const result = await client.callTool({
|
|
75
61
|
name: tool.name,
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import type { CustomFunctionDef } from '@mondaydotcomorg/atp-protocol';
|
|
2
|
+
|
|
3
|
+
export interface MCPToolSchema {
|
|
4
|
+
type?: string;
|
|
5
|
+
properties?: Record<string, unknown>;
|
|
6
|
+
required?: string[];
|
|
7
|
+
description?: string;
|
|
8
|
+
[key: string]: unknown;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface MCPToolDefinition {
|
|
12
|
+
name: string;
|
|
13
|
+
description?: string;
|
|
14
|
+
inputSchema?: MCPToolSchema;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function convertMCPInputSchema(inputSchema: unknown): {
|
|
18
|
+
type: string;
|
|
19
|
+
properties?: Record<string, unknown>;
|
|
20
|
+
required?: string[];
|
|
21
|
+
[key: string]: unknown;
|
|
22
|
+
} {
|
|
23
|
+
const schema = inputSchema as MCPToolSchema | undefined;
|
|
24
|
+
|
|
25
|
+
if (!schema) {
|
|
26
|
+
return { type: 'object', properties: {} };
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const result: Record<string, unknown> = {};
|
|
30
|
+
result.type = schema.type || 'object';
|
|
31
|
+
|
|
32
|
+
if (result.type === 'object') {
|
|
33
|
+
result.properties = schema.properties || {};
|
|
34
|
+
} else if (schema.properties) {
|
|
35
|
+
result.properties = schema.properties;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (schema.required && schema.required.length > 0) {
|
|
39
|
+
result.required = schema.required;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (schema.description) {
|
|
43
|
+
result.description = schema.description;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const knownFields = new Set(['type', 'properties', 'required', 'description']);
|
|
47
|
+
for (const [key, value] of Object.entries(schema)) {
|
|
48
|
+
if (!knownFields.has(key) && value !== undefined) {
|
|
49
|
+
result[key] = value;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return result as {
|
|
54
|
+
type: string;
|
|
55
|
+
properties?: Record<string, unknown>;
|
|
56
|
+
required?: string[];
|
|
57
|
+
[key: string]: unknown;
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export function convertMCPToolToFunction(
|
|
62
|
+
tool: MCPToolDefinition,
|
|
63
|
+
handler: (input: unknown) => Promise<unknown>
|
|
64
|
+
): CustomFunctionDef {
|
|
65
|
+
return {
|
|
66
|
+
name: tool.name,
|
|
67
|
+
description: tool.description || `MCP tool: ${tool.name}`,
|
|
68
|
+
inputSchema: convertMCPInputSchema(tool.inputSchema),
|
|
69
|
+
handler,
|
|
70
|
+
};
|
|
71
|
+
}
|