Skip to content

Commit a775fc9

Browse files
committed
refac
1 parent f9ceb7f commit a775fc9

2 files changed

Lines changed: 5 additions & 13 deletions

File tree

backend/open_webui/functions.py

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
load_function_module_by_id,
3535
get_function_module_from_cache,
3636
)
37-
from open_webui.utils.tools import get_tools
3837

3938
from open_webui.env import GLOBAL_LOG_LEVEL
4039

@@ -255,17 +254,7 @@ def get_function_params(function_module, form_data, user, extra_params=None):
255254
'__oauth_token__': oauth_token,
256255
'__request__': request,
257256
}
258-
extra_params['__tools__'] = await get_tools(
259-
request,
260-
tool_ids,
261-
user,
262-
{
263-
**extra_params,
264-
'__model__': models.get(form_data['model'], None),
265-
'__messages__': form_data['messages'],
266-
'__files__': files,
267-
},
268-
)
257+
extra_params['__tools__'] = metadata.get('tools', {})
269258

270259
if model_info:
271260
if model_info.base_model_id:

backend/open_webui/utils/middleware.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2680,9 +2680,12 @@ async def tool_function(**kwargs):
26802680
tools_dict[name] = tool_dict
26812681

26822682
if tools_dict:
2683+
# Always store resolved tools in metadata so downstream consumers
2684+
# (e.g. pipe functions) can access all tools including MCP and builtins.
2685+
metadata['tools'] = tools_dict
2686+
26832687
if metadata.get('params', {}).get('function_calling') == 'native':
26842688
# If the function calling is native, then call the tools function calling handler
2685-
metadata['tools'] = tools_dict
26862689
form_data['tools'] = [
26872690
{'type': 'function', 'function': tool.get('spec', {})} for tool in tools_dict.values()
26882691
]

0 commit comments

Comments
 (0)