@toolsdk.ai/registry 1.0.96 → 1.0.97
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/api/package-handler.d.ts +85 -2
- package/dist/api/package-handler.js +59 -6
- package/dist/api/package-route.js +1 -0
- package/dist/api/package-so.d.ts +207 -3
- package/dist/api/package-so.js +31 -17
- package/dist/types.d.ts +4 -0
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Context } from 'hono';
|
|
2
2
|
export declare const packageHandler: {
|
|
3
|
-
executeTool: (c: Context) => Promise<(globalThis.Response & import("hono").TypedResponse<never, 200
|
|
3
|
+
executeTool: (c: Context) => Promise<(globalThis.Response & import("hono").TypedResponse<never, 200, "json">) | (globalThis.Response & import("hono").TypedResponse<{
|
|
4
4
|
success: false;
|
|
5
5
|
code: number;
|
|
6
6
|
message: string;
|
|
@@ -34,6 +34,89 @@ export declare const packageHandler: {
|
|
|
34
34
|
required: boolean;
|
|
35
35
|
};
|
|
36
36
|
} | undefined;
|
|
37
|
+
tools?: {
|
|
38
|
+
[x: string]: never;
|
|
39
|
+
name: string;
|
|
40
|
+
inputSchema: {
|
|
41
|
+
[x: string]: never;
|
|
42
|
+
type: "object";
|
|
43
|
+
required?: string[] | undefined;
|
|
44
|
+
properties?: {
|
|
45
|
+
[x: string]: never;
|
|
46
|
+
} | undefined;
|
|
47
|
+
};
|
|
48
|
+
description?: string | undefined;
|
|
49
|
+
title?: string | undefined;
|
|
50
|
+
outputSchema?: {
|
|
51
|
+
[x: string]: never;
|
|
52
|
+
type: "object";
|
|
53
|
+
required?: string[] | undefined;
|
|
54
|
+
properties?: {
|
|
55
|
+
[x: string]: never;
|
|
56
|
+
} | undefined;
|
|
57
|
+
} | undefined;
|
|
58
|
+
annotations?: {
|
|
59
|
+
[x: string]: never;
|
|
60
|
+
title?: string | undefined;
|
|
61
|
+
readOnlyHint?: boolean | undefined;
|
|
62
|
+
destructiveHint?: boolean | undefined;
|
|
63
|
+
idempotentHint?: boolean | undefined;
|
|
64
|
+
openWorldHint?: boolean | undefined;
|
|
65
|
+
} | undefined;
|
|
66
|
+
_meta?: {
|
|
67
|
+
[x: string]: never;
|
|
68
|
+
} | undefined;
|
|
69
|
+
}[] | undefined;
|
|
37
70
|
} | undefined;
|
|
38
|
-
}, 200
|
|
71
|
+
}, 200, "json">) | (globalThis.Response & import("hono").TypedResponse<{
|
|
72
|
+
success: false;
|
|
73
|
+
code: number;
|
|
74
|
+
message: string;
|
|
75
|
+
}, 404, "json">)>;
|
|
76
|
+
listTools: (c: Context) => Promise<(globalThis.Response & import("hono").TypedResponse<{
|
|
77
|
+
success: false;
|
|
78
|
+
code: number;
|
|
79
|
+
message: string;
|
|
80
|
+
}, 400, "json">) | (globalThis.Response & import("hono").TypedResponse<{
|
|
81
|
+
success: boolean;
|
|
82
|
+
code: number;
|
|
83
|
+
message: string;
|
|
84
|
+
data?: {
|
|
85
|
+
[x: string]: never;
|
|
86
|
+
name: string;
|
|
87
|
+
inputSchema: {
|
|
88
|
+
[x: string]: never;
|
|
89
|
+
type: "object";
|
|
90
|
+
required?: string[] | undefined;
|
|
91
|
+
properties?: {
|
|
92
|
+
[x: string]: never;
|
|
93
|
+
} | undefined;
|
|
94
|
+
};
|
|
95
|
+
description?: string | undefined;
|
|
96
|
+
title?: string | undefined;
|
|
97
|
+
outputSchema?: {
|
|
98
|
+
[x: string]: never;
|
|
99
|
+
type: "object";
|
|
100
|
+
required?: string[] | undefined;
|
|
101
|
+
properties?: {
|
|
102
|
+
[x: string]: never;
|
|
103
|
+
} | undefined;
|
|
104
|
+
} | undefined;
|
|
105
|
+
annotations?: {
|
|
106
|
+
[x: string]: never;
|
|
107
|
+
title?: string | undefined;
|
|
108
|
+
readOnlyHint?: boolean | undefined;
|
|
109
|
+
destructiveHint?: boolean | undefined;
|
|
110
|
+
idempotentHint?: boolean | undefined;
|
|
111
|
+
openWorldHint?: boolean | undefined;
|
|
112
|
+
} | undefined;
|
|
113
|
+
_meta?: {
|
|
114
|
+
[x: string]: never;
|
|
115
|
+
} | undefined;
|
|
116
|
+
}[] | undefined;
|
|
117
|
+
}, 200, "json">) | (globalThis.Response & import("hono").TypedResponse<{
|
|
118
|
+
success: false;
|
|
119
|
+
code: number;
|
|
120
|
+
message: string;
|
|
121
|
+
}, 404, "json">)>;
|
|
39
122
|
};
|
|
@@ -5,8 +5,13 @@ export const packageHandler = {
|
|
|
5
5
|
try {
|
|
6
6
|
const toolSO = new PackageSO();
|
|
7
7
|
const result = await toolSO.executeTool(requestBody);
|
|
8
|
-
const
|
|
9
|
-
|
|
8
|
+
const response = {
|
|
9
|
+
success: true,
|
|
10
|
+
code: 200,
|
|
11
|
+
message: 'Tool executed successfully',
|
|
12
|
+
data: result,
|
|
13
|
+
};
|
|
14
|
+
return c.json(response, 200);
|
|
10
15
|
}
|
|
11
16
|
catch (error) {
|
|
12
17
|
if (error instanceof Error && (error.message.includes('not found') || error.message.includes('Unknown tool'))) {
|
|
@@ -29,9 +34,57 @@ export const packageHandler = {
|
|
|
29
34
|
message: 'Missing packageName query parameter',
|
|
30
35
|
}, 400);
|
|
31
36
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
37
|
+
try {
|
|
38
|
+
const toolSO = new PackageSO();
|
|
39
|
+
const result = await toolSO.getPackageDetail(packageName);
|
|
40
|
+
const response = {
|
|
41
|
+
success: true,
|
|
42
|
+
code: 200,
|
|
43
|
+
message: 'Package detail retrieved successfully',
|
|
44
|
+
data: result,
|
|
45
|
+
};
|
|
46
|
+
return c.json(response, 200);
|
|
47
|
+
}
|
|
48
|
+
catch (error) {
|
|
49
|
+
if (error instanceof Error && error.message.includes('not found')) {
|
|
50
|
+
return c.json({
|
|
51
|
+
success: false,
|
|
52
|
+
code: 404,
|
|
53
|
+
message: `Package '${packageName}' not found`,
|
|
54
|
+
}, 404);
|
|
55
|
+
}
|
|
56
|
+
throw error;
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
listTools: async (c) => {
|
|
60
|
+
const packageName = c.req.query('packageName');
|
|
61
|
+
if (!packageName) {
|
|
62
|
+
return c.json({
|
|
63
|
+
success: false,
|
|
64
|
+
code: 400,
|
|
65
|
+
message: 'Missing packageName query parameter',
|
|
66
|
+
}, 400);
|
|
67
|
+
}
|
|
68
|
+
try {
|
|
69
|
+
const toolSO = new PackageSO();
|
|
70
|
+
const result = await toolSO.listTools(packageName);
|
|
71
|
+
const response = {
|
|
72
|
+
success: true,
|
|
73
|
+
code: 200,
|
|
74
|
+
message: 'Tools list retrieved successfully',
|
|
75
|
+
data: result,
|
|
76
|
+
};
|
|
77
|
+
return c.json(response, 200);
|
|
78
|
+
}
|
|
79
|
+
catch (error) {
|
|
80
|
+
if (error instanceof Error && error.message.includes('not found')) {
|
|
81
|
+
return c.json({
|
|
82
|
+
success: false,
|
|
83
|
+
code: 404,
|
|
84
|
+
message: `Package '${packageName}' not found`,
|
|
85
|
+
}, 404);
|
|
86
|
+
}
|
|
87
|
+
throw error;
|
|
88
|
+
}
|
|
36
89
|
},
|
|
37
90
|
};
|
|
@@ -4,6 +4,7 @@ import { packageHandler } from './package-handler';
|
|
|
4
4
|
export const packageRoutes = new Hono();
|
|
5
5
|
packageRoutes.post('/packages/run', packageHandler.executeTool);
|
|
6
6
|
packageRoutes.get('/packages/detail', packageHandler.getPackageDetail);
|
|
7
|
+
packageRoutes.get('/packages/tools', packageHandler.listTools);
|
|
7
8
|
packageRoutes.get('/config/categories', (c) => {
|
|
8
9
|
const categories = require('../../config/categories.mjs').default;
|
|
9
10
|
const response = {
|
package/dist/api/package-so.d.ts
CHANGED
|
@@ -1,5 +1,209 @@
|
|
|
1
|
-
import type { MCPServerPackageConfig, ToolExecute
|
|
1
|
+
import type { MCPServerPackageConfig, ToolExecute } from '../types';
|
|
2
|
+
import type { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
2
3
|
export declare class PackageSO {
|
|
3
|
-
executeTool(request: ToolExecute): Promise<
|
|
4
|
-
|
|
4
|
+
executeTool(request: ToolExecute): Promise<import("zod").objectOutputType<{
|
|
5
|
+
_meta: import("zod").ZodOptional<import("zod").ZodObject<{}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
6
|
+
} & {
|
|
7
|
+
content: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodUnion<[import("zod").ZodObject<{
|
|
8
|
+
type: import("zod").ZodLiteral<"text">;
|
|
9
|
+
text: import("zod").ZodString;
|
|
10
|
+
_meta: import("zod").ZodOptional<import("zod").ZodObject<{}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
11
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
12
|
+
type: import("zod").ZodLiteral<"text">;
|
|
13
|
+
text: import("zod").ZodString;
|
|
14
|
+
_meta: import("zod").ZodOptional<import("zod").ZodObject<{}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
15
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
16
|
+
type: import("zod").ZodLiteral<"text">;
|
|
17
|
+
text: import("zod").ZodString;
|
|
18
|
+
_meta: import("zod").ZodOptional<import("zod").ZodObject<{}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
19
|
+
}, import("zod").ZodTypeAny, "passthrough">>, import("zod").ZodObject<{
|
|
20
|
+
type: import("zod").ZodLiteral<"image">;
|
|
21
|
+
data: import("zod").ZodString;
|
|
22
|
+
mimeType: import("zod").ZodString;
|
|
23
|
+
_meta: import("zod").ZodOptional<import("zod").ZodObject<{}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
24
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
25
|
+
type: import("zod").ZodLiteral<"image">;
|
|
26
|
+
data: import("zod").ZodString;
|
|
27
|
+
mimeType: import("zod").ZodString;
|
|
28
|
+
_meta: import("zod").ZodOptional<import("zod").ZodObject<{}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
29
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
30
|
+
type: import("zod").ZodLiteral<"image">;
|
|
31
|
+
data: import("zod").ZodString;
|
|
32
|
+
mimeType: import("zod").ZodString;
|
|
33
|
+
_meta: import("zod").ZodOptional<import("zod").ZodObject<{}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
34
|
+
}, import("zod").ZodTypeAny, "passthrough">>, import("zod").ZodObject<{
|
|
35
|
+
type: import("zod").ZodLiteral<"audio">;
|
|
36
|
+
data: import("zod").ZodString;
|
|
37
|
+
mimeType: import("zod").ZodString;
|
|
38
|
+
_meta: import("zod").ZodOptional<import("zod").ZodObject<{}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
39
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
40
|
+
type: import("zod").ZodLiteral<"audio">;
|
|
41
|
+
data: import("zod").ZodString;
|
|
42
|
+
mimeType: import("zod").ZodString;
|
|
43
|
+
_meta: import("zod").ZodOptional<import("zod").ZodObject<{}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
44
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
45
|
+
type: import("zod").ZodLiteral<"audio">;
|
|
46
|
+
data: import("zod").ZodString;
|
|
47
|
+
mimeType: import("zod").ZodString;
|
|
48
|
+
_meta: import("zod").ZodOptional<import("zod").ZodObject<{}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
49
|
+
}, import("zod").ZodTypeAny, "passthrough">>, import("zod").ZodObject<import("zod").objectUtil.extendShape<import("zod").objectUtil.extendShape<{
|
|
50
|
+
name: import("zod").ZodString;
|
|
51
|
+
title: import("zod").ZodOptional<import("zod").ZodString>;
|
|
52
|
+
}, {
|
|
53
|
+
uri: import("zod").ZodString;
|
|
54
|
+
description: import("zod").ZodOptional<import("zod").ZodString>;
|
|
55
|
+
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
|
56
|
+
_meta: import("zod").ZodOptional<import("zod").ZodObject<{}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
57
|
+
}>, {
|
|
58
|
+
type: import("zod").ZodLiteral<"resource_link">;
|
|
59
|
+
}>, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<import("zod").objectUtil.extendShape<import("zod").objectUtil.extendShape<{
|
|
60
|
+
name: import("zod").ZodString;
|
|
61
|
+
title: import("zod").ZodOptional<import("zod").ZodString>;
|
|
62
|
+
}, {
|
|
63
|
+
uri: import("zod").ZodString;
|
|
64
|
+
description: import("zod").ZodOptional<import("zod").ZodString>;
|
|
65
|
+
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
|
66
|
+
_meta: import("zod").ZodOptional<import("zod").ZodObject<{}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
67
|
+
}>, {
|
|
68
|
+
type: import("zod").ZodLiteral<"resource_link">;
|
|
69
|
+
}>, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<import("zod").objectUtil.extendShape<import("zod").objectUtil.extendShape<{
|
|
70
|
+
name: import("zod").ZodString;
|
|
71
|
+
title: import("zod").ZodOptional<import("zod").ZodString>;
|
|
72
|
+
}, {
|
|
73
|
+
uri: import("zod").ZodString;
|
|
74
|
+
description: import("zod").ZodOptional<import("zod").ZodString>;
|
|
75
|
+
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
|
76
|
+
_meta: import("zod").ZodOptional<import("zod").ZodObject<{}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
77
|
+
}>, {
|
|
78
|
+
type: import("zod").ZodLiteral<"resource_link">;
|
|
79
|
+
}>, import("zod").ZodTypeAny, "passthrough">>, import("zod").ZodObject<{
|
|
80
|
+
type: import("zod").ZodLiteral<"resource">;
|
|
81
|
+
resource: import("zod").ZodUnion<[import("zod").ZodObject<import("zod").objectUtil.extendShape<{
|
|
82
|
+
uri: import("zod").ZodString;
|
|
83
|
+
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
|
84
|
+
_meta: import("zod").ZodOptional<import("zod").ZodObject<{}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
85
|
+
}, {
|
|
86
|
+
text: import("zod").ZodString;
|
|
87
|
+
}>, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<import("zod").objectUtil.extendShape<{
|
|
88
|
+
uri: import("zod").ZodString;
|
|
89
|
+
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
|
90
|
+
_meta: import("zod").ZodOptional<import("zod").ZodObject<{}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
91
|
+
}, {
|
|
92
|
+
text: import("zod").ZodString;
|
|
93
|
+
}>, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<import("zod").objectUtil.extendShape<{
|
|
94
|
+
uri: import("zod").ZodString;
|
|
95
|
+
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
|
96
|
+
_meta: import("zod").ZodOptional<import("zod").ZodObject<{}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
97
|
+
}, {
|
|
98
|
+
text: import("zod").ZodString;
|
|
99
|
+
}>, import("zod").ZodTypeAny, "passthrough">>, import("zod").ZodObject<import("zod").objectUtil.extendShape<{
|
|
100
|
+
uri: import("zod").ZodString;
|
|
101
|
+
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
|
102
|
+
_meta: import("zod").ZodOptional<import("zod").ZodObject<{}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
103
|
+
}, {
|
|
104
|
+
blob: import("zod").ZodString;
|
|
105
|
+
}>, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<import("zod").objectUtil.extendShape<{
|
|
106
|
+
uri: import("zod").ZodString;
|
|
107
|
+
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
|
108
|
+
_meta: import("zod").ZodOptional<import("zod").ZodObject<{}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
109
|
+
}, {
|
|
110
|
+
blob: import("zod").ZodString;
|
|
111
|
+
}>, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<import("zod").objectUtil.extendShape<{
|
|
112
|
+
uri: import("zod").ZodString;
|
|
113
|
+
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
|
114
|
+
_meta: import("zod").ZodOptional<import("zod").ZodObject<{}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
115
|
+
}, {
|
|
116
|
+
blob: import("zod").ZodString;
|
|
117
|
+
}>, import("zod").ZodTypeAny, "passthrough">>]>;
|
|
118
|
+
_meta: import("zod").ZodOptional<import("zod").ZodObject<{}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
119
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
120
|
+
type: import("zod").ZodLiteral<"resource">;
|
|
121
|
+
resource: import("zod").ZodUnion<[import("zod").ZodObject<import("zod").objectUtil.extendShape<{
|
|
122
|
+
uri: import("zod").ZodString;
|
|
123
|
+
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
|
124
|
+
_meta: import("zod").ZodOptional<import("zod").ZodObject<{}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
125
|
+
}, {
|
|
126
|
+
text: import("zod").ZodString;
|
|
127
|
+
}>, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<import("zod").objectUtil.extendShape<{
|
|
128
|
+
uri: import("zod").ZodString;
|
|
129
|
+
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
|
130
|
+
_meta: import("zod").ZodOptional<import("zod").ZodObject<{}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
131
|
+
}, {
|
|
132
|
+
text: import("zod").ZodString;
|
|
133
|
+
}>, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<import("zod").objectUtil.extendShape<{
|
|
134
|
+
uri: import("zod").ZodString;
|
|
135
|
+
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
|
136
|
+
_meta: import("zod").ZodOptional<import("zod").ZodObject<{}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
137
|
+
}, {
|
|
138
|
+
text: import("zod").ZodString;
|
|
139
|
+
}>, import("zod").ZodTypeAny, "passthrough">>, import("zod").ZodObject<import("zod").objectUtil.extendShape<{
|
|
140
|
+
uri: import("zod").ZodString;
|
|
141
|
+
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
|
142
|
+
_meta: import("zod").ZodOptional<import("zod").ZodObject<{}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
143
|
+
}, {
|
|
144
|
+
blob: import("zod").ZodString;
|
|
145
|
+
}>, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<import("zod").objectUtil.extendShape<{
|
|
146
|
+
uri: import("zod").ZodString;
|
|
147
|
+
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
|
148
|
+
_meta: import("zod").ZodOptional<import("zod").ZodObject<{}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
149
|
+
}, {
|
|
150
|
+
blob: import("zod").ZodString;
|
|
151
|
+
}>, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<import("zod").objectUtil.extendShape<{
|
|
152
|
+
uri: import("zod").ZodString;
|
|
153
|
+
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
|
154
|
+
_meta: import("zod").ZodOptional<import("zod").ZodObject<{}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
155
|
+
}, {
|
|
156
|
+
blob: import("zod").ZodString;
|
|
157
|
+
}>, import("zod").ZodTypeAny, "passthrough">>]>;
|
|
158
|
+
_meta: import("zod").ZodOptional<import("zod").ZodObject<{}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
159
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
160
|
+
type: import("zod").ZodLiteral<"resource">;
|
|
161
|
+
resource: import("zod").ZodUnion<[import("zod").ZodObject<import("zod").objectUtil.extendShape<{
|
|
162
|
+
uri: import("zod").ZodString;
|
|
163
|
+
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
|
164
|
+
_meta: import("zod").ZodOptional<import("zod").ZodObject<{}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
165
|
+
}, {
|
|
166
|
+
text: import("zod").ZodString;
|
|
167
|
+
}>, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<import("zod").objectUtil.extendShape<{
|
|
168
|
+
uri: import("zod").ZodString;
|
|
169
|
+
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
|
170
|
+
_meta: import("zod").ZodOptional<import("zod").ZodObject<{}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
171
|
+
}, {
|
|
172
|
+
text: import("zod").ZodString;
|
|
173
|
+
}>, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<import("zod").objectUtil.extendShape<{
|
|
174
|
+
uri: import("zod").ZodString;
|
|
175
|
+
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
|
176
|
+
_meta: import("zod").ZodOptional<import("zod").ZodObject<{}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
177
|
+
}, {
|
|
178
|
+
text: import("zod").ZodString;
|
|
179
|
+
}>, import("zod").ZodTypeAny, "passthrough">>, import("zod").ZodObject<import("zod").objectUtil.extendShape<{
|
|
180
|
+
uri: import("zod").ZodString;
|
|
181
|
+
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
|
182
|
+
_meta: import("zod").ZodOptional<import("zod").ZodObject<{}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
183
|
+
}, {
|
|
184
|
+
blob: import("zod").ZodString;
|
|
185
|
+
}>, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<import("zod").objectUtil.extendShape<{
|
|
186
|
+
uri: import("zod").ZodString;
|
|
187
|
+
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
|
188
|
+
_meta: import("zod").ZodOptional<import("zod").ZodObject<{}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
189
|
+
}, {
|
|
190
|
+
blob: import("zod").ZodString;
|
|
191
|
+
}>, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<import("zod").objectUtil.extendShape<{
|
|
192
|
+
uri: import("zod").ZodString;
|
|
193
|
+
mimeType: import("zod").ZodOptional<import("zod").ZodString>;
|
|
194
|
+
_meta: import("zod").ZodOptional<import("zod").ZodObject<{}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
195
|
+
}, {
|
|
196
|
+
blob: import("zod").ZodString;
|
|
197
|
+
}>, import("zod").ZodTypeAny, "passthrough">>]>;
|
|
198
|
+
_meta: import("zod").ZodOptional<import("zod").ZodObject<{}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
199
|
+
}, import("zod").ZodTypeAny, "passthrough">>]>, "many">>;
|
|
200
|
+
structuredContent: import("zod").ZodOptional<import("zod").ZodObject<{}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
201
|
+
isError: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
202
|
+
}, import("zod").ZodTypeAny, "passthrough"> | import("zod").objectOutputType<{
|
|
203
|
+
_meta: import("zod").ZodOptional<import("zod").ZodObject<{}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
204
|
+
} & {
|
|
205
|
+
toolResult: import("zod").ZodUnknown;
|
|
206
|
+
}, import("zod").ZodTypeAny, "passthrough">>;
|
|
207
|
+
listTools(packageName: string): Promise<Tool[]>;
|
|
208
|
+
getPackageDetail(packageName: string): Promise<MCPServerPackageConfig>;
|
|
5
209
|
}
|
package/dist/api/package-so.js
CHANGED
|
@@ -11,12 +11,25 @@ export class PackageSO {
|
|
|
11
11
|
arguments: request.inputData,
|
|
12
12
|
});
|
|
13
13
|
console.log(`Tool ${request.toolKey} executed successfully`);
|
|
14
|
-
return
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
return result;
|
|
15
|
+
}
|
|
16
|
+
finally {
|
|
17
|
+
await closeConnection();
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
async listTools(packageName) {
|
|
21
|
+
const mcpServerConfig = getPackageConfigByKey(packageName);
|
|
22
|
+
const mockEnvs = {};
|
|
23
|
+
if (mcpServerConfig.env) {
|
|
24
|
+
Object.keys(mcpServerConfig.env).forEach((key) => {
|
|
25
|
+
mockEnvs[key] = 'mock_value';
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
const { client, closeConnection } = await getMcpClient(mcpServerConfig, mockEnvs);
|
|
29
|
+
try {
|
|
30
|
+
const { tools } = await client.listTools();
|
|
31
|
+
console.log(`Tools list retrieved successfully for package ${packageName}`);
|
|
32
|
+
return tools;
|
|
20
33
|
}
|
|
21
34
|
finally {
|
|
22
35
|
await closeConnection();
|
|
@@ -25,20 +38,21 @@ export class PackageSO {
|
|
|
25
38
|
async getPackageDetail(packageName) {
|
|
26
39
|
const packageInfo = typedAllPackagesList[packageName];
|
|
27
40
|
if (!packageInfo) {
|
|
28
|
-
|
|
29
|
-
success: false,
|
|
30
|
-
code: 404,
|
|
31
|
-
message: `Package ${packageName} not found`,
|
|
32
|
-
};
|
|
41
|
+
throw new Error(`Package ${packageName} not found`);
|
|
33
42
|
}
|
|
34
43
|
const jsonFilePath = path.join(__dirname, '../../packages/', packageInfo.path);
|
|
35
44
|
const jsonStr = fs.readFileSync(jsonFilePath, 'utf-8');
|
|
36
45
|
const packageConfig = JSON.parse(jsonStr);
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
46
|
+
let tools;
|
|
47
|
+
try {
|
|
48
|
+
tools = await this.listTools(packageName);
|
|
49
|
+
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
console.warn(`Warn retrieving tools for package ${packageName}:`, error.message);
|
|
52
|
+
// 如果无法获取工具列表,则将tools设置为undefined
|
|
53
|
+
tools = undefined;
|
|
54
|
+
}
|
|
55
|
+
const packageConfigWithTools = Object.assign(Object.assign({}, packageConfig), { tools });
|
|
56
|
+
return packageConfigWithTools;
|
|
43
57
|
}
|
|
44
58
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import type { CategoryConfigSchema, PackageConfigSchema, MCPServerPackageConfigSchema, PackagesListSchema, ToolExecuteSchema } from './schema';
|
|
3
|
+
import type { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
3
4
|
export type MCPServerPackageConfig = z.infer<typeof MCPServerPackageConfigSchema>;
|
|
4
5
|
export type PackageConfig = z.infer<typeof PackageConfigSchema>;
|
|
5
6
|
export type CategoryConfig = z.infer<typeof CategoryConfigSchema>;
|
|
@@ -11,3 +12,6 @@ export interface Response<T> {
|
|
|
11
12
|
message: string;
|
|
12
13
|
data?: T;
|
|
13
14
|
}
|
|
15
|
+
export type MCPServerPackageConfigWithTools = MCPServerPackageConfig & {
|
|
16
|
+
tools?: Tool[];
|
|
17
|
+
};
|