feat(google): Native grounding, builtin tools, Gemini tools & MCP support#159
feat(google): Native grounding, builtin tools, Gemini tools & MCP support#159olivier-lacroix wants to merge 9 commits intoowndev:mainfrom
Conversation
…tion This change enables native Google Search and URL Context grounding when function calling is active, eliminating the need for the external google_search_tool filter. Documentation has been updated to reflect this new mechanism.
|
@owndev what do you think of these changes? they are breaking changes, but hopefully for the better :). Something I have not added to the doc: it does allow users to define tools that return a |
|
I'll take a look. I have tested it with Egnyte MCP. |
|
Ah so you definitely need to activate the tool explicitly in the chat, with native mode enabled. otherwise, the mcp session is not passed to the genai SDK |
|
Yeah, I do have this sometimes. I had not realised it was linked to streaming. Is this linked to MCP tools you think? An alternative, rather than passing the mcp session, would be to pass the individual mcp tools. on the pros side, this would honor the OWUI whitelist. on the cons side, it requires to add the right signature to the tools, as they come with no type hinting whatsoever. I had a working proto that did this. I thought it may be more brittle, but maybe genai handling of MCP is no that robust... |
7552e7b to
5e9ffd9
Compare
|
@owndev I have switched the approach for MCP tools to adding them as regular callable tools, rather than passing the MCP session object. let me know if that works better for you? |
|
It's still not working for me in native mode. But as long as it works in default mode, it doesn't matter to me. Is it working for you? Could it be an MCP server issue or a Gemini problem, and not the pipeline itself? |
|
Should we enforce gen_config_params["tool_config"] = types.ToolConfig(
include_server_side_tool_invocations=True
) |
I don't see why @flueckiger ? All callable tools are executed client side |
I encountered the following error when running Error during streaming: 400 Bad Request. {'message': '{\n "error": {\n "code": 400,\n "message": "Please enable tool_config.include_server_side_tool_invocations to use Built-in tools with Function calling.",\n "status": "INVALID_ARGUMENT"\n }\n}\n', 'status': 'Bad Request'} |





This PR refactors how Gemini-specific tools (like Vertex AI Search) are integrated into the pipeline, introducing a generic mechanism for native Gemini features.
pipelines/google/google_gemini.pythat automatically detects and executes Open WebUI tools with atypes.Toolreturn type hint. These tools are executed locally, and their output is passed directly to the Gemini API as a native tool. This architecture replaces specialized, hardcoded logic blocks with a uniform loop, making the pipeline cleaner and more extensible.tools/vertex_ai_search.py.UrlContext&GoogleSearchtools replace the OWUI builtin toolsfetch_urlandsearch_web. No need for a filter anymore.VERTEX_AI_RAG_STORE) to the respective tool valves, reducing clutter in the main Gemini pipeline.docs/google-gemini-integration.mdto reflect the new architecture and tool-based grounding configuration.These rely on getting tools from
__metadata__["tools"]and MCP clients from__metadata__["mcp_clients"]rather than__tools__, as__tools__only contains user defined tools for now. This requires function calling to be set to native to work properly.