mirror of
https://github.com/flipped-aurora/gin-vue-admin.git
synced 2026-10-13 12:49:26 +00:00
* feat: mcp能力调整为 streamhttp的独立服务 不再依赖gva本体 * feat: 增加MCP启动能力,增加AI工作流需求整理能力。 * feat: 增加需求梳理能力 * feat: 清理无用日志 * feat: 移除无用的Dify Chatflow文本和代码生成器按钮
30 lines
535 B
Go
30 lines
535 B
Go
package mcpTool
|
|
|
|
import (
|
|
"encoding/json"
|
|
"fmt"
|
|
|
|
"github.com/mark3labs/mcp-go/mcp"
|
|
)
|
|
|
|
func textResultWithJSON(title string, payload any) (*mcp.CallToolResult, error) {
|
|
resultJSON, err := json.MarshalIndent(payload, "", " ")
|
|
if err != nil {
|
|
return nil, fmt.Errorf("序列化结果失败: %w", err)
|
|
}
|
|
|
|
text := string(resultJSON)
|
|
if title != "" {
|
|
text = fmt.Sprintf("%s\n\n%s", title, text)
|
|
}
|
|
|
|
return &mcp.CallToolResult{
|
|
Content: []mcp.Content{
|
|
mcp.TextContent{
|
|
Type: "text",
|
|
Text: text,
|
|
},
|
|
},
|
|
}, nil
|
|
}
|