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:
Olivier Chafik 2026-09-07 15:36:30 +01:00
commit f722753c8f
2 changed files with 5 additions and 34 deletions

View file

@ -1551,40 +1551,9 @@ describe("App <-> AppBridge integration", () => {
).rejects.toThrow(/Invalid input for tool translate/); ).rejects.toThrow(/Invalid input for tool translate/);
}); });
it("falls back to z.toJSONSchema for zod schemas lacking ~standard.jsonSchema (zod v3.25.x)", async () => { it("rejects listTools when a tool schema does not implement Standard JSON Schema", 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
},
});
const appCapabilities = { tools: { listChanged: true } }; const appCapabilities = { tools: { listChanged: true } };
app = new App(testAppInfo, appCapabilities, { autoResize: false }); 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( app.registerTool(
"broken", "broken",
{ {
@ -1598,6 +1567,8 @@ describe("App <-> AppBridge integration", () => {
}, },
async () => ({ content: [] }), async () => ({ content: [] }),
); );
await app.connect(appTransport);
expect(bridge.listTools({})).rejects.toThrow( expect(bridge.listTools({})).rejects.toThrow(
/does not implement Standard JSON Schema/, /does not implement Standard JSON Schema/,
); );

View file

@ -6,13 +6,13 @@ import {
} from "@modelcontextprotocol/server"; } from "@modelcontextprotocol/server";
import { z } from "zod/v4"; import { z } from "zod/v4";
import { App } from "./app"; import { App } from "./app.js";
import { import {
LATEST_PROTOCOL_VERSION, LATEST_PROTOCOL_VERSION,
McpUiInitializeRequestSchema, McpUiInitializeRequestSchema,
McpUiInitializeResultSchema, McpUiInitializeResultSchema,
McpUiInitializedNotificationSchema, McpUiInitializedNotificationSchema,
} from "./types"; } from "./types.js";
type ConnectedPair = { type ConnectedPair = {
app: App; app: App;