Function: defineToolset()
Makaio Framework / tools-core / defineToolset
Function: defineToolset()
Section titled “Function: defineToolset()”defineToolset<
TTools>(config):Toolset<ExtractToolsRecord<TTools>>
Defined in: ../../../tools/core/src/define-toolset.ts:117
Creates a Toolset from a configuration object.
Provides flexibility in how tools are specified:
- As a record with explicit keys
- As a single tool (uses tool name as key)
- As an array of tools (uses each tool name as key)
Type Parameters
Section titled “Type Parameters”TTools
Section titled “TTools”TTools extends ToolsInput
Input tools type (record, single, or array)
Parameters
Section titled “Parameters”config
Section titled “config”DefineToolsetConfig<TTools>
Toolset configuration
Returns
Section titled “Returns”Toolset<ExtractToolsRecord<TTools>>
Toolset with normalized tools record
Example
Section titled “Example”// With a record (explicit keys)const fsToolset = defineToolset({ name: 'filesystem', description: 'File system operations', version: '1.0.0', tools: { read: readFileTool, write: writeFileTool, delete: deleteFileTool, },});
// With a single toolconst singleToolset = defineToolset({ name: 'echo', description: 'Echo utility', version: '1.0.0', tools: echoTool,});
// With an arrayconst arrayToolset = defineToolset({ name: 'utilities', description: 'Utility tools', version: '1.0.0', tools: [echoTool, sleepTool, dateTool],});