Skip to content

issue: Support for gemini? #141

Description

@andaag

Check Existing Issues

  • I have searched the existing issues and discussions.
  • I am using the latest version of mcpo.

mcpo Version

0.0.14

Open WebUI Version (if applicable)

v0.6.9

Operating System

Docker on GCP machines

Browser (if applicable)

No response

Confirmation

  • I have read and followed all instructions in README.md.
  • I am using the latest version of both MCPO and Open WebUI.
  • I have included the browser console logs.
  • I have included the Docker container logs.
  • I have listed steps to reproduce the bug in detail.

Expected Behavior

Trying to wire this up with gemini 2.5 pro. I've enabled native calling there and hooked in my mcp, but I dont see any way of debugging what payload actually gets sent to gemini? What tools is it attempting to run?

My assumption is that it's some field that gemini doesn't like, but that's very hard to debug at the moment.

In the ui if I go in and query the url for the tool server I can load the definition for the tool just fine.

Actual Behavior

400: Open WebUI: Server Connection Error

Steps to Reproduce

  1. Enable gemini 2.5 pro with native function calling mode and link in an mcp

Logs & Screenshots

2025-05-15 13:41:14.744 | ERROR    | open_webui.routers.openai:generate_chat_completion:755 - 400, message='Bad Request', url='https://generativelanguage.googleapis.com/v1beta/openai/chat/completions' - {}
Traceback (most recent call last):

  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/usr/local/lib/python3.11/site-packages/uvicorn/__main__.py", line 4, in <module>
    uvicorn.main()
    │       └ <Command main>
    └ <module 'uvicorn' from '/usr/local/lib/python3.11/site-packages/uvicorn/__init__.py'>
  File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1161, in __call__
    return self.main(*args, **kwargs)
           │    │     │       └ {}
           │    │     └ ()
           │    └ <function BaseCommand.main at 0x7f54f7d6a5c0>
           └ <Command main>
  File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1082, in main
    rv = self.invoke(ctx)
         │    │      └ <click.core.Context object at 0x7f54f8ac0dd0>
         │    └ <function Command.invoke at 0x7f54f7d6b1a0>
         └ <Command main>
  File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1443, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           │   │      │    │           │   └ {'host': '0.0.0.0', 'port': 8080, 'forwarded_allow_ips': '*', 'workers': 1, 'app': 'open_webui.main:app', 'uds': None, 'fd': ...
           │   │      │    │           └ <click.core.Context object at 0x7f54f8ac0dd0>
           │   │      │    └ <function main at 0x7f54f79b9da0>
           │   │      └ <Command main>
           │   └ <function Context.invoke at 0x7f54f7d69b20>
           └ <click.core.Context object at 0x7f54f8ac0dd0>
  File "/usr/local/lib/python3.11/site-packages/click/core.py", line 788, in invoke
    return __callback(*args, **kwargs)
                       │       └ {'host': '0.0.0.0', 'port': 8080, 'forwarded_allow_ips': '*', 'workers': 1, 'app': 'open_webui.main:app', 'uds': None, 'fd': ...
                       └ ()
  File "/usr/local/lib/python3.11/site-packages/uvicorn/main.py", line 412, in main
    run(
    └ <function run at 0x7f54f7df4720>
  File "/usr/local/lib/python3.11/site-packages/uvicorn/main.py", line 579, in run
    server.run()
    │      └ <function Server.run at 0x7f54f7c49b20>
    └ <uvicorn.server.Server object at 0x7f54f7c751d0>
  File "/usr/local/lib/python3.11/site-packages/uvicorn/server.py", line 66, in run
    return asyncio.run(self.serve(sockets=sockets))
           │       │   │    │             └ None
           │       │   │    └ <function Server.serve at 0x7f54f7c49bc0>
           │       │   └ <uvicorn.server.Server object at 0x7f54f7c751d0>
           │       └ <function run at 0x7f54f816d300>
           └ <module 'asyncio' from '/usr/local/lib/python3.11/asyncio/__init__.py'>
  File "/usr/local/lib/python3.11/asyncio/runners.py", line 190, in run
    return runner.run(main)
           │      │   └ <coroutine object Server.serve at 0x7f54f7b8e6b0>
           │      └ <function Runner.run at 0x7f54f7fb8ea0>
           └ <asyncio.runners.Runner object at 0x7f54f79db750>
  File "/usr/local/lib/python3.11/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           │    │     │                  └ <Task pending name='Task-1' coro=<Server.serve() running at /usr/local/lib/python3.11/site-packages/uvicorn/server.py:70> wai...
           │    │     └ <cyfunction Loop.run_until_complete at 0x7f54f7a11490>
           │    └ <uvloop.Loop running=True closed=False debug=False>
           └ <asyncio.runners.Runner object at 0x7f54f79db750>
  File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 141, in coro
    await self.app(scope, receive_or_disconnect, send_no_error)
          │    │   │      │                      └ <function BaseHTTPMiddleware.__call__.<locals>.call_next.<locals>.send_no_error at 0x7f54974544a0>
          │    │   │      └ <function BaseHTTPMiddleware.__call__.<locals>.call_next.<locals>.receive_or_disconnect at 0x7f5497454fe0>
          │    │   └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('10.25.128.145', 8080),...
          │    └ <starlette.middleware.exceptions.ExceptionMiddleware object at 0x7f549794a810>
          └ <open_webui.main.RedirectMiddleware object at 0x7f5495e9e750>
  File "/usr/local/lib/python3.11/site-packages/starlette/middleware/exceptions.py", line 62, in __call__
    await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
          │                            │    │    │     │      │        └ <function BaseHTTPMiddleware.__call__.<locals>.call_next.<locals>.send_no_error at 0x7f54974544a0>
          │                            │    │    │     │      └ <function BaseHTTPMiddleware.__call__.<locals>.call_next.<locals>.receive_or_disconnect at 0x7f5497454fe0>
          │                            │    │    │     └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('10.25.128.145', 8080),...
          │                            │    │    └ <starlette.requests.Request object at 0x7f5495d12050>
          │                            │    └ <fastapi.routing.APIRouter object at 0x7f54bffe8a50>
          │                            └ <starlette.middleware.exceptions.ExceptionMiddleware object at 0x7f549794a810>
          └ <function wrap_app_handling_exceptions at 0x7f54f4f05080>
  File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
    await app(scope, receive, sender)
          │   │      │        └ <function wrap_app_handling_exceptions.<locals>.wrapped_app.<locals>.sender at 0x7f5497454860>
          │   │      └ <function BaseHTTPMiddleware.__call__.<locals>.call_next.<locals>.receive_or_disconnect at 0x7f5497454fe0>
          │   └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('10.25.128.145', 8080),...
          └ <fastapi.routing.APIRouter object at 0x7f54bffe8a50>
  File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 715, in __call__
    await self.middleware_stack(scope, receive, send)
          │    │                │      │        └ <function wrap_app_handling_exceptions.<locals>.wrapped_app.<locals>.sender at 0x7f5497454860>
          │    │                │      └ <function BaseHTTPMiddleware.__call__.<locals>.call_next.<locals>.receive_or_disconnect at 0x7f5497454fe0>
          │    │                └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('10.25.128.145', 8080),...
          │    └ <bound method Router.app of <fastapi.routing.APIRouter object at 0x7f54bffe8a50>>
          └ <fastapi.routing.APIRouter object at 0x7f54bffe8a50>
  File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 735, in app
    await route.handle(scope, receive, send)
          │     │      │      │        └ <function wrap_app_handling_exceptions.<locals>.wrapped_app.<locals>.sender at 0x7f5497454860>
          │     │      │      └ <function BaseHTTPMiddleware.__call__.<locals>.call_next.<locals>.receive_or_disconnect at 0x7f5497454fe0>
          │     │      └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('10.25.128.145', 8080),...
          │     └ <function Route.handle at 0x7f54f4f06700>
          └ APIRoute(path='/api/chat/completions', name='chat_completion', methods=['POST'])
  File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 288, in handle
    await self.app(scope, receive, send)
          │    │   │      │        └ <function wrap_app_handling_exceptions.<locals>.wrapped_app.<locals>.sender at 0x7f5497454860>
          │    │   │      └ <function BaseHTTPMiddleware.__call__.<locals>.call_next.<locals>.receive_or_disconnect at 0x7f5497454fe0>
          │    │   └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('10.25.128.145', 8080),...
          │    └ <function request_response.<locals>.app at 0x7f549789e020>
          └ APIRoute(path='/api/chat/completions', name='chat_completion', methods=['POST'])
  File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 76, in app
    await wrap_app_handling_exceptions(app, request)(scope, receive, send)
          │                            │    │        │      │        └ <function wrap_app_handling_exceptions.<locals>.wrapped_app.<locals>.sender at 0x7f5497454860>
          │                            │    │        │      └ <function BaseHTTPMiddleware.__call__.<locals>.call_next.<locals>.receive_or_disconnect at 0x7f5497454fe0>
          │                            │    │        └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('10.25.128.145', 8080),...
          │                            │    └ <starlette.requests.Request object at 0x7f54974b9bd0>
          │                            └ <function request_response.<locals>.app.<locals>.app at 0x7f54974563e0>
          └ <function wrap_app_handling_exceptions at 0x7f54f4f05080>
  File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
    await app(scope, receive, sender)
          │   │      │        └ <function wrap_app_handling_exceptions.<locals>.wrapped_app.<locals>.sender at 0x7f5497455b20>
          │   │      └ <function BaseHTTPMiddleware.__call__.<locals>.call_next.<locals>.receive_or_disconnect at 0x7f5497454fe0>
          │   └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('10.25.128.145', 8080),...
          └ <function request_response.<locals>.app.<locals>.app at 0x7f54974563e0>
  File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 73, in app
    response = await f(request)
                     │ └ <starlette.requests.Request object at 0x7f54974b9bd0>
                     └ <function get_request_handler.<locals>.app at 0x7f549789dd00>
  File "/usr/local/lib/python3.11/site-packages/fastapi/routing.py", line 301, in app
    raw_response = await run_endpoint_function(
                         └ <function run_endpoint_function at 0x7f54f4f18540>
  File "/usr/local/lib/python3.11/site-packages/fastapi/routing.py", line 212, in run_endpoint_function
    return await dependant.call(**values)
                 │         │      └ {'user': UserModel(id='c3c3a0a3-a866-49d6-8d7d-11948cf81415', name='accounts.google.com:my_email@email.com', email='acc...
                 │         └ <function chat_completion at 0x7f5497730680>
                 └ Dependant(path_params=[], query_params=[], header_params=[], cookie_params=[], body_params=[ModelField(field_info=Body(Pydant...

  File "/app/backend/open_webui/main.py", line 1214, in chat_completion
    response = await chat_completion_handler(request, form_data, user)
                     │                       │        │          └ UserModel(id='c3c3a0a3-a866-49d6-8d7d-11948cf81415', name='accounts.google.com:my_email@email.com', email='accounts.goo...
                     │                       │        └ {'stream': True, 'model': 'models/gemini-2.5-pro-preview-05-06', 'messages': [{'role': 'user', 'content': 'run a select 1 on ...
                     │                       └ <starlette.requests.Request object at 0x7f54974b9bd0>
                     └ <function generate_chat_completion at 0x7f54c3726de0>

  File "/app/backend/open_webui/utils/chat.py", line 275, in generate_chat_completion
    return await generate_openai_chat_completion(
                 └ <function generate_chat_completion at 0x7f54c3724720>

> File "/app/backend/open_webui/routers/openai.py", line 752, in generate_chat_completion
    r.raise_for_status()
    │ └ <function ClientResponse.raise_for_status at 0x7f54f594fc40>
    └ <ClientResponse(https://generativelanguage.googleapis.com/v1beta/openai/chat/completions) [400 Bad Request]>
      <CIMultiDictProx...

  File "/usr/local/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 1161, in raise_for_status
    raise ClientResponseError(
          └ <class 'aiohttp.client_exceptions.ClientResponseError'>

aiohttp.client_exceptions.ClientResponseError: 400, message='Bad Request', url='https://generativelanguage.googleapis.com/v1beta/openai/chat/completions'
{"stream":true,"model":"models/gemini-2.5-pro-preview-05-06","messages":[{"role":"user","content":"run a select 1 on batch-prod"}],"params":{},"tool_ids":["server:0"],"tool_servers":[],"features":{"image_generation":false,"code_interpreter":false,"web_search":false},"variables":{"{{USER_NAME}}":"accounts.google.com:my@email.com","{{USER_LOCATION}}":"Unknown","{{CURRENT_DATETIME}}":"2025-05-15 15:53:04","{{CURRENT_DATE}}":"2025-05-15","{{CURRENT_TIME}}":"15:53:04","{{CURRENT_WEEKDAY}}":"Thursday","{{CURRENT_TIMEZONE}}":"Europe/Oslo","{{USER_LANGUAGE}}":"en-US"},"model_item":{"id":"models/gemini-2.5-pro-preview-05-06","object":"model","owned_by":"openai","name":"models/gemini-2.5-pro-preview-05-06","openai":{"id":"models/gemini-2.5-pro-preview-05-06","object":"model","owned_by":"google"},"urlIdx":0,"info":{"id":"models/gemini-2.5-pro-preview-05-06","user_id":"c3c3a0a3-a866-49d6-8d7d-11948cf81435","base_model_id":null,"name":"models/gemini-2.5-pro-preview-05-06","params":{"function_calling":"native","stream_response":true},"meta":{"profile_image_url":"/static/favicon.png","description":null,"capabilities":{"vision":true,"citations":true},"suggestion_prompts":null,"tags":[]},"access_control":{"read":{"group_ids":[],"user_ids":[]},"write":{"group_ids":[],"user_ids":[]}},"is_active":true,"updated_at":1747316394,"created_at":1747316394},"actions":[],"tags":[]},"session_id":"wVBtGhGOzGUOf9l8AAAp","chat_id":"69a682fb-b153-43fd-90e4-1a5cf3d9ce30","id":"e562e266-88c7-4400-9781-c40be4bdbcc5","background_tasks":{"title_generation":true,"tags_generation":true}}

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions