update
This commit is contained in:
@@ -11,17 +11,17 @@ const _registry = Vector{agentTool}()
|
||||
Load all tool modules from a directory.
|
||||
|
||||
Scans `dir` for `.jl` files. Each file must define a function named
|
||||
`getTool() :: agentTool`. Files are sorted alphabetically so tool
|
||||
`getTool()::agentTool`. Files are sorted alphabetically so tool
|
||||
registration order is deterministic.
|
||||
|
||||
# Tool file format
|
||||
Each `.jl` file defines one function `getTool()` that returns 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}(
|
||||
@@ -72,10 +72,10 @@ function loadTools(dir::String)::Vector{agentTool}
|
||||
include(filepath)
|
||||
|
||||
# Validate that getTool was defined (include() places it in current module scope)
|
||||
if !isdefined(:getTool)
|
||||
if !isdefined(@__MODULE__, :getTool)
|
||||
throw(ArgumentError(
|
||||
"Tool file $(filepath) does not define a `getTool()` function. " *
|
||||
"Each tool file must define: function getTool() :: agentTool ... end"
|
||||
"Each tool file must define: function getTool()::agentTool ... end"
|
||||
))
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user