fix: narrow empty MCP tool schema normalization (#60176) (thanks @Bartok9)

This commit is contained in:
Peter Steinberger
2026-04-03 20:43:05 +09:00
parent 19dbe00763
commit 57999f9965
3 changed files with 20 additions and 5 deletions

View File

@@ -20,6 +20,20 @@ describe("normalizeToolParameters", () => {
expect(parameters.properties).toEqual({});
});
it("does not rewrite non-empty schemas that still lack type/properties", () => {
const tool: AnyAgentTool = {
name: "conditional",
label: "conditional",
description: "Conditional schema stays untouched",
parameters: { allOf: [] },
execute: vi.fn(),
};
const normalized = normalizeToolParameters(tool);
expect(normalized.parameters).toEqual({ allOf: [] });
});
it("injects properties:{} for type:object schemas missing properties (MCP no-param tools)", () => {
const tool: AnyAgentTool = {
name: "list_regions",