[GH-ISSUE #19740] issue: How to pass a file or a file URL when invoking MCP? #18978

Closed
opened 2026-04-20 01:16:02 -05:00 by GiteaMirror · 4 comments
Owner

Originally created by @gongshaojie12 on GitHub (Dec 4, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/19740

Check Existing Issues

  • I have searched for any existing and/or related issues.
  • I have searched for any existing and/or related discussions.
  • I have also searched in the CLOSED issues AND CLOSED discussions and found no related items (your issue might already be addressed on the development branch!).
  • I am using the latest version of Open WebUI.

Installation Method

Pip Install

Open WebUI Version

0.6.41

Ollama Version (if applicable)

No response

Operating System

centos7

Browser (if applicable)

No response

Confirmation

  • I have read and followed all instructions in README.md.
  • I am using the latest version of both Open WebUI and Ollama.
  • I have included the browser console logs.
  • I have included the Docker container logs.
  • I have provided every relevant configuration, setting, and environment variable used in my setup.
  • I have clearly listed every relevant configuration, custom setting, environment variable, and command-line option that influences my setup (such as Docker Compose overrides, .env values, browser settings, authentication configurations, etc).
  • I have documented step-by-step reproduction instructions that are precise, sequential, and leave nothing to interpretation. My steps:
  • Start with the initial platform/version/OS and dependencies used,
  • Specify exact install/launch/configure commands,
  • List URLs visited, user input (incl. example values/emails/passwords if needed),
  • Describe all options and toggles enabled or changed,
  • Include any files or environmental changes,
  • Identify the expected and actual result at each stage,
  • Ensure any reasonably skilled user can follow and hit the same issue.

Expected Behavior

I created an agent in Dify that requires a file or a file URL as a parameter. After configuring this agent as an MCP tool in Open-WebUI, how can I pass a file or a file URL to the Dify agent when invoking it in Open-WebUI?

I expect to be able to pass a file or a file URL to the Dify agent in Open-WebUI.

Actual Behavior

It is not possible to pass a file or a file URL to the Dify MCP from Open-WebUI.

Steps to Reproduce

None

Logs & Screenshots

None

Additional Information

No response

Originally created by @gongshaojie12 on GitHub (Dec 4, 2025). Original GitHub issue: https://github.com/open-webui/open-webui/issues/19740 ### Check Existing Issues - [x] I have searched for any existing and/or related issues. - [x] I have searched for any existing and/or related discussions. - [x] I have also searched in the CLOSED issues AND CLOSED discussions and found no related items (your issue might already be addressed on the development branch!). - [x] I am using the latest version of Open WebUI. ### Installation Method Pip Install ### Open WebUI Version 0.6.41 ### Ollama Version (if applicable) _No response_ ### Operating System centos7 ### Browser (if applicable) _No response_ ### Confirmation - [x] I have read and followed all instructions in `README.md`. - [x] I am using the latest version of **both** Open WebUI and Ollama. - [x] I have included the browser console logs. - [x] I have included the Docker container logs. - [x] I have **provided every relevant configuration, setting, and environment variable used in my setup.** - [x] I have clearly **listed every relevant configuration, custom setting, environment variable, and command-line option that influences my setup** (such as Docker Compose overrides, .env values, browser settings, authentication configurations, etc). - [x] I have documented **step-by-step reproduction instructions that are precise, sequential, and leave nothing to interpretation**. My steps: - Start with the initial platform/version/OS and dependencies used, - Specify exact install/launch/configure commands, - List URLs visited, user input (incl. example values/emails/passwords if needed), - Describe all options and toggles enabled or changed, - Include any files or environmental changes, - Identify the expected and actual result at each stage, - Ensure any reasonably skilled user can follow and hit the same issue. ### Expected Behavior I created an agent in Dify that requires a file or a file URL as a parameter. After configuring this agent as an MCP tool in Open-WebUI, how can I pass a file or a file URL to the Dify agent when invoking it in Open-WebUI? I expect to be able to pass a file or a file URL to the Dify agent in Open-WebUI. ### Actual Behavior It is not possible to pass a file or a file URL to the Dify MCP from Open-WebUI. ### Steps to Reproduce None ### Logs & Screenshots None ### Additional Information _No response_
GiteaMirror added the bug label 2026-04-20 01:16:02 -05:00
Author
Owner

@owui-terminator[bot] commented on GitHub (Dec 4, 2025):

🔍 Similar Issues Found

I found some existing issues that might be related to this one. Please check if any of these are duplicates or contain helpful solutions:

  1. #19701 issue: knowledge can not multiple upload file
    by willy808 • Dec 03, 2025 • bug

  2. #14726 issue: When the LLM calls mcp tools that return image data, the front UI can not display the image
    by tangzhong1 • Jun 06, 2025 • bug

  3. #18981 issue: 0.6.35 error using tools through mcpo
    by GlisseManTV • Nov 06, 2025 • bug

  4. #16521 issue: web browser directory access mcpo openapi server
    by okamototk • Aug 12, 2025 • bug

  5. #19563 issue:
    by naruto7g • Nov 28, 2025 • bug

Show 5 more related issues
  1. #17808 issue: unexpected MCP tool response handling
    by dlamoris • Sep 27, 2025 • bug

  2. #15855 issue:
    by richtong • Jul 19, 2025 • bug

  3. #14767 issue:
    by TheMoye • Jun 07, 2025 • bug

  4. #13451 issue:
    by kinnerful • May 03, 2025 • bug

  5. #18041 issue: web search enabled and fetch MCP break rule 2 tools for the same function
    by gattytto • Oct 04, 2025 • bug


💡 Tips:

  • If this is a duplicate, please consider closing this issue and adding any additional details to the existing one
  • If you found a solution in any of these issues, please share it here to help others

This comment was generated automatically by a bot. Please react with a 👍 if this comment was helpful, or a 👎 if it was not.

<!-- gh-comment-id:3611035607 --> @owui-terminator[bot] commented on GitHub (Dec 4, 2025): 🔍 **Similar Issues Found** I found some existing issues that might be related to this one. Please check if any of these are duplicates or contain helpful solutions: 1. [#19701](https://github.com/open-webui/open-webui/issues/19701) **issue: knowledge can not multiple upload file** *by willy808 • Dec 03, 2025 • `bug`* 2. [#14726](https://github.com/open-webui/open-webui/issues/14726) **issue: When the LLM calls mcp tools that return image data, the front UI can not display the image** *by tangzhong1 • Jun 06, 2025 • `bug`* 3. [#18981](https://github.com/open-webui/open-webui/issues/18981) **issue: 0.6.35 error using tools through mcpo** *by GlisseManTV • Nov 06, 2025 • `bug`* 4. [#16521](https://github.com/open-webui/open-webui/issues/16521) **issue: web browser directory access mcpo openapi server** *by okamototk • Aug 12, 2025 • `bug`* 5. [#19563](https://github.com/open-webui/open-webui/issues/19563) **issue:** *by naruto7g • Nov 28, 2025 • `bug`* <details> <summary>Show 5 more related issues</summary> 6. [#17808](https://github.com/open-webui/open-webui/issues/17808) **issue: unexpected MCP tool response handling** *by dlamoris • Sep 27, 2025 • `bug`* 7. [#15855](https://github.com/open-webui/open-webui/issues/15855) **issue:** *by richtong • Jul 19, 2025 • `bug`* 8. [#14767](https://github.com/open-webui/open-webui/issues/14767) **issue:** *by TheMoye • Jun 07, 2025 • `bug`* 9. [#13451](https://github.com/open-webui/open-webui/issues/13451) **issue:** *by kinnerful • May 03, 2025 • `bug`* 10. [#18041](https://github.com/open-webui/open-webui/issues/18041) **issue: web search enabled and fetch MCP break rule 2 tools for the same function** *by gattytto • Oct 04, 2025 • `bug`* </details> --- 💡 **Tips:** - If this is a duplicate, please consider closing this issue and adding any additional details to the existing one - If you found a solution in any of these issues, please share it here to help others *This comment was generated automatically by a bot.* Please react with a 👍 if this comment was helpful, or a 👎 if it was not.
Author
Owner

@gongshaojie12 commented on GitHub (Dec 4, 2025):

The issues you mentioned are different from mine.

<!-- gh-comment-id:3611094649 --> @gongshaojie12 commented on GitHub (Dec 4, 2025): The issues you mentioned are different from mine.
Author
Owner

@rgaricano commented on GitHub (Dec 4, 2025):

You can attach it to chat, then it is going to be passed to MCP tools via the __files__ in extra_params.
e.g. for extract it:

async def your_mcp_tool_function(**kwargs):
    # The __files__ parameter contains file metadata
    files = kwargs.get('__files__', [])

    if files:
        for file_item in files:
            # Each file item contains metadata like:
            # - type: "file" or "url"
            # - url: direct URL to the file
            # - name: filename
            # - id: file ID in Open-WebUI

            if file_item.get('type') == 'file':
                file_url = file_item.get('url')
                file_name = file_item.get('name')

                # You can now use the file URL to download or process the file
                # For example, download the content:
                import httpx
                async with httpx.AsyncClient() as client:
                    response = await client.get(file_url)
                    file_content = response.content

                # Process the file content as needed
                # ...

            elif file_item.get('type') == 'url':
                # For URL-type files, the URL points to an external resource
                external_url = file_item.get('url')
                # Fetch and process the external URL content
                # ...

    # Continue with your tool logic
    return {"result": "Files processed successfully"}

Note:
If you cannot see the file list, try extracting them directly from __files__ instead of through kwargs:
async def your_mcp_tool_function(__files__: Optional[dict] = None, **kwargs):
files = __files__ if __files__ is not None else {}

<!-- gh-comment-id:3611135765 --> @rgaricano commented on GitHub (Dec 4, 2025): You can attach it to chat, then it is going to be passed to MCP tools via the ` __files__` in `extra_params`. e.g. for extract it: ``` async def your_mcp_tool_function(**kwargs): # The __files__ parameter contains file metadata files = kwargs.get('__files__', []) if files: for file_item in files: # Each file item contains metadata like: # - type: "file" or "url" # - url: direct URL to the file # - name: filename # - id: file ID in Open-WebUI if file_item.get('type') == 'file': file_url = file_item.get('url') file_name = file_item.get('name') # You can now use the file URL to download or process the file # For example, download the content: import httpx async with httpx.AsyncClient() as client: response = await client.get(file_url) file_content = response.content # Process the file content as needed # ... elif file_item.get('type') == 'url': # For URL-type files, the URL points to an external resource external_url = file_item.get('url') # Fetch and process the external URL content # ... # Continue with your tool logic return {"result": "Files processed successfully"} ``` Note: If you cannot see the file list, try extracting them directly from `__files__` instead of through `kwargs`: `async def your_mcp_tool_function(__files__: Optional[dict] = None, **kwargs):` `files = __files__ if __files__ is not None else {}`
Author
Owner

@gongshaojie12 commented on GitHub (Dec 4, 2025):

Where should this code be placed? My MCP is configured like this, as shown below:

Image
<!-- gh-comment-id:3611148784 --> @gongshaojie12 commented on GitHub (Dec 4, 2025): Where should this code be placed? My MCP is configured like this, as shown below: <img width="1182" height="873" alt="Image" src="https://github.com/user-attachments/assets/cbd4ea6c-21e7-4429-b4ca-a018e85330a3" />
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#18978