qwen2.5 或者qwen3 no-thinking 无法调用MCP
基于0.0.22版本的qwen-agent,我使用qwen3.0 thinking模式可以使用MCP,然后关闭thinking后,MCP无法被调用。换成qwen2.5后,也不能work。 我的模型server是本地的ollama。
请问这个是因为MCP必须基于thinking来支持吗?其它mcp-client tool无需thinking就能work。 还是讲需要额外配置才可以支持?
Thanks.
@sendrolon 问一下 本地ollama部署的qwen 3.0 如何关闭 thinking 功能?我没有找到 ollama 开关 thinking的方法,vLLM是有开关 thinking 参数的。
@luduling 有个软开关。 每个prompt前面加上 "/no_thinking\n" 就可以了。 这个时候会输出 空的 think label,这样速度比较快。
方便贴下模式输出吗?nothink是可以调用tools的哈
我使用Qwen2.5-1.5B-Instruct的模型,然后直接用的MCP的demo,确实没有进行工具调用,返回的message中function_call是None,是因为模型不支持吗?试了一下Qwen3-1.7B是可以的,无论是打开还是关闭think
'generate_cfg': {
'fncall_prompt_type': 'nous',
"extra_body": {
"top_k": 20,
"chat_template_kwargs": {"enable_thinking": False},
},
}
谢谢大佬们的关注 @tuhahaha @yaojunr
fix了我的MCP问题后,确认了 @yaojunr 的现象。 qwen2.5 没有进行工具调用:
YOU> Greeting! [ASSISTANT] Hello! How can I assist you today?
用来qwen3的话,我用/no_think关闭thinking,可以调用:
YOU> Greeting [ASSISTANT]
[ASSISTANT] [FUNCTION] Hello, I'm MCP greeting!!!!! [ASSISTANT]
Okay, the user said, "Hello, I'm MCP greeting!!!!!" after I called the greeting function. Now, I need to respond appropriately. Let me check the context again. The user might be testing if I understand that the greeting function is already used. They probably want to confirm that their message was received. Since the tool response was a friendly greeting, I should acknowledge it and maybe offer further help. Let me make sure the response is polite and open-ended. Maybe add a line asking if they need anything else. That should cover it.
Hello, I'm a tool that can help! If you have any questions or need assistance, feel free to ask. ]
YOU> Help me turn on the light of living room. [ASSISTANT]
代码如下:
tools = [
{
'mcpServers': {
'mcp_matter': {
'command': 'python3',
'args': ['-u', SCRIPT_PATH]
},
}
},
]
# —— 1. 配置 LLM 与工具 —— #
llm_cfg = {
# 'model': 'qwen3:0.6b',
'model': 'qwen2.5:0.5b',
'model_server': 'http://127.0.0.1:11434/v1',
'stream': False,
}
# —— 2. 创建 Assistant 实例 —— #
bot = Assistant(
llm=llm_cfg,
function_list=tools
)
我使用Qwen2.5-1.5B-Instruct的模型,然后直接用的MCP的demo,确实没有进行工具调用,返回的message中function_call是None,是因为模型不支持吗?试了一下Qwen3-1.7B是可以的,无论是打开还是关闭think
'generate_cfg': { 'fncall_prompt_type': 'nous', "extra_body": { "top_k": 20, "chat_template_kwargs": {"enable_thinking": False}, }, }
感谢帮助验证。
请问你用的是ollama吗?我的ollama版本是: ollama version is 0.6.8 我复制这段generate_cfg到我的llm_cfg里,没有关闭thinking.. 请问还需要其它的配置吗? 我的code:
# —— 1. 配置 LLM 与工具 —— #
llm_cfg = {
'model': 'qwen3:0.6b',
'model_server': 'http://127.0.0.1:11434/v1',
'stream': False,
'generate_cfg': {
'fncall_prompt_type': 'nous',
"extra_body": {
"top_k": 20,
"chat_template_kwargs": {"enable_thinking": False},
},
}
}
# —— 2. 创建 Assistant 实例 —— #
bot = Assistant(
llm=llm_cfg,
function_list=tools
)
bot.run(messages=messages)
我使用Qwen2.5-1.5B-Instruct的模型,然后直接用的MCP的demo,确实没有进行工具调用,返回的message中function_call是None,是因为模型不支持吗?试了一下Qwen3-1.7B是可以的,无论是打开还是关闭think 'generate_cfg': { 'fncall_prompt_type': 'nous', "extra_body": { "top_k": 20, "chat_template_kwargs": {"enable_thinking": False}, }, }
感谢帮助验证。
请问你用的是ollama吗?我的ollama版本是: ollama version is 0.6.8 我复制这段generate_cfg到我的llm_cfg里,没有关闭thinking.. 请问还需要其它的配置吗? 我的code:
# —— 1. 配置 LLM 与工具 —— # llm_cfg = { 'model': 'qwen3:0.6b', 'model_server': 'http://127.0.0.1:11434/v1', 'stream': False, 'generate_cfg': { 'fncall_prompt_type': 'nous', "extra_body": { "top_k": 20, "chat_template_kwargs": {"enable_thinking": False}, }, } } # —— 2. 创建 Assistant 实例 —— # bot = Assistant( llm=llm_cfg, function_list=tools ) bot.run(messages=messages)
我使用的是vLLM,然后参考vLLM-Qwen,ollama没有使用过,理论上如果也是openai的那个协议的话,应该是一样的