diff --git a/pkg/provider/modelmgr/requesters/modelscopechatcmpl.py b/pkg/provider/modelmgr/requesters/modelscopechatcmpl.py index e5fb42a9..b8868f4d 100644 --- a/pkg/provider/modelmgr/requesters/modelscopechatcmpl.py +++ b/pkg/provider/modelmgr/requesters/modelscopechatcmpl.py @@ -57,6 +57,8 @@ class ModelScopeChatCompletions(requester.LLMAPIRequester): if chunk.choices[0].delta.tool_calls is not None: for tool_call in chunk.choices[0].delta.tool_calls: + if tool_call.function.arguments is None: + continue for tc in tool_calls: if tc.index == tool_call.index: tc.function.arguments += tool_call.function.arguments diff --git a/pkg/provider/tools/loaders/mcp.py b/pkg/provider/tools/loaders/mcp.py index 5c030994..f3223f42 100644 --- a/pkg/provider/tools/loaders/mcp.py +++ b/pkg/provider/tools/loaders/mcp.py @@ -82,8 +82,8 @@ class RuntimeMCPSession: for tool in tools.tools: - async def func(query: core_entities.Query, **kwargs): - result = await self.session.call_tool(tool.name, kwargs) + async def func(query: core_entities.Query, *, _tool=tool, **kwargs): + result = await self.session.call_tool(_tool.name, kwargs) if result.isError: raise Exception(result.content[0].text) return result.content[0].text