Skip to content

Conversation

@Soulter
Copy link
Member

@Soulter Soulter commented Oct 15, 2025

closes: #2939


Motivation / 动机

Modifications / 改动点

image

Verification Steps / 验证步骤

Screenshots or Test Results / 运行截图或测试结果

Compatibility & Breaking Changes / 兼容性与破坏性变更

  • 这是一个破坏性变更 (Breaking Change)。/ This is a breaking change.
  • 这不是一个破坏性变更。/ This is NOT a breaking change.

Checklist / 检查清单

  • 😊 如果 PR 中有新加入的功能,已经通过 Issue / 邮件等方式和作者讨论过。/ If there are new features added in the PR, I have discussed it with the authors through issues/emails, etc.
  • 👀 我的更改经过了良好的测试,并已在上方提供了“验证步骤”和“运行截图”。/ My changes have been well-tested, and "Verification Steps" and "Screenshots" have been provided above.
  • 🤓 我确保没有引入新依赖库,或者引入了新依赖库的同时将其添加到了 requirements.txtpyproject.toml 文件相应位置。/ I have ensured that no new dependencies are introduced, OR if new dependencies are introduced, they have been added to the appropriate locations in requirements.txt and pyproject.toml.
  • 😮 我的更改没有引入恶意代码。/ My changes do not introduce malicious code.

Sourcery 总结

引入可配置的工具调用超时,并调整 MCP 服务器配置流程以处理 ModelScope 的嵌套设置,同时更新了默认值并改进了验证功能

新功能:

  • 添加可配置的 tool_call_timeout 设置,默认为 60 秒,适用于本地和 MCP 工具执行
  • 支持仪表板中嵌套的 mcpServers 配置,并接受“transport”或“type”字段作为 MCP 客户端传输方式

改进:

  • 使用 asyncio.wait_for 强制执行工具调用超时,并在超时时引发异常
  • 将默认 MCP 客户端会话读取超时从 20 秒增加到 60 秒,并将 read_timeout_seconds 传递给 session.call_tool
  • 改进仪表板路由中 MCP 服务器配置的验证,提供清晰的错误消息
  • 在 UI 中显示超时配置提示,并使用默认超时和 SSE 读取超时值调整示例模板
Original summary in English

Summary by Sourcery

Introduce configurable tool call timeouts and adapt the MCP Server configuration flow to handle ModelScope's nested setup, with updated defaults and improved validation

New Features:

  • Add configurable tool_call_timeout setting, defaulting to 60 seconds, for both local and MCP tool executions
  • Support nested mcpServers configuration in dashboard and accept either "transport" or "type" fields for MCP client transport

Enhancements:

  • Enforce tool call timeout with asyncio.wait_for and raise exceptions on timeout
  • Increase default MCP client session read timeout from 20 to 60 seconds and pass read_timeout_seconds to session.call_tool
  • Improve validation of MCP server configuration in dashboard routes with clear error messages
  • Display timeout configuration tip in the UI and adjust example templates with default timeout and SSE read timeout values

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

嗨,你好 - 我已经审阅了你的修改,它们看起来很棒!

AI 代理的提示
请处理此代码审查中的评论:

## 个人评论

### 评论 1
<location> `astrbot/core/pipeline/process_stage/method/llm_request.py:211` </location>
<code_context>
+                    # 如果为空,则说明没有发送消息给用户,并且返回值为空,将返回一个特殊的 TextContent,其内容如"工具没有返回内容"
+                    yield None
+            except asyncio.TimeoutError:
+                raise Exception(
+                    f"tool {tool.name} execution timeout after {run_context.context.tool_call_timeout} seconds."
+                )
</code_context>

<issue_to_address>
**suggestion:** 在超时时抛出通用异常可能会模糊错误来源。

考虑抛出特定的异常,例如 `ToolTimeoutError`,而不是 `Exception`,以便更容易识别和处理超时错误。

建议的实现:

```python
            except asyncio.TimeoutError:
                raise ToolTimeoutError(
                    f"tool {tool.name} execution timeout after {run_context.context.tool_call_timeout} seconds."
                )

```

```python
                    # NOTE: Tool 在这里直接请求发送消息给用户
                    # TODO: 是否需要判断 event.get_result() 是否为空?
                    # 如果为空,则说明没有发送消息给用户,并且返回值为空,将返回一个特殊的 TextContent,其内容如"工具没有返回内容"
                    yield None

class ToolTimeoutError(Exception):
    """Raised when a tool execution times out."""
    pass

```

