Skip to content

MCP Sequential Thinking 工具输出不支持换行渲染 #129

@yunhanhai

Description

@yunhanhai

MCP Sequential Thinking 工具输出不支持换行渲染

问题描述

使用 mcp__sequential-thinking__sequentialthinking 工具时,thought 参数中的换行符 \n 没有被正确渲染,所有内容显示在一行中,导致可读性很差。

期望行为

换行符应该被渲染为实际的换行,使思考内容结构化显示。例如:

期望显示效果

**问题分析**

用户希望实现登录功能

技术选型:
1. JWT 认证
2. Session 认证

**小结**:推荐 JWT

实际显示效果

**问题分析** 用户希望实现登录功能 技术选型: 1. JWT 认证 2. Session 认证 **小结**:推荐 JWT

复现步骤

  1. 启动 AnyCode,创建一个会话
  2. 让 Claude 调用 Sequential Thinking MCP 工具
  3. 工具的 thought 参数包含换行符,例如:
    mcp__sequential-thinking__sequentialthinking({
      thought: "**标题**\n\n分析内容\n\n1. 要点一\n2. 要点二\n\n**小结**:结论",
      thoughtNumber: 1,
      totalThoughts: 3,
      nextThoughtNeeded: true
    })
  4. 观察 MCP 工具输出区域,内容显示为单行

环境信息

  • AnyCode 版本:最新版本
  • 操作系统:Windows 11
  • Claude 模型:claude-opus-4-5-20251101

建议修复方案

在渲染 MCP 工具输出时,将 \n 换行符转换为实际的换行或 <br> 标签。

可能涉及的文件:

  • src/components/message/ 目录下的消息渲染组件
  • MCP 工具结果的显示逻辑

截图

Image

补充说明

这个问题影响所有 MCP 工具的输出显示,不仅限于 Sequential Thinking。结构化的输出对于理解 AI 的思考过程非常重要,希望能够支持换行渲染

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions