Skip to content

feat(tools): add fromJsonSchema helper for FunctionTool#735

Open
tristanreid wants to merge 1 commit intostrands-agents:mainfrom
tristanreid:feat/from-json-schema
Open

feat(tools): add fromJsonSchema helper for FunctionTool#735
tristanreid wants to merge 1 commit intostrands-agents:mainfrom
tristanreid:feat/from-json-schema

Conversation

@tristanreid
Copy link
Copy Markdown

Description

Adds fromJsonSchema(), a small factory for building a FunctionTool when your tool definitions already use a schema field instead of inputSchema. It maps schemainputSchema and delegates to the existing constructor, so behavior matches new FunctionTool({ … }) exactly.

Also introduces FromJsonSchemaConfig and exports fromJsonSchema and FromJsonSchemaConfig from the package entry point.

Unit test asserts parity with the constructor for name, description, and toolSpec.

Type of change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update
  • Other (please describe)

Testing

  • npm run check (with Node v20.19.6; Vitest/Rolldown require ≥ 20.19 per engine fields)

Checklist

  • I have read the CONTRIBUTING document
  • I have added tests that prove the feature works
  • I have updated the documentation accordingly (JSDoc on the new API; shout if you want README/examples too)
  • I have added an example to the documentation, or no new docs are needed
  • My changes generate no new warnings (npm run check)
  • Any dependent changes have been merged and published

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.


- FromJsonSchemaConfig mirrors FunctionToolConfig with schema alias for inputSchema
- Export from main entry with unit test parity vs constructor

Made-with: Cursor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant