From faf5d1f5eb31303a647da8894a31a0e621a830ca Mon Sep 17 00:00:00 2001 From: John Doe Date: Wed, 2 Apr 2025 01:26:54 +0300 Subject: [PATCH] debug --- internal/tg/dialogs.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/internal/tg/dialogs.go b/internal/tg/dialogs.go index 3fa6d1c..f64e747 100644 --- a/internal/tg/dialogs.go +++ b/internal/tg/dialogs.go @@ -160,12 +160,6 @@ func (c *Client) GetDialogs(args DialogsArguments) (*mcp.ToolResponse, error) { return nil, errors.Wrap(err, "failed to get dialogs") } - // Convert response to JSON - jsonData, err := json.Marshal(result) - if err != nil { - return nil, errors.Wrap(err, "failed to marshal response") - } - sort.Slice(result, func(i, j int) bool { return result[i].LastMessageID > result[j].LastMessageID }) @@ -174,6 +168,11 @@ func (c *Client) GetDialogs(args DialogsArguments) (*mcp.ToolResponse, error) { result = result[:args.Limit] } + jsonData, err := json.Marshal(result) + if err != nil { + return nil, errors.Wrap(err, "failed to marshal response") + } + return mcp.NewToolResponse(mcp.NewTextContent(string(jsonData))), nil }