FastGPT icon indicating copy to clipboard operation
FastGPT copied to clipboard

工具调用自建MCP 出现故障,页面显示mcp调用成功能看到结果,但是工具调用组件一直报400

Open OMS-ZH opened this issue 3 months ago • 3 comments

例行检查

  • [x] 我已确认目前没有类似 issue
  • [x] 我已完整查看过项目 README,以及项目文档
  • [ ] 我使用了自己的 key,并确认我的 key 是可正常使用的
  • [x] 我理解并愿意跟进此 issue,协助测试和提供反馈
  • [x] 我理解并认可上述内容,并理解项目维护者精力有限,不遵循规则的 issue 可能会被无视或直接关闭

你的版本

  • [ ] 公有云版本
  • [ *] 私有部署版本, 具体版本号: 社区版最新

问题描述, 日志截图,配置文件等

Image

错误日志: { message: 400 [{'type': 'missing', 'loc': ('body', 'messages', 9, 'ChatCompletionMessageGenericParam', 'content'), 'msg': 'Field required', 'input': {'role': 'assistant', 'tool_calls': [{'id': 'b2GAeLPx1NIFZW31', 'type': 'function', 'function': {'name': '6901e38e1595928d1150c9a61', 'arguments': ''}}]}}, {'type': 'literal_error', 'loc': ('body', 'messages', 9, 'ChatCompletionMessageUserParam', 'role'), 'msg': "Input should be 'user'", 'input': 'assistant', 'ctx': {'expected': "'user'"}}, {'type': 'missing', 'loc': ('body', 'messages', 9, 'ChatCompletionMessageUserParam', 'content'), 'msg': 'Field required', 'input': {'role': 'assistant', 'tool_calls': [{'id': 'b2GAeLPx1NIFZW31', 'type': 'function', 'function': {'name': '6901e38e1595928d1150c9a61', 'arguments': ''}}]}}] (request id: 2025103009414828487388291961978), stack: Error: 400 [{'type': 'missing', 'loc': ('body', 'messages', 9, 'ChatCompletionMessageGenericParam', 'content'), 'msg': 'Field required', 'input': {'role': 'assistant', 'tool_calls': [{'id': 'b2GAeLPx1NIFZW31', 'type': 'function', 'function': {'name': '6901e38e1595928d1150c9a61', 'arguments': ''}}]}}, {'type': 'literal_error', 'loc': ('body', 'messages', 9, 'ChatCompletionMessageUserParam', 'role'), 'msg': "Input should be 'user'", 'input': 'assistant', 'ctx': {'expected': "'user'"}}, {'type': 'missing', 'loc': ('body', 'messages', 9, 'ChatCompletionMessageUserParam', 'content'), 'msg': 'Field required', 'input': {'role': 'assistant', 'tool_calls': [{'id': 'b2GAeLPx1NIFZW31', 'type': 'function', 'function': {'name': '6901e38e1595928d1150c9a61', 'arguments': ''}}]}}] (request id: 2025103009414828487388291961978)\n + ' at aQ.generate (/app/projects/app/.next/server/chunks/42384.js:1:234059)\n' + ' at pl.makeStatusError (/app/projects/app/.next/server/chunks/42384.js:1:225724)\n' + ' at pl.makeRequest (/app/projects/app/.next/server/chunks/42384.js:1:226647)\n' + ' at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n' + ' at async k (/app/projects/app/.next/server/pages/api/core/ai/model/test.js:30:6003)\n' + ' at async x (/app/projects/app/.next/server/pages/api/core/ai/model/test.js:30:1096)\n' + ' at async k (/app/projects/app/.next/server/chunks/4887.js:236:4908)\n' + ' at async Object.T [as tools] (/app/projects/app/.next/server/chunks/4887.js:236:197)\n' + ' at async /app/projects/app/.next/server/chunks/4887.js:239:4881\n' + [Error] 2025-10-30 01:24:41 LLM response error

复现步骤 执行任务流 预期结果

相关截图

OMS-ZH avatar Oct 31 '25 03:10 OMS-ZH

相关MCP和llm的组合 在ragflow上可以正常执行, 不知为何在fastgpt上一直报错! 我尝试了修改mcp返回长度,等均没有作用

OMS-ZH avatar Oct 31 '25 03:10 OMS-ZH

我也遇到了类似的情况,可能是你配置的模型不支持toolchoice或者functioncall这种调用方式,你在模型配置的时候把模型是否支持工具调用关闭,再去调用就不会出现400这个问题

Nand-Lu avatar Nov 10 '25 09:11 Nand-Lu

我也遇到了类似的情况,可能是你配置的模型不支持toolchoice或者functioncall这种调用方式,你在模型配置的时候把模型是否支持工具调用关闭,再去调用就不会出现400这个问题

亲测有效!!! 感谢感谢!

OMS-ZH avatar Nov 13 '25 03:11 OMS-ZH