skedyul 0.1.2 → 0.1.4
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/server.js +22 -10
- package/dist/types.d.ts +19 -12
- package/package.json +5 -4
package/dist/server.js
CHANGED
|
@@ -8,6 +8,7 @@ exports.createSkedyulServer = createSkedyulServer;
|
|
|
8
8
|
const http_1 = __importDefault(require("http"));
|
|
9
9
|
const mcp_js_1 = require("@modelcontextprotocol/sdk/server/mcp.js");
|
|
10
10
|
const streamableHttp_js_1 = require("@modelcontextprotocol/sdk/server/streamableHttp.js");
|
|
11
|
+
const zod_to_json_schema_1 = require("zod-to-json-schema");
|
|
11
12
|
const service_1 = require("./core/service");
|
|
12
13
|
function normalizeBilling(billing) {
|
|
13
14
|
if (!billing || typeof billing.credits !== 'number') {
|
|
@@ -15,6 +16,23 @@ function normalizeBilling(billing) {
|
|
|
15
16
|
}
|
|
16
17
|
return billing;
|
|
17
18
|
}
|
|
19
|
+
// Loosely-typed wrapper around zod-to-json-schema to avoid version/type
|
|
20
|
+
// mismatches between the zod dependency used here and the one used by the
|
|
21
|
+
// library. At runtime the schemas are compatible.
|
|
22
|
+
const zodToJsonSchemaLoose = zod_to_json_schema_1.zodToJsonSchema;
|
|
23
|
+
function toJsonSchema(schema) {
|
|
24
|
+
if (!schema)
|
|
25
|
+
return undefined;
|
|
26
|
+
try {
|
|
27
|
+
return zodToJsonSchemaLoose(schema, {
|
|
28
|
+
target: 'jsonSchema7',
|
|
29
|
+
$refStrategy: 'none',
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
return undefined;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
18
36
|
function parseJsonRecord(value) {
|
|
19
37
|
if (!value) {
|
|
20
38
|
return {};
|
|
@@ -184,16 +202,8 @@ function buildToolMetadata(registry) {
|
|
|
184
202
|
return Object.values(registry).map((tool) => ({
|
|
185
203
|
name: tool.name,
|
|
186
204
|
description: tool.description,
|
|
187
|
-
inputSchema:
|
|
188
|
-
|
|
189
|
-
properties: {
|
|
190
|
-
inputs: {
|
|
191
|
-
type: 'object',
|
|
192
|
-
description: 'Input parameters for the function',
|
|
193
|
-
},
|
|
194
|
-
},
|
|
195
|
-
required: ['inputs'],
|
|
196
|
-
},
|
|
205
|
+
inputSchema: toJsonSchema(tool.inputs),
|
|
206
|
+
outputSchema: toJsonSchema(tool.outputSchema),
|
|
197
207
|
}));
|
|
198
208
|
}
|
|
199
209
|
function createRequestState(maxRequests, ttlExtendSeconds, runtimeLabel, toolNames) {
|
|
@@ -360,6 +370,8 @@ function createSkedyulServer(config, registry) {
|
|
|
360
370
|
mcpServer.registerTool(toolName, {
|
|
361
371
|
title: toolName,
|
|
362
372
|
description: tool.description,
|
|
373
|
+
// The MCP SDK expects Zod schemas here; it will handle JSON Schema
|
|
374
|
+
// conversion for tools/list responses.
|
|
363
375
|
inputSchema: tool.inputs,
|
|
364
376
|
outputSchema: tool.outputSchema,
|
|
365
377
|
}, async (args) => {
|
package/dist/types.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export interface ToolExecutionResult<Output = unknown> {
|
|
|
16
16
|
billing: BillingInfo;
|
|
17
17
|
}
|
|
18
18
|
export type ToolHandler<Input, Output> = (params: ToolParams<Input, Output>) => Promise<ToolExecutionResult<Output>> | ToolExecutionResult<Output>;
|
|
19
|
-
export interface ToolDefinition<Input = unknown, Output = unknown, InputSchema extends z.
|
|
19
|
+
export interface ToolDefinition<Input = unknown, Output = unknown, InputSchema extends z.ZodTypeAny = z.ZodType<Input>, OutputSchema extends z.ZodTypeAny = z.ZodType<Output>> {
|
|
20
20
|
name: string;
|
|
21
21
|
description: string;
|
|
22
22
|
inputs: InputSchema;
|
|
@@ -24,21 +24,28 @@ export interface ToolDefinition<Input = unknown, Output = unknown, InputSchema e
|
|
|
24
24
|
outputSchema?: OutputSchema;
|
|
25
25
|
[key: string]: unknown;
|
|
26
26
|
}
|
|
27
|
-
export
|
|
27
|
+
export interface ToolRegistryEntry {
|
|
28
|
+
name: string;
|
|
29
|
+
description: string;
|
|
30
|
+
inputs: z.ZodTypeAny;
|
|
31
|
+
handler: unknown;
|
|
32
|
+
outputSchema?: z.ZodTypeAny;
|
|
33
|
+
[key: string]: unknown;
|
|
34
|
+
}
|
|
35
|
+
export type ToolRegistry = Record<string, ToolRegistryEntry>;
|
|
28
36
|
export type ToolName<T extends ToolRegistry> = Extract<keyof T, string>;
|
|
29
37
|
export interface ToolMetadata {
|
|
30
38
|
name: string;
|
|
31
39
|
description: string;
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
};
|
|
40
|
+
/**
|
|
41
|
+
* JSON Schema describing the tool's inputs, as returned by zod-to-json-schema.
|
|
42
|
+
* This is intentionally loose to support arbitrary JSON Schema shapes.
|
|
43
|
+
*/
|
|
44
|
+
inputSchema?: Record<string, unknown>;
|
|
45
|
+
/**
|
|
46
|
+
* Optional JSON Schema describing the tool's output, if provided.
|
|
47
|
+
*/
|
|
48
|
+
outputSchema?: Record<string, unknown>;
|
|
42
49
|
}
|
|
43
50
|
export interface HealthStatus {
|
|
44
51
|
status: 'running';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "skedyul",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "The Skedyul SDK for Node.js",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
},
|
|
13
13
|
"files": ["dist"],
|
|
14
14
|
"scripts": {
|
|
15
|
-
"build": "tsc --build tsconfig.json",
|
|
16
|
-
"test": "npm run build && node --test tests/server.test.js"
|
|
15
|
+
"build": "tsc --build tsconfig.json && tsc --project tsconfig.tests.json",
|
|
16
|
+
"test": "npm run build && node --test dist-tests/server.test.js"
|
|
17
17
|
},
|
|
18
18
|
"keywords": ["mcp", "skedyul", "serverless", "node", "typescript"],
|
|
19
19
|
"repository": {
|
|
@@ -24,7 +24,8 @@
|
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@modelcontextprotocol/sdk": "^1.0.0",
|
|
27
|
-
"zod": "^4.0.0"
|
|
27
|
+
"zod": "^4.0.0",
|
|
28
|
+
"zod-to-json-schema": "^3.23.0"
|
|
28
29
|
},
|
|
29
30
|
"devDependencies": {
|
|
30
31
|
"@types/node": "^24.10.1",
|