fix get data panic (#244)

* fix: 修复 data 获取时的循环引用错误
This commit is contained in:
zy
2025-10-16 23:00:57 +08:00
committed by GitHub
parent 844ff8c102
commit df623caf18
8 changed files with 129 additions and 85 deletions

View File

@@ -3,6 +3,7 @@ package main
import (
"context"
"encoding/base64"
"github.com/modelcontextprotocol/go-sdk/mcp"
"github.com/sirupsen/logrus"
)
@@ -64,8 +65,8 @@ type LikeFeedArgs struct {
// FavoriteFeedArgs 收藏参数
type FavoriteFeedArgs struct {
FeedID string `json:"feed_id" jsonschema:"小红书笔记ID从Feed列表获取"`
XsecToken string `json:"xsec_token" jsonschema:"访问令牌从Feed列表的xsecToken字段获取"`
FeedID string `json:"feed_id" jsonschema:"小红书笔记ID从Feed列表获取"`
XsecToken string `json:"xsec_token" jsonschema:"访问令牌从Feed列表的xsecToken字段获取"`
Unfavorite bool `json:"unfavorite,omitempty" jsonschema:"是否取消收藏true为取消收藏false或未设置则为收藏"`
}
@@ -177,7 +178,7 @@ func registerTools(server *mcp.Server, appServer *AppServer) {
mcp.AddTool(server,
&mcp.Tool{
Name: "user_profile",
Description: "获取小红书用户主页,返回用户基本信息,关注、粉丝、获赞量及其笔记内容",
Description: "获取指定的小红书用户主页,返回用户基本信息,关注、粉丝、获赞量及其笔记内容",
},
func(ctx context.Context, req *mcp.CallToolRequest, args UserProfileArgs) (*mcp.CallToolResult, any, error) {
argsMap := map[string]interface{}{