Function: adaptTools()
adaptTools(
tools):ITool<any,any>[]
Defined in: packages/agentos/src/api/runtime/toolAdapter.ts:294
Converts supported tool inputs into an array of ITool instances
suitable for use with the AgentOS provider layer.
- Existing
IToolinstances (identified byinputSchema+idproperties) are passed through unchanged. - Plain
ToolDefinitionobjects are wrapped in a minimalIToolimplementation. Zod schemas are converted to JSON Schema whenzod-to-json-schemais available. - ExternalToolRegistry inputs are adapted into executable
IToolinstances, preserving any prompt metadata they expose. ToolDefinitionForLLM[]arrays are treated as prompt-only schemas and produce tools that fail explicitly when invoked without an executor.
Parameters
tools
Optional map of tool names to definitions. Returns [] when falsy.
AdaptableToolInput | undefined
Returns
ITool<any, any>[]
Flat array of normalised ITool instances ready for provider dispatch.
Example
const tools = adaptTools({
getWeather: {
description: 'Returns current weather for a city.',
parameters: { type: 'object', properties: { city: { type: 'string' } }, required: ['city'] },
execute: async ({ city }) => fetchWeather(city),
},
});