fix: address Copilot review round 40 — a required name counts as a field

A schema may require a property it never declares: `{ type: "object",
required: ["token"] }` is legal and the tool plainly takes an argument.
declaresAnyFields counted only `properties`, so an App tool shaped that way —
including nested under a composition — was reported input-free and
auto-invoked with `{}`.

Signed-off-by: cliffhall <cliff@futurescale.com>
This commit is contained in:
cliffhall 2026-08-26 15:49:54 -04:00
commit 8f935adaad

View file

@ -145,6 +145,12 @@ describe("hasInputFields with root composition (#2123)", () => {
).toBe(true);
});
it("counts a required name the schema never declares", () => {
expect(hasInputFields(tool({ type: "object", required: ["token"] }))).toBe(
true,
);
});
it("still reports no fields for a bare object schema", () => {
expect(hasInputFields(tool({ type: "object" }))).toBe(false);
});