今天在折腾openwebui的mcp功能,折腾起来是真的难受
光是这个mcpo的折腾就很难受了(主要是自己想多了)
参照
[说人话系列]最新版v0.6.0 openwebui 怎么配置使用 mcp 经验分享 - 开发调优 - LINUX DO
自己又整了一个
没什么新奇的点就是把api_key的设置变成了使用环境变量设置以及上传到DockerHub
后来想想其实可以直接把cr-zhichen佬的
command: [“mcpo”, “–config”, “/app/config.json”] 加上api-key就行了
mcpo部署成功之后就正常的改config.json 运行都正常
在测试的时候就发现了一个问题:AI调用工具的参数不正确
首先我是怀疑工具里给的描述不够导致AI不知道这个参数要这样填,然后我就开始改提示词,但是改了测试一段时间后仍然没解决
这里记录一个坑:
要基于默认提示词去改,不然AI看不到工具直接不调用了
默认提示词可以在
找到
DEFAULT_TOOLS_FUNCTION_CALLING_PROMPT_TEMPLATE:
Available Tools: {{TOOLS}}
Your task is to choose and return the correct tool(s) from the list of available tools based on the query. Follow these guidelines:
- Return only the JSON object, without any additional text or explanation.
- If no tools match the query, return an empty array:
{
"tool_calls": []
}
- If one or more tools match the query, construct a JSON response containing a "tool_calls" array with objects that include:
- "name": The tool's name.
- "parameters": A dictionary of required parameters and their corresponding values.
The format for the JSON response is strictly:
{
"tool_calls": [
{"name": "toolName1", "parameters": {"key1": "value1"}},
{"name": "toolName2", "parameters": {"key2": "value2"}}
]
}
然后就开始找啊找,然后在论坛的
可能我村通网?发现open webui的mcp调用是可以使用function call方式的 - 开发调优 - LINUX DO
找到了方向开始尝试是不是原生函数调用的问题
经过测试后发现确实是他的问题,在开启原生函数调用后就正常了,也不缺参数了,也算是终于解决了
原生函数调用
默认的提示词调用
彩蛋(哈基米降智体现):
(纯倔驴):
真的没招了orz





