TanStack AI version
v0.4.2
Framework/Library version
React v19.2.0, Arktype v2.1.28
Describe the bug and the steps to reproduce it
convertSchemaToJsonSchema returns a function instead of object. I ran into this while trying to use the openrouter adapter. The openrouter sdk does it's own validation and did not accept the tool schema.
import { type } from "arktype";
import { convertSchemaToJsonSchema } from "@tanstack/ai";
describe("convertSchemaToJsonSchema", () => {
it("returns an object", () => {
const schema = type({
foo: "boolean",
});
const jsonschema = convertSchemaToJsonSchema(schema);
expect(typeof jsonschema).toEqual("object");
// Expected: "object"
// Received: "function"
});
});
In the meantime, this works for me:
import type { JSONSchema } from "@tanstack/ai";
import { type } from "arktype";
const inputSchema = type({
foo: 'boolean'
}).toJsonSchema() as JSONSchema;
// toolDefinition...
Related: https://arktype.io/docs/type-api#tojsonschema
Your Minimal, Reproducible Example - (Sandbox Highly Recommended)
see the test included in issue
Screenshots or Videos (Optional)
No response
Do you intend to try to help solve this bug with your own PR?
None
Terms & Code of Conduct
TanStack AI version
v0.4.2
Framework/Library version
React v19.2.0, Arktype v2.1.28
Describe the bug and the steps to reproduce it
convertSchemaToJsonSchemareturns a function instead of object. I ran into this while trying to use the openrouter adapter. The openrouter sdk does it's own validation and did not accept the tool schema.In the meantime, this works for me:
Related: https://arktype.io/docs/type-api#tojsonschema
Your Minimal, Reproducible Example - (Sandbox Highly Recommended)
see the test included in issue
Screenshots or Videos (Optional)
No response
Do you intend to try to help solve this bug with your own PR?
None
Terms & Code of Conduct