File tree Expand file tree Collapse file tree
src/uipath_langchain/agent/tools Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -47,12 +47,26 @@ def validate_and_apply_tool_filter(
4747 agent_tools: The agent's client-side tools.
4848 Dict of {tool_name: ClientSideToolInfo}.
4949 """
50- declared = {
51- (t ["name" ] if isinstance (t , dict ) else t ): t
52- if isinstance (t , dict )
53- else {"name" : t }
54- for t in declared_tools
55- }
50+ declared : dict [str , dict [str , Any ]] = {}
51+ for i , t in enumerate (declared_tools ):
52+ if isinstance (t , dict ):
53+ if "name" not in t :
54+ raise ValueError (
55+ f"Client-side tool declaration at index { i } is missing required 'name' field."
56+ )
57+ name = t ["name" ]
58+ elif isinstance (t , str ):
59+ name = t
60+ t = {"name" : t }
61+ else :
62+ raise ValueError (
63+ f"Client-side tool declaration at index { i } must be a dict or string, got { type (t ).__name__ } ."
64+ )
65+ if name in declared :
66+ raise ValueError (
67+ f"Duplicate client-side tool declaration: '{ name } '."
68+ )
69+ declared [name ] = t
5670
5771 required = set (agent_tools .keys ())
5872 missing = required - set (declared .keys ())
You can’t perform that action at this time.
0 commit comments