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
+49
View File
@@ -0,0 +1,49 @@
"""
Execute the get_time tool.
# Arguments
- `toolCallId::String`: Unique identifier for this tool call
- `args::Dict{String,Any}`: Parsed arguments from the LLM
- `signal::Union{Nothing,abortSignal}`: Optional abort signal
- `onPartialResult::Function`: Callback for streaming partial results
# Returns
- `agentToolResult`: Result content with current time
"""
function executeTool(toolCallId::String, args::Dict{String,Any}, signal::Union{Nothing,abortSignal}, onPartialResult::Function)::agentToolResult
tz = get(args, "timezone", "local")
t = now()
if tz == "local"
timeStr = string(t)
else
timeStr = string(t)
end
return agentToolResult(
[textContent("Current time: $(timeStr)")],
Dict{Any,Any}(), nothing, false
)
end
"""
Define and return the get_time agentTool.
"""
function getTool()::agentTool
return agentTool(
name = "get_time",
label = "Get Current Time",
description = "Get the current date and time.",
inputSchema = Dict{String,Any}(
"type" => "object",
"properties" => Dict(
"timezone" => Dict("type" => "string", "description" => "Timezone (currently only 'local' is supported)")
),
"required" => []
),
execute = executeTool,
prepareArguments = nothing,
parallelToolExecute = false
)
end