test(mcp): validate defaults at tool boundary

This commit is contained in:
morluto
2026-09-29 18:42:42 +08:00
parent 4593c29b64
commit 21241d2323
2 changed files with 8 additions and 13 deletions
+8
View File
@@ -234,6 +234,14 @@ describe("official Hopper proxy tools", () => {
case_sensitive: false,
document: null,
});
expect(
invocations.find(({ name }) => name === "search_strings")?.arguments_,
).toEqual({
pattern: "hello",
mode: "literal",
case_sensitive: false,
document: null,
});
});
it("returns stable safe MCP error content", async () => {
@@ -7,19 +7,6 @@ import { GENERATED_MCP_TOOL_CATALOG } from "../../../src/generatedMcpToolCatalog
import { toolRegistrationOptions } from "../../../src/server/toolRegistrationOptions.js";
describe("tool registration options", () => {
it("preserves canonical Zod parsers in the SDK schemas", () => {
for (const contract of TOOL_CONTRACTS) {
const options = toolRegistrationOptions(contract);
expect(options.inputSchema).not.toBe(contract.inputSchema);
expect(
options.inputSchema.safeParse(contract.examples[0]?.input ?? {}),
).toEqual(
contract.inputSchema.safeParse(contract.examples[0]?.input ?? {}),
);
expect(options.outputSchema).toBe(contract.outputSchema);
}
});
it("generates the checked-in catalog from the SDK wire projection", async () => {
const server = new McpServer({ name: "catalog-test", version: "0" });
for (const contract of TOOL_CONTRACTS)