如果 `ToolTimeoutError` 已在你的代码库中的其他位置定义,则应在此文件顶部导入它,而不是在此处定义。
</issue_to_address>

### 评论 2
<location> `astrbot/dashboard/routes/tools.py:276-285` </location>
<code_context>
             server_data = await request.json
             config = server_data.get("mcp_server_config", None)

+            if not isinstance(config, dict) or not config:
+                return Response().error("无效的 MCP 服务器配置").__dict__
+
+            if "mcpServers" in config:
+                keys = list(config["mcpServers"].keys())
+                if not keys:
+                    return Response().error("MCP 服务器配置不能为空").__dict__
+                if len(keys) > 1:
+                    return Response().error("一次只能配置一个 MCP 服务器配置").__dict__
+                config = config["mcpServers"][keys[0]]
+            else:
+                if not config:
+                    return Response().error("MCP 服务器配置不能为空").__dict__
+
</code_context>

<issue_to_address>
**suggestion:** MCP 服务器配置的验证逻辑可以简化,以避免冗余检查。

合并对 'not config' 和 'not isinstance(config, dict)' 的重复检查将使验证逻辑更清晰且更易于维护。
</issue_to_address>

### 评论 3
<location> `astrbot/core/agent/mcp_client.py:48` </location>
<code_context>

</code_context>

<issue_to_address>
**issue (code-quality):** 抛出特定错误而不是通用 `Exception``BaseException` ([`raise-specific-error`](https://docs.sourcery.ai/Reference/Rules-and-In-Line-Suggestions/Python/Default-Rules/raise-specific-error))

<details><summary>Explanation</summary>如果一段代码抛出特定异常类型
而不是通用的
[`BaseException`](https://docs.python.org/3/library/exceptions.html#BaseException)[`Exception`](https://docs.python.org/3/library/exceptions.html#Exception),
则调用代码可以:

- 获取有关错误类型的更多信息
- 为其定义特定的异常处理

这样,代码的调用者可以适当地处理错误。

你如何解决这个问题?

- 使用标准库中的 [内置异常](https://docs.python.org/3/library/exceptions.html)- [定义自己的错误类](https://docs.python.org/3/tutorial/errors.html#tut-userexceptions),它继承自 `Exception`。

因此,与其抛出 `Exception``BaseException` 的代码,例如

```python
if incorrect_input(value):
    raise Exception("The input is incorrect")
```

你可以让代码抛出特定错误,例如

```python
if incorrect_input(value):
    raise ValueError("The input is incorrect")
```

或者

```python
class IncorrectInputError(Exception):
    pass


if incorrect_input(value):
    raise IncorrectInputError("The input is incorrect")
```
</details>
</issue_to_address>

### 评论 4
<location> `astrbot/core/agent/mcp_client.py:138` </location>
<code_context>

</code_context>

<issue_to_address>
**issue (code-quality):** 抛出特定错误而不是通用 `Exception``BaseException` ([`raise-specific-error`](https://docs.sourcery.ai/Reference/Rules-and-In-Line-Suggestions/Python/Default-Rules/raise-specific-error))

<details><summary>Explanation</summary>如果一段代码抛出特定异常类型
而不是通用的
[`BaseException`](https://docs.python.org/3/library/exceptions.html#BaseException)[`Exception`](https://docs.python.org/3/library/exceptions.html#Exception),
则调用代码可以:

- 获取有关错误类型的更多信息
- 为其定义特定的异常处理

这样,代码的调用者可以适当地处理错误。

你如何解决这个问题?

- 使用标准库中的 [内置异常](https://docs.python.org/3/library/exceptions.html)- [定义自己的错误类](https://docs.python.org/3/tutorial/errors.html#tut-userexceptions),它继承自 `Exception`。

因此,与其抛出 `Exception``BaseException` 的代码,例如

```python
if incorrect_input(value):
    raise Exception("The input is incorrect")
```

你可以让代码抛出特定错误,例如

```python
if incorrect_input(value):
    raise ValueError("The input is incorrect")
```

或者

```python
class IncorrectInputError(Exception):
    pass


if incorrect_input(value):
    raise IncorrectInputError("The input is incorrect")
```
</details>
</issue_to_address>

### 评论 5
<location> `astrbot/core/pipeline/process_stage/method/llm_request.py:211-213` </location>
<code_context>

</code_context>

<issue_to_address>
**issue (code-quality):** 抛出特定错误而不是通用 `Exception``BaseException` ([`raise-specific-error`](https://docs.sourcery.ai/Reference/Rules-and-In-Line-Suggestions/Python/Default-Rules/raise-specific-error))

<details><summary>Explanation</summary>如果一段代码抛出特定异常类型
而不是通用的
[`BaseException`](https://docs.python.org/3/library/exceptions.html#BaseException)[`Exception`](https://docs.python.org/3/library/exceptions.html#Exception),
则调用代码可以:

- 获取有关错误类型的更多信息
- 为其定义特定的异常处理

这样,代码的调用者可以适当地处理错误。

你如何解决这个问题?

- 使用标准库中的 [内置异常](https://docs.python.org/3/library/exceptions.html)- [定义自己的错误类](https://docs.python.org/3/tutorial/errors.html#tut-userexceptions),它继承自 `Exception`。

因此,与其抛出 `Exception``BaseException` 的代码,例如

```python
if incorrect_input(value):
    raise Exception("The input is incorrect")
```

你可以让代码抛出特定错误,例如

```python
if incorrect_input(value):
    raise ValueError("The input is incorrect")
```

或者

```python
class IncorrectInputError(Exception):
    pass


if incorrect_input(value):
    raise IncorrectInputError("The input is incorrect")
```
</details>
</issue_to_address>

### 评论 6
<location> `astrbot/core/pipeline/process_stage/method/llm_request.py:191` </location>
<code_context>
    @classmethod
    async def _execute_local(
        cls,
        tool: FunctionTool,
        run_context: ContextWrapper[AstrAgentContext],
        **tool_args,
    ):
        if not run_context.event:
            raise ValueError("Event must be provided for local function tools.")

        # 检查 tool 下有没有 run 方法
        if not tool.handler and not hasattr(tool, "run"):
            raise ValueError("Tool must have a valid handler or 'run' method.")
        awaitable = tool.handler or getattr(tool, "run")

        wrapper = call_handler(
            event=run_context.event,
            handler=awaitable,
            **tool_args,
        )
        # async for resp in wrapper:
        while True:
            try:
                resp = await asyncio.wait_for(
                    anext(wrapper),
                    timeout=run_context.context.tool_call_timeout,
                )
                if resp is not None:
                    if isinstance(resp, mcp.types.CallToolResult):
                        yield resp
                    else:
                        text_content = mcp.types.TextContent(
                            type="text",
                            text=str(resp),
                        )
                        yield mcp.types.CallToolResult(content=[text_content])
                else:
                    # NOTE: Tool 在这里直接请求发送消息给用户
                    # TODO: 是否需要判断 event.get_result() 是否为空?
                    # 如果为空,则说明没有发送消息给用户,并且返回值为空,将返回一个特殊的 TextContent,其内容如"工具没有返回内容"
                    yield None
            except asyncio.TimeoutError:
                raise Exception(
                    f"tool {tool.name} execution timeout after {run_context.context.tool_call_timeout} seconds."
                )
            except StopAsyncIteration:
                break

</code_context>

<issue_to_address>
**issue (code-quality):** 我们发现了这些问题:

- 交换 if/else 分支 ([`swap-if-else-branches`](https://docs.sourcery.ai/Reference/Default-Rules/refactorings/swap-if-else-branches/))
- 将 else 子句的嵌套 if 语句合并到 elif 中 ([`merge-else-if-into-elif`](https://docs.sourcery.ai/Reference/Default-Rules/refactorings/merge-else-if-into-elif/))
- 明确地从先前的错误中抛出 ([`raise-from-previous-error`](https://docs.sourcery.ai/Reference/Default-Rules/suggestions/raise-from-previous-error/))
</issue_to_address>

### 评论 7
<location> `astrbot/dashboard/routes/tools.py:285-288` </location>
<code_context>
    async def test_mcp_connection(self):
        """
        测试 MCP 服务器连接
        """
        try:
            server_data = await request.json
            config = server_data.get("mcp_server_config", None)

            if not isinstance(config, dict) or not config:
                return Response().error("无效的 MCP 服务器配置").__dict__

            if "mcpServers" in config:
                keys = list(config["mcpServers"].keys())
                if not keys:
                    return Response().error("MCP 服务器配置不能为空").__dict__
                if len(keys) > 1:
                    return Response().error("一次只能配置一个 MCP 服务器配置").__dict__
                config = config["mcpServers"][keys[0]]
            else:
                if not config:
                    return Response().error("MCP 服务器配置不能为空").__dict__

            tools_name = await self.tool_mgr.test_mcp_server_connection(config)
            return (
                Response().ok(data=tools_name, message="🎉 MCP 服务器可用!").__dict__
            )

        except Exception as e:
            logger.error(traceback.format_exc())
            return Response().error(f"测试 MCP 连接失败: {str(e)}").__dict__

</code_context>

<issue_to_address>
**suggestion (code-quality):** 我们发现了这些问题:

- 将 else 子句的嵌套 if 语句合并到 elif 中 ([`merge-else-if-into-elif`](https://docs.sourcery.ai/Reference/Default-Rules/refactorings/merge-else-if-into-elif/))
- 在控制流跳转后将代码提升到 else 中 ([`reintroduce-else`](https://docs.sourcery.ai/Reference/Default-Rules/refactorings/reintroduce-else/))

```suggestion
                else:
                    config = config["mcpServers"][keys[0]]
            elif not config:
                return Response().error("MCP 服务器配置不能为空").__dict__
```
</issue_to_address>

Sourcery 对开源项目免费 - 如果你喜欢我们的评论,请考虑分享它们 ✨
帮助我更有用!请点击每个评论上的 👍 或 👎,我将使用反馈来改进你的评论。
Original comment in English

Hey there - I've reviewed your changes and they look great!

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location> `astrbot/core/pipeline/process_stage/method/llm_request.py:211` </location>
<code_context>
+                    # 如果为空,则说明没有发送消息给用户,并且返回值为空,将返回一个特殊的 TextContent,其内容如"工具没有返回内容"
+                    yield None
+            except asyncio.TimeoutError:
+                raise Exception(
+                    f"tool {tool.name} execution timeout after {run_context.context.tool_call_timeout} seconds."
+                )
</code_context>

<issue_to_address>
**suggestion:** Raising a generic Exception on timeout may obscure the error source.

Consider raising a specific exception, such as ToolTimeoutError, instead of Exception to make timeout errors easier to identify and handle.

Suggested implementation:

```python
            except asyncio.TimeoutError:
                raise ToolTimeoutError(
                    f"tool {tool.name} execution timeout after {run_context.context.tool_call_timeout} seconds."
                )

```

```python
                    # NOTE: Tool 在这里直接请求发送消息给用户
                    # TODO: 是否需要判断 event.get_result() 是否为空?
                    # 如果为空,则说明没有发送消息给用户,并且返回值为空,将返回一个特殊的 TextContent,其内容如"工具没有返回内容"
                    yield None

class ToolTimeoutError(Exception):
    """Raised when a tool execution times out."""
    pass

```

If `ToolTimeoutError` is already defined elsewhere in your codebase, you should import it at the top of this file instead of defining it here.
</issue_to_address>

### Comment 2
<location> `astrbot/dashboard/routes/tools.py:276-285` </location>
<code_context>
             server_data = await request.json
             config = server_data.get("mcp_server_config", None)

+            if not isinstance(config, dict) or not config:
+                return Response().error("无效的 MCP 服务器配置").__dict__
+
+            if "mcpServers" in config:
+                keys = list(config["mcpServers"].keys())
+                if not keys:
+                    return Response().error("MCP 服务器配置不能为空").__dict__
+                if len(keys) > 1:
+                    return Response().error("一次只能配置一个 MCP 服务器配置").__dict__
+                config = config["mcpServers"][keys[0]]
+            else:
+                if not config:
+                    return Response().error("MCP 服务器配置不能为空").__dict__
+
</code_context>

<issue_to_address>
**suggestion:** The validation logic for MCP server config could be streamlined to avoid redundant checks.

Consolidating the repeated checks for 'not config' and 'not isinstance(config, dict)' will make the validation logic clearer and easier to maintain.
</issue_to_address>

### Comment 3
<location> `astrbot/core/agent/mcp_client.py:48` </location>
<code_context>

</code_context>

<issue_to_address>
**issue (code-quality):** Raise a specific error instead of the general `Exception` or `BaseException` ([`raise-specific-error`](https://docs.sourcery.ai/Reference/Rules-and-In-Line-Suggestions/Python/Default-Rules/raise-specific-error))

<details><summary>Explanation</summary>If a piece of code raises a specific exception type
rather than the generic
[`BaseException`](https://docs.python.org/3/library/exceptions.html#BaseException)
or [`Exception`](https://docs.python.org/3/library/exceptions.html#Exception),
the calling code can:

- get more information about what type of error it is
- define specific exception handling for it

This way, callers of the code can handle the error appropriately.

How can you solve this?

- Use one of the [built-in exceptions](https://docs.python.org/3/library/exceptions.html) of the standard library.
- [Define your own error class](https://docs.python.org/3/tutorial/errors.html#tut-userexceptions) that subclasses `Exception`.

So instead of having code raising `Exception` or `BaseException` like

```python
if incorrect_input(value):
    raise Exception("The input is incorrect")
```

you can have code raising a specific error like

```python
if incorrect_input(value):
    raise ValueError("The input is incorrect")
```

or

```python
class IncorrectInputError(Exception):
    pass


if incorrect_input(value):
    raise IncorrectInputError("The input is incorrect")
```
</details>
</issue_to_address>

### Comment 4
<location> `astrbot/core/agent/mcp_client.py:138` </location>
<code_context>

</code_context>

<issue_to_address>
**issue (code-quality):** Raise a specific error instead of the general `Exception` or `BaseException` ([`raise-specific-error`](https://docs.sourcery.ai/Reference/Rules-and-In-Line-Suggestions/Python/Default-Rules/raise-specific-error))

<details><summary>Explanation</summary>If a piece of code raises a specific exception type
rather than the generic
[`BaseException`](https://docs.python.org/3/library/exceptions.html#BaseException)
or [`Exception`](https://docs.python.org/3/library/exceptions.html#Exception),
the calling code can:

- get more information about what type of error it is
- define specific exception handling for it

This way, callers of the code can handle the error appropriately.

How can you solve this?

- Use one of the [built-in exceptions](https://docs.python.org/3/library/exceptions.html) of the standard library.
- [Define your own error class](https://docs.python.org/3/tutorial/errors.html#tut-userexceptions) that subclasses `Exception`.

So instead of having code raising `Exception` or `BaseException` like

```python
if incorrect_input(value):
    raise Exception("The input is incorrect")
```

you can have code raising a specific error like

```python
if incorrect_input(value):
    raise ValueError("The input is incorrect")
```

or

```python
class IncorrectInputError(Exception):
    pass


if incorrect_input(value):
    raise IncorrectInputError("The input is incorrect")
```
</details>
</issue_to_address>

### Comment 5
<location> `astrbot/core/pipeline/process_stage/method/llm_request.py:211-213` </location>
<code_context>

</code_context>

<issue_to_address>
**issue (code-quality):** Raise a specific error instead of the general `Exception` or `BaseException` ([`raise-specific-error`](https://docs.sourcery.ai/Reference/Rules-and-In-Line-Suggestions/Python/Default-Rules/raise-specific-error))

<details><summary>Explanation</summary>If a piece of code raises a specific exception type
rather than the generic
[`BaseException`](https://docs.python.org/3/library/exceptions.html#BaseException)
or [`Exception`](https://docs.python.org/3/library/exceptions.html#Exception),
the calling code can:

- get more information about what type of error it is
- define specific exception handling for it

This way, callers of the code can handle the error appropriately.

How can you solve this?

- Use one of the [built-in exceptions](https://docs.python.org/3/library/exceptions.html) of the standard library.
- [Define your own error class](https://docs.python.org/3/tutorial/errors.html#tut-userexceptions) that subclasses `Exception`.

So instead of having code raising `Exception` or `BaseException` like

```python
if incorrect_input(value):
    raise Exception("The input is incorrect")
```

you can have code raising a specific error like

```python
if incorrect_input(value):
    raise ValueError("The input is incorrect")
```

or

```python
class IncorrectInputError(Exception):
    pass


if incorrect_input(value):
    raise IncorrectInputError("The input is incorrect")
```
</details>
</issue_to_address>

### Comment 6
<location> `astrbot/core/pipeline/process_stage/method/llm_request.py:191` </location>
<code_context>
    @classmethod
    async def _execute_local(
        cls,
        tool: FunctionTool,
        run_context: ContextWrapper[AstrAgentContext],
        **tool_args,
    ):
        if not run_context.event:
            raise ValueError("Event must be provided for local function tools.")

        # 检查 tool 下有没有 run 方法
        if not tool.handler and not hasattr(tool, "run"):
            raise ValueError("Tool must have a valid handler or 'run' method.")
        awaitable = tool.handler or getattr(tool, "run")

        wrapper = call_handler(
            event=run_context.event,
            handler=awaitable,
            **tool_args,
        )
        # async for resp in wrapper:
        while True:
            try:
                resp = await asyncio.wait_for(
                    anext(wrapper),
                    timeout=run_context.context.tool_call_timeout,
                )
                if resp is not None:
                    if isinstance(resp, mcp.types.CallToolResult):
                        yield resp
                    else:
                        text_content = mcp.types.TextContent(
                            type="text",
                            text=str(resp),
                        )
                        yield mcp.types.CallToolResult(content=[text_content])
                else:
                    # NOTE: Tool 在这里直接请求发送消息给用户
                    # TODO: 是否需要判断 event.get_result() 是否为空?
                    # 如果为空,则说明没有发送消息给用户,并且返回值为空,将返回一个特殊的 TextContent,其内容如"工具没有返回内容"
                    yield None
            except asyncio.TimeoutError:
                raise Exception(
                    f"tool {tool.name} execution timeout after {run_context.context.tool_call_timeout} seconds."
                )
            except StopAsyncIteration:
                break

</code_context>

<issue_to_address>
**issue (code-quality):** We've found these issues:

- Swap if/else branches ([`swap-if-else-branches`](https://docs.sourcery.ai/Reference/Default-Rules/refactorings/swap-if-else-branches/))
- Merge else clause's nested if statement into elif ([`merge-else-if-into-elif`](https://docs.sourcery.ai/Reference/Default-Rules/refactorings/merge-else-if-into-elif/))
- Explicitly raise from a previous error ([`raise-from-previous-error`](https://docs.sourcery.ai/Reference/Default-Rules/suggestions/raise-from-previous-error/))
</issue_to_address>

### Comment 7
<location> `astrbot/dashboard/routes/tools.py:285-288` </location>
<code_context>
    async def test_mcp_connection(self):
        """
        测试 MCP 服务器连接
        """
        try:
            server_data = await request.json
            config = server_data.get("mcp_server_config", None)

            if not isinstance(config, dict) or not config:
                return Response().error("无效的 MCP 服务器配置").__dict__

            if "mcpServers" in config:
                keys = list(config["mcpServers"].keys())
                if not keys:
                    return Response().error("MCP 服务器配置不能为空").__dict__
                if len(keys) > 1:
                    return Response().error("一次只能配置一个 MCP 服务器配置").__dict__
                config = config["mcpServers"][keys[0]]
            else:
                if not config:
                    return Response().error("MCP 服务器配置不能为空").__dict__

            tools_name = await self.tool_mgr.test_mcp_server_connection(config)
            return (
                Response().ok(data=tools_name, message="🎉 MCP 服务器可用!").__dict__
            )

        except Exception as e:
            logger.error(traceback.format_exc())
            return Response().error(f"测试 MCP 连接失败: {str(e)}").__dict__

</code_context>

<issue_to_address>
**suggestion (code-quality):** We've found these issues:

- Merge else clause's nested if statement into elif ([`merge-else-if-into-elif`](https://docs.sourcery.ai/Reference/Default-Rules/refactorings/merge-else-if-into-elif/))
- Lift code into else after jump in control flow ([`reintroduce-else`](https://docs.sourcery.ai/Reference/Default-Rules/refactorings/reintroduce-else/))

```suggestion
                else:
                    config = config["mcpServers"][keys[0]]
            elif not config:
                return Response().error("MCP 服务器配置不能为空").__dict__
```
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@Soulter Soulter changed the title feat: 支持配置工具调用超时时间并适配 ModelScope 的 MCP Server 配置。 feat: 支持配置工具调用超时时间并适配 ModelScope 的 MCP Server 配置 Oct 15, 2025
@Soulter Soulter merged commit 9ab6526 into master Oct 15, 2025
5 checks passed
@Soulter Soulter deleted the feat/tool-call-timeout branch October 15, 2025 04:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] 添加 MCP 长时间运行模式

3 participants