1 parent
367140ebb8
commit
df7d5f4135
51 files changed
+727
-49
No files matched your search
@@ -3,11 +3,13 @@ package commentThread
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"io"
|
||||
"log/slog"
|
||||
|
||||
"github.com/eat-pray-ai/yutu/cmd"
|
||||
"github.com/eat-pray-ai/yutu/pkg/commentThread"
|
||||
"github.com/mark3labs/mcp-go/mcp"
|
||||
"github.com/spf13/cobra"
|
||||
"io"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -91,11 +93,22 @@ func insertHandler(
|
||||
output, _ = args["output"].(string)
|
||||
jpath, _ = args["jsonpath"].(string)
|
||||
|
||||
slog.InfoContext(ctx, "commentThread insert started")
|
||||
|
||||
var writer bytes.Buffer
|
||||
err := insert(&writer)
|
||||
if err != nil {
|
||||
slog.ErrorContext(
|
||||
ctx, "commentThread insert failed",
|
||||
"error", err,
|
||||
"args", args,
|
||||
)
|
||||
return mcp.NewToolResultError(err.Error()), err
|
||||
}
|
||||
slog.InfoContext(
|
||||
ctx, "commentThread insert completed successfully",
|
||||
"resultSize", writer.Len(),
|
||||
)
|
||||
return mcp.NewToolResultText(writer.String()), nil
|
||||
}
|
||||
|
||||
|
||||
@@ -3,11 +3,13 @@ package commentThread
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"io"
|
||||
"log/slog"
|
||||
|
||||
"github.com/eat-pray-ai/yutu/cmd"
|
||||
"github.com/eat-pray-ai/yutu/pkg/commentThread"
|
||||
"github.com/mark3labs/mcp-go/mcp"
|
||||
"github.com/spf13/cobra"
|
||||
"io"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -140,11 +142,22 @@ func listHandler(
|
||||
output, _ = args["output"].(string)
|
||||
jpath, _ = args["jsonpath"].(string)
|
||||
|
||||
slog.InfoContext(ctx, "commentThread list started")
|
||||
|
||||
var writer bytes.Buffer
|
||||
err := list(&writer)
|
||||
if err != nil {
|
||||
slog.ErrorContext(
|
||||
ctx, "commentThread list failed",
|
||||
"error", err,
|
||||
"args", args,
|
||||
)
|
||||
return mcp.NewToolResultError(err.Error()), err
|
||||
}
|
||||
slog.InfoContext(
|
||||
ctx, "commentThread list completed successfully",
|
||||
"resultSize", writer.Len(),
|
||||
)
|
||||
return mcp.NewToolResultText(writer.String()), nil
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user