Skip to content

Function: defineToolset()

Makaio Framework


Makaio Framework / tools-core / 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)

TTools extends ToolsInput

Input tools type (record, single, or array)

DefineToolsetConfig<TTools>

Toolset configuration

Toolset<ExtractToolsRecord<TTools>>

Toolset with normalized tools record

// 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 tool
const singleToolset = defineToolset({
name: 'echo',
description: 'Echo utility',
version: '1.0.0',
tools: echoTool,
});
// With an array
const arrayToolset = defineToolset({
name: 'utilities',
description: 'Utility tools',
version: '1.0.0',
tools: [echoTool, sleepTool, dateTool],
});