Class: ToolRegistry
Makaio Framework / services-core / ToolRegistry
Class: ToolRegistry
Section titled “Class: ToolRegistry”Defined in: ../../../packages/services/core/src/tools/tool-registry.ts:57
Central registry for tools and toolsets.
Manages registration, lookup, and execution with bus integration.
Emits lifecycle events (registered, started, completed, error) for observability.
Emits registryChanged with a monotonically increasing revision whenever the set of
registered toolsets changes, allowing consumers to invalidate stale tool lists.
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new ToolRegistry(
options?):ToolRegistry
Defined in: ../../../packages/services/core/src/tools/tool-registry.ts:70
Creates a new ToolRegistry with optional configuration.
Parameters
Section titled “Parameters”options?
Section titled “options?”Registry configuration options
Returns
Section titled “Returns”ToolRegistry
Methods
Section titled “Methods”deregister()
Section titled “deregister()”deregister(
toolsetName):Promise<void>
Defined in: ../../../packages/services/core/src/tools/tool-registry.ts:166
Deregisters a toolset and all its tools. Emits tool.registryChanged event.
Parameters
Section titled “Parameters”toolsetName
Section titled “toolsetName”string
Name of the toolset to deregister
Returns
Section titled “Returns”Promise<void>
Throws
Section titled “Throws”Error if the toolset is not registered
destroy()
Section titled “destroy()”destroy():
void
Defined in: ../../../packages/services/core/src/tools/tool-registry.ts:500
Destroy this registry — alias for dispose to satisfy the package service lifecycle contract.
Returns
Section titled “Returns”void
dispose()
Section titled “dispose()”dispose():
void
Defined in: ../../../packages/services/core/src/tools/tool-registry.ts:489
Cleans up registry resources. Unsubscribes all bus handlers.
Returns
Section titled “Returns”void
execute()
Section titled “execute()”execute(
toolName,input,options?):Promise<ToolResult<unknown>>
Defined in: ../../../packages/services/core/src/tools/tool-registry.ts:211
Executes a tool by name with the given input.
Validates input against the tool’s schema, enforces policy, executes the tool, and emits lifecycle events (started, completed/error). Constraints are enriched with file access rules before the tool receives its context.
Parameters
Section titled “Parameters”toolName
Section titled “toolName”string
Name of the tool to execute
unknown
Input data (validated against tool’s inputSchema)
options?
Section titled “options?”ExecuteOptions
Optional execution options (context overrides, adapter identity)
Returns
Section titled “Returns”Promise<ToolResult<unknown>>
Tool execution result (success with data or failure with error)
getTool()
Section titled “getTool()”getTool(
name):AnyToolDefinition|undefined
Defined in: ../../../packages/services/core/src/tools/tool-registry.ts:477
Gets a tool definition by name.
Parameters
Section titled “Parameters”string
Tool name to look up
Returns
Section titled “Returns”AnyToolDefinition | undefined
Tool definition or undefined if not found
getToolset()
Section titled “getToolset()”getToolset(
name):Toolset<Record<string,AnyToolDefinition>> |undefined
Defined in: ../../../packages/services/core/src/tools/tool-registry.ts:485
Gets a toolset by name.
Parameters
Section titled “Parameters”string
Toolset name to look up
Returns
Section titled “Returns”Toolset<Record<string, AnyToolDefinition>> | undefined
Toolset or undefined if not found
listTools()
Section titled “listTools()”listTools(
filter?):ToolInfo[]
Defined in: ../../../packages/services/core/src/tools/tool-registry.ts:390
Lists all registered tools with optional filtering.
Parameters
Section titled “Parameters”filter?
Section titled “filter?”Optional filter criteria
Returns
Section titled “Returns”ToolInfo[]
Array of tool information
listToolsets()
Section titled “listToolsets()”listToolsets():
ToolsetInfo[]
Defined in: ../../../packages/services/core/src/tools/tool-registry.ts:421
Lists all registered toolsets with metadata including configSchema as JSON Schema.
Returns
Section titled “Returns”Array of toolset information
listToolsWithToolsets()
Section titled “listToolsWithToolsets()”listToolsWithToolsets(
filter?):Promise<ToolsWithToolsetsResult>
Defined in: ../../../packages/services/core/src/tools/tool-registry.ts:449
Lists tools and toolsets with optional filtering. Applies policy filtering when adapterName is provided.
Parameters
Section titled “Parameters”filter?
Section titled “filter?”Optional filter criteria
Returns
Section titled “Returns”Promise<ToolsWithToolsetsResult>
Object containing tools array and toolsets array
register()
Section titled “register()”register(
toolset):Promise<void>
Defined in: ../../../packages/services/core/src/tools/tool-registry.ts:114
Registers a toolset. All tools are indexed by name. Emits tool.registered event.
Parameters
Section titled “Parameters”toolset
Section titled “toolset”Toolset to register
Returns
Section titled “Returns”Promise<void>