src.tools.core.utils.tool_builder.create_tool_from_config(tool_def, discovered_tools=None)
Create and return an instance of a tool based on its configuration.
Supports two modes:
- Custom tools: Directly instantiate by name from discovered tools
- Config-based tools: Create based on base_tool + configuration
Parameters:
Name | Type | Description | Default |
---|---|---|---|
tool_def
|
dict
|
A dictionary containing tool configuration. Expected keys:
|
required |
discovered_tools
|
Optional[Dict[str, Type[BaseTool]]]
|
A mapping from tool names to tool classes, typically provided by discover_custom_tools(). |
None
|
Returns:
Name | Type | Description |
---|---|---|
BaseTool |
BaseTool
|
An instantiated tool configured as specified. |
Source code in src/tools/core/utils/tool_builder.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
|