@mcpcloud/runtime 0.15.0 → 0.17.2
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/compat-stdio.js +11 -11
- package/dist/compat-worker.js +37 -37
- package/dist/config.d.ts +11 -0
- package/dist/container-host.js +7 -7
- package/dist/http.d.ts +18 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +49 -49
- package/dist/node.js +7 -7
- package/dist/platform-error-messages.d.ts +15 -0
- package/dist/runtimeVersion.d.ts +1 -1
- package/dist/stdio.js +20 -20
- package/dist/tool-errors.d.ts +10 -0
- package/dist/tool-input-schema.d.ts +60 -0
- package/dist/validation.d.ts +9 -0
- package/package.json +1 -1
package/dist/tool-errors.d.ts
CHANGED
|
@@ -97,6 +97,10 @@ export declare function mustRethrow(error: unknown): boolean;
|
|
|
97
97
|
* clients reading `content[0].text` see exactly what they saw before.
|
|
98
98
|
*/
|
|
99
99
|
export declare function toToolErrorResult(error: unknown): CallToolResult;
|
|
100
|
+
/** What the client declared it can do, when the era makes that knowable. */
|
|
101
|
+
export interface ClientCapabilitySnapshot {
|
|
102
|
+
elicitation?: unknown;
|
|
103
|
+
}
|
|
100
104
|
/**
|
|
101
105
|
* Run a tool handler, converting a throw into a classified error result.
|
|
102
106
|
*
|
|
@@ -110,4 +114,10 @@ export declare function toToolErrorResult(error: unknown): CallToolResult;
|
|
|
110
114
|
export declare function runToolHandler(invoke: () => Promise<CallToolResult>, options?: {
|
|
111
115
|
era?: 'legacy' | 'modern';
|
|
112
116
|
inputRequired?: InputRequiredBuilder;
|
|
117
|
+
/**
|
|
118
|
+
* The client's declared capabilities, read at call time. A function
|
|
119
|
+
* because the value is per-request on the 2026-07-28 era, and `undefined`
|
|
120
|
+
* means "not knowable here" rather than "declared nothing".
|
|
121
|
+
*/
|
|
122
|
+
clientCapabilities?: () => ClientCapabilitySnapshot | null | undefined;
|
|
113
123
|
}): Promise<CallToolResult>;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The bridge between a tool's stored JSON Schema and the MCP SDK.
|
|
3
|
+
*
|
|
4
|
+
* WHY THIS EXISTS — the schema an agent reads used to be a translation.
|
|
5
|
+
*
|
|
6
|
+
* `registerTool` takes a Standard Schema, and the only one we had was Zod, so
|
|
7
|
+
* the runtime compiled each tool's stored JSON Schema into a Zod object and
|
|
8
|
+
* handed that over. The SDK then serialized the Zod object back to JSON Schema
|
|
9
|
+
* to answer `tools/list`. Nothing needed the round trip, and it was lossy in
|
|
10
|
+
* both directions:
|
|
11
|
+
*
|
|
12
|
+
* - `z.number().int()` serializes with JavaScript's safe-integer range, so a
|
|
13
|
+
* `limit` whose real ceiling is 100 advertised a floor of
|
|
14
|
+
* -9007199254740991. Both integrators reported this as noise their agents
|
|
15
|
+
* had to read past; neither contract contained such a bound.
|
|
16
|
+
* - `default`, `examples`, `format`, `title` and every other annotation the
|
|
17
|
+
* compiler has no Zod equivalent for were dropped. A contract's
|
|
18
|
+
* `default: 50` never reached the client.
|
|
19
|
+
*
|
|
20
|
+
* So the tool now advertises the stored schema VERBATIM, and validates with
|
|
21
|
+
* the runtime's own validator — the same `describeInputIssues` the generated
|
|
22
|
+
* handler calls. One schema, one validator, no translation layer between the
|
|
23
|
+
* contract and the agent.
|
|
24
|
+
*
|
|
25
|
+
* `jsonSchemaToZodObject` stays exported for callers that genuinely want a Zod
|
|
26
|
+
* object; it is simply no longer in the path between a tool and its client.
|
|
27
|
+
*/
|
|
28
|
+
/**
|
|
29
|
+
* The shape `registerTool` accepts: Standard Schema's validate half plus the
|
|
30
|
+
* JSON Schema half the SDK reads to fill in `tools/list`.
|
|
31
|
+
*
|
|
32
|
+
* Declared structurally rather than imported. The SDK exports these as types
|
|
33
|
+
* only, and typing them here keeps this module readable without pinning it to
|
|
34
|
+
* one SDK entry point's type layout.
|
|
35
|
+
*/
|
|
36
|
+
export interface ToolInputStandardSchema {
|
|
37
|
+
readonly '~standard': {
|
|
38
|
+
readonly version: 1;
|
|
39
|
+
readonly vendor: string;
|
|
40
|
+
readonly validate: (value: unknown) => {
|
|
41
|
+
readonly value: unknown;
|
|
42
|
+
readonly issues?: undefined;
|
|
43
|
+
} | {
|
|
44
|
+
readonly issues: ReadonlyArray<{
|
|
45
|
+
readonly message: string;
|
|
46
|
+
}>;
|
|
47
|
+
};
|
|
48
|
+
readonly jsonSchema: {
|
|
49
|
+
readonly input: () => Record<string, unknown>;
|
|
50
|
+
readonly output: () => Record<string, unknown>;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Wrap a tool's stored JSON Schema for `registerTool`.
|
|
56
|
+
*
|
|
57
|
+
* `toolName` is carried only so a rejection reads the same whether the SDK
|
|
58
|
+
* caught it or the handler did.
|
|
59
|
+
*/
|
|
60
|
+
export declare function toolInputStandardSchema(toolName: string, schema: unknown): ToolInputStandardSchema;
|
package/dist/validation.d.ts
CHANGED
|
@@ -14,4 +14,13 @@ export declare function rankClosestNames(unknownName: string, knownNames: readon
|
|
|
14
14
|
suggestion: string | null;
|
|
15
15
|
nearest: string[];
|
|
16
16
|
};
|
|
17
|
+
/**
|
|
18
|
+
* Every way this input fails the schema, as `"/path message"` lines — the same
|
|
19
|
+
* strings `assertValidInput` puts in a `ToolInputError`, and empty when the
|
|
20
|
+
* input is valid.
|
|
21
|
+
*
|
|
22
|
+
* Exported for `toolInputStandardSchema`, so the check the MCP SDK runs before
|
|
23
|
+
* a handler is reached is THIS check and not a second opinion.
|
|
24
|
+
*/
|
|
25
|
+
export declare function describeInputIssues(schema: Record<string, unknown>, input: unknown): string[];
|
|
17
26
|
export declare function assertValidInput<T>(toolName: string, schema: Record<string, unknown>, input: unknown): T;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mcpcloud/runtime",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.17.2",
|
|
4
4
|
"description": "MCPCloud generated-server runtime: transports, config, upstream auth/HTTP, validation, projection, and discovery for MCP servers built on MCPCloud.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|