Finish .js import extensions and drop the zod 3 fallback test
Add explicit .js extensions to the relative imports in app.ts, app-bridge.ts and their tests so the emitted declarations resolve under NodeNext (#704). Replace the zod 3 JSON Schema fallback test, whose code path was removed, with the remaining non-Standard-JSON-Schema rejection case as its own test.
This commit is contained in:
parent
cfdc0c725f
commit
f722753c8f
2 changed files with 5 additions and 34 deletions
|
|
@ -1551,40 +1551,9 @@ describe("App <-> AppBridge integration", () => {
|
|||
).rejects.toThrow(/Invalid input for tool translate/);
|
||||
});
|
||||
|
||||
it("falls back to z.toJSONSchema for zod schemas lacking ~standard.jsonSchema (zod v3.25.x)", async () => {
|
||||
// zod v3.25 implements ~standard.validate but not ~standard.jsonSchema.
|
||||
// Simulate by stripping jsonSchema from a real zod schema.
|
||||
const v4Schema = z.object({ q: z.string() });
|
||||
const zod3LikeSchema = Object.assign(Object.create(v4Schema), {
|
||||
"~standard": {
|
||||
version: 1 as const,
|
||||
vendor: "zod",
|
||||
validate: v4Schema["~standard"].validate,
|
||||
types: undefined as
|
||||
| undefined
|
||||
| {
|
||||
readonly input: { q: string };
|
||||
readonly output: { q: string };
|
||||
},
|
||||
// no jsonSchema
|
||||
},
|
||||
});
|
||||
|
||||
it("rejects listTools when a tool schema does not implement Standard JSON Schema", async () => {
|
||||
const appCapabilities = { tools: { listChanged: true } };
|
||||
app = new App(testAppInfo, appCapabilities, { autoResize: false });
|
||||
app.registerTool(
|
||||
"search",
|
||||
{ inputSchema: zod3LikeSchema },
|
||||
async ({ q }: { q: string }) => ({
|
||||
content: [{ type: "text" as const, text: q }],
|
||||
}),
|
||||
);
|
||||
await app.connect(appTransport);
|
||||
|
||||
const list = await bridge.listTools({});
|
||||
expect(list.tools[0].inputSchema.properties).toHaveProperty("q");
|
||||
|
||||
// Non-zod schema without jsonSchema → listTools rejects with guidance.
|
||||
app.registerTool(
|
||||
"broken",
|
||||
{
|
||||
|
|
@ -1598,6 +1567,8 @@ describe("App <-> AppBridge integration", () => {
|
|||
},
|
||||
async () => ({ content: [] }),
|
||||
);
|
||||
await app.connect(appTransport);
|
||||
|
||||
expect(bridge.listTools({})).rejects.toThrow(
|
||||
/does not implement Standard JSON Schema/,
|
||||
);
|
||||
|
|
|
|||
|
|
@ -6,13 +6,13 @@ import {
|
|||
} from "@modelcontextprotocol/server";
|
||||
import { z } from "zod/v4";
|
||||
|
||||
import { App } from "./app";
|
||||
import { App } from "./app.js";
|
||||
import {
|
||||
LATEST_PROTOCOL_VERSION,
|
||||
McpUiInitializeRequestSchema,
|
||||
McpUiInitializeResultSchema,
|
||||
McpUiInitializedNotificationSchema,
|
||||
} from "./types";
|
||||
} from "./types.js";
|
||||
|
||||
type ConnectedPair = {
|
||||
app: App;
|
||||
|
|
|
|||
Loading…
Reference in a new issue