Class Toolset
Methods
[iterator]
-
Iterate the tools, so a toolset stands in for the array it holds.
Returns Iterator<Tool>
toAnthropic
-
Describe these tools for the Anthropic Messages API.
Definitions only — pair them with Toolset.call to run what the model asks for.
Returns AnthropicTool[]
One tool definition per operation.
toOpenAI
-
Describe these tools for the OpenAI Chat Completions API.
Definitions only — pair them with Toolset.call to run what the model asks for, which also takes the JSON string that API hands back. Anything speaking the same shape takes these too; the Responses API wants a flatter one and is not what this emits.
Returns OpenAITool[]
One tool definition per operation.
toLangChain
-
Hand these tools to LangChain.
@langchain/coretakes a JSON Schema wherever it takes a Zod schema — thetool()overload set namesJsonSchema7Typebeside the Zod ones — so the schema is passed through unchanged and this package needs no Zod dependency to build one.Returns Promise<any[]>
One LangChain tool per operation, ready for
createAgent({ tools }).
call
-
Run the tool a model named, and render what it returned.
Parameters
- name: string
The tool name the model used, which is untrusted.
- args: string | Record<string, unknown>
The arguments it sent, which are untrusted. An object, or the JSON text OpenAI hands back.
Returns Promise<string>
The result as text, or what the model got wrong. Nothing a model can send reaches the caller as an exception.
- name: string
Every memory operation as a tool, in the shape a framework wants it.
The
to*methods hand the same tools to a particular framework, and Toolset.call runs the one a model named — which is what the definition-only shapes need, since there the host dispatches rather than the framework.Example