Repository navigation
Conversation
The exec tool declared `input` as an object of JSON values through a recursive schema. A recursive schema can't be inlined, so it serializes to a `$ref` into a definitions section, which some providers reject. pi's declarations already ask for schemas to be inlined for that reason, but this one came out with definitions anyway, and a consumer had to rewrite the declaration to send it. Declare `input` as an object of any values, and check that the values are finite JSON with the runtime's own check when the call is validated. The tool still refuses a value the backend would refuse, at its own boundary, and the declaration stays a real object schema.
🦋 Changeset detectedLatest commit: b3931db The changes in this PR will be included in the next version bump. This PR includes changesets to release 5 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
commit: |
| it("declares input as an object, with no definitions to point into", () => { | ||
| const json = z.toJSONSchema(defineExec({ workspace: callable }).inputSchema, { | ||
| target: "draft-7", | ||
| io: "input", | ||
| }); | ||
|
|
||
| expect(JSON.stringify(json)).not.toContain("$ref"); | ||
| expect(json).not.toHaveProperty("definitions"); | ||
| expect(json.properties?.input).toMatchObject({ type: "object" }); |
There was a problem hiding this comment.
🔍 Provider compatibility beyond reference removal
inputObjectSchema removes references but still emits propertyNames and additionalProperties: {}. The reported workaround omitted both, so the schema test does not establish compatibility with that provider.
Was this helpful? React with 👍 or 👎 to provide feedback.
| const inputObjectSchema = z.record(z.string(), z.unknown()).superRefine((value, context) => { | ||
| try { | ||
| assertRuntimeValue(value); |
There was a problem hiding this comment.
📝 Info: Undefined fields now pass validation
inputObjectSchema accepts and retains explicitly undefined object fields that the old schema rejected. assertRuntimeValue treats those fields as absent during JSON validation.
Was this helpful? React with 👍 or 👎 to provide feedback.
The
exectool declaresinput, for callable backends, as an object of JSON values through a recursive Zod schema. A recursive schema can't be inlined, soz.toJSONSchema()emits it as a$refinto adefinitionssection, even withreused: "inline":toPiParametersasks for inlined schemas because some providers reject$refpointers, so the pi tool set sends exactly what it means to avoid. A consumer that hit this rewrote the declaration itself, swappinginputfor{ "type": "object" }and deletingdefinitions.This declares
inputas an object of any values and checks the values with the runtime's ownassertRuntimeValuewhen the call is validated. The tool still refuses, at its own boundary, an input the backend would refuse (NaN, aDate, a function), and the declaration is still a real object schema rather than the empty one that d6cc552 moved away from. The same schema backs the AI SDK, TanStack and pi tool sets.Testing
exec.test.tschecks that the declaration has no$refordefinitionsand thatinputis an object, and that nested JSON passes whileNaN, aDate, a function and an array don't.