This commit is contained in:
2026-08-08 08:51:07 +07:00
parent c1ef544734
commit 04e75e61b8
6 changed files with 69 additions and 20 deletions
+5 -5
View File
@@ -5,7 +5,7 @@ Tools can be loaded dynamically from `.jl` files in the `src/tools/` directory w
## How It Works
1. `src/tools/registry.jl` defines a `loadTools(dir::String)` function that scans a directory for `.jl` files
2. Each tool file must define a single function: `getTool() :: agentTool`
2. Each tool file must define a single function: `getTool()::agentTool`
3. `loadTools()` sorts files alphabetically, includes each one, calls `getTool()`, and registers the result
4. Loaded tools are returned as `Vector{agentTool}` for use when constructing a `yiemAgent`
@@ -15,7 +15,7 @@ Tools can be loaded dynamically from `.jl` files in the `src/tools/` directory w
src/
├── tools/
│ ├── registry.jl # Tool loader (do not edit)
│ ├── get_weather.jl # Your tool
│ ├── getWeather.jl # Your tool
│ └── query_db.jl # Another tool
├── type.jl
├── utils.jl
@@ -29,10 +29,10 @@ src/
Each `.jl` file in `src/tools/` must define `getTool()` returning an `agentTool`:
```julia
# src/tools/get_weather.jl
function getTool() :: agentTool
# src/tools/getWeather.jl
function getTool()::agentTool
return agentTool(
name = "get_weather",
name = "getWeather",
label = "Weather Lookup",
description = "Fetch current weather and forecast for a given city.",
inputSchema = Dict{String,Any}(