Skip to content

Commit 1805bf1

Browse files
authored
Fix tool schema caching
2 parents d6dba56 + ccb37f1 commit 1805bf1

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/agent/src/compiler/compiler.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ local function process_tools(raw_spec, additional_tools, trait_contexts, trait_t
294294

295295
if tool_info.inline_schema then
296296
tool_entry.description = tool_info.description or ("Inline tool: " .. canonical_name)
297-
tool_entry.schema = get_tools().run_input_schema_processors(tool_info.inline_schema, tool_info.id)
297+
tool_entry.schema = get_tools().run_input_schema_processors(tool_info.inline_schema, tool_info.id, canonical_name)
298298
tool_entry.registry_id = tool_info.id -- FIX: Preserve registry_id even with inline schema
299299
tool_entry.meta = {}
300300
else

src/agent/src/discovery/tools.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ local function sanitize_name(name)
5555
end
5656

5757
-- Process the input schema using registered processors
58-
function tool_resolver.run_input_schema_processors(input_schema, tool_id)
58+
function tool_resolver.run_input_schema_processors(input_schema, tool_id, tool_name)
5959
local registry = get_registry()
6060

6161
local processors = registry.find({ [".kind"] = "function.lua", ["meta.type"] = "input_schema_processor" })
@@ -65,7 +65,7 @@ function tool_resolver.run_input_schema_processors(input_schema, tool_id)
6565
end
6666

6767
-- Use specific cache key for this tool
68-
local cache_key = input_schema_cache_key_prefix .. tool_id
68+
local cache_key = input_schema_cache_key_prefix .. tool_id .. (tool_name and (":" .. tool_name) or "")
6969
local storeObj = nil
7070

7171
-- Try to get from cache
@@ -251,7 +251,7 @@ function tool_resolver.get_tool_schema(tool_id)
251251
name = display_name,
252252
title = entry.meta.title or display_name,
253253
description = description,
254-
schema = tool_resolver.run_input_schema_processors(schema, tool_id), -- Process input schema (cached separately)
254+
schema = tool_resolver.run_input_schema_processors(schema, tool_id, display_name), -- Process input schema (cached separately)
255255
meta = filter_meta_for_llm(entry.meta) -- Filter out redundant fields
256256
}
257257

0 commit comments

Comments
 (0)