🔊 Add logger to mcp

issue #64
This commit is contained in:
OpenWaygate committed 2025-08-18 00:46:57 +08:00
1 parent 367140ebb8
commit df7d5f4135
51 files changed
+727 -49

No files matched your search

+14 -1
View File
@@ -3,11 +3,13 @@ package caption
import (
"bytes"
"context"
"io"
"log/slog"
"github.com/eat-pray-ai/yutu/cmd"
"github.com/eat-pray-ai/yutu/pkg/caption"
"github.com/mark3labs/mcp-go/mcp"
"github.com/spf13/cobra"
"io"
)
const (
@@ -76,11 +78,22 @@ func deleteHandler(
onBehalfOf, _ = args["onBehalfOf"].(string)
onBehalfOfContentOwner, _ = args["onBehalfOfContentOwner"].(string)
slog.InfoContext(ctx, "caption delete started")
var writer bytes.Buffer
err := del(&writer)
if err != nil {
slog.ErrorContext(
ctx, "caption delete failed",
"error", err,
"args", args,
)
return mcp.NewToolResultError(err.Error()), err
}
slog.InfoContext(
ctx, "caption delete completed successfully",
"resultSize", writer.Len(),
)
return mcp.NewToolResultText(writer.String()), nil
}
+14 -1
View File
@@ -3,11 +3,13 @@ package caption
import (
"bytes"
"context"
"io"
"log/slog"
"github.com/eat-pray-ai/yutu/cmd"
"github.com/eat-pray-ai/yutu/pkg/caption"
"github.com/mark3labs/mcp-go/mcp"
"github.com/spf13/cobra"
"io"
)
const (
@@ -97,11 +99,22 @@ func downloadHandler(
onBehalfOf, _ = args["onBehalfOf"].(string)
onBehalfOfContentOwner, _ = args["onBehalfOfContentOwner"].(string)
slog.InfoContext(ctx, "caption download started")
var writer bytes.Buffer
err := download(&writer)
if err != nil {
slog.ErrorContext(
ctx, "caption download failed",
"error", err,
"args", args,
)
return mcp.NewToolResultError(err.Error()), err
}
slog.InfoContext(
ctx, "caption download completed successfully",
"resultSize", writer.Len(),
)
return mcp.NewToolResultText(writer.String()), nil
}
+14 -1
View File
@@ -3,12 +3,14 @@ package caption
import (
"bytes"
"context"
"io"
"log/slog"
"github.com/eat-pray-ai/yutu/cmd"
"github.com/eat-pray-ai/yutu/pkg/caption"
"github.com/eat-pray-ai/yutu/pkg/utils"
"github.com/mark3labs/mcp-go/mcp"
"github.com/spf13/cobra"
"io"
)
const (
@@ -158,11 +160,22 @@ func insertHandler(
output, _ = args["output"].(string)
jpath, _ = args["jsonpath"].(string)
slog.InfoContext(ctx, "caption insert started")
var writer bytes.Buffer
err := insert(&writer)
if err != nil {
slog.ErrorContext(
ctx, "caption insert failed",
"error", err,
"args", args,
)
return mcp.NewToolResultError(err.Error()), err
}
slog.InfoContext(
ctx, "caption insert completed successfully",
"resultSize", writer.Len(),
)
return mcp.NewToolResultText(writer.String()), nil
}
+14 -1
View File
@@ -3,11 +3,13 @@ package caption
import (
"bytes"
"context"
"io"
"log/slog"
"github.com/eat-pray-ai/yutu/cmd"
"github.com/eat-pray-ai/yutu/pkg/caption"
"github.com/mark3labs/mcp-go/mcp"
"github.com/spf13/cobra"
"io"
)
const (
@@ -105,11 +107,22 @@ func listHandler(
output, _ = args["output"].(string)
jpath, _ = args["jsonpath"].(string)
slog.InfoContext(ctx, "caption list started")
var writer bytes.Buffer
err := list(&writer)
if err != nil {
slog.ErrorContext(
ctx, "caption list failed",
"error", err,
"args", args,
)
return mcp.NewToolResultError(err.Error()), err
}
slog.InfoContext(
ctx, "caption list completed successfully",
"resultSize", writer.Len(),
)
return mcp.NewToolResultText(writer.String()), nil
}
+14 -1
View File
@@ -3,12 +3,14 @@ package caption
import (
"bytes"
"context"
"io"
"log/slog"
"github.com/eat-pray-ai/yutu/cmd"
"github.com/eat-pray-ai/yutu/pkg/caption"
"github.com/eat-pray-ai/yutu/pkg/utils"
"github.com/mark3labs/mcp-go/mcp"
"github.com/spf13/cobra"
"io"
)
const (
@@ -156,11 +158,22 @@ func updateHandler(
output, _ = args["output"].(string)
jpath, _ = args["jsonpath"].(string)
slog.InfoContext(ctx, "caption update started")
var writer bytes.Buffer
err := update(&writer)
if err != nil {
slog.ErrorContext(
ctx, "caption update failed",
"error", err,
"args", args,
)
return mcp.NewToolResultError(err.Error()), err
}
slog.InfoContext(
ctx, "caption update completed successfully",
"resultSize", writer.Len(),
)
return mcp.NewToolResultText(writer.String()), nil
}
+14 -1
View File
@@ -3,12 +3,14 @@ package channel
import (
"bytes"
"context"
"io"
"log/slog"
"github.com/eat-pray-ai/yutu/cmd"
"github.com/eat-pray-ai/yutu/pkg/channel"
"github.com/eat-pray-ai/yutu/pkg/utils"
"github.com/mark3labs/mcp-go/mcp"
"github.com/spf13/cobra"
"io"
)
const (
@@ -161,11 +163,22 @@ func listHandler(
output, _ = args["output"].(string)
jpath, _ = args["jsonpath"].(string)
slog.InfoContext(ctx, "channel list started")
var writer bytes.Buffer
err := list(&writer)
if err != nil {
slog.ErrorContext(
ctx, "channel list failed",
"error", err,
"args", args,
)
return mcp.NewToolResultError(err.Error()), err
}
slog.InfoContext(
ctx, "channel list completed successfully",
"resultSize", writer.Len(),
)
return mcp.NewToolResultText(writer.String()), nil
}
+14 -1
View File
@@ -3,11 +3,13 @@ package channel
import (
"bytes"
"context"
"io"
"log/slog"
"github.com/eat-pray-ai/yutu/cmd"
"github.com/eat-pray-ai/yutu/pkg/channel"
"github.com/mark3labs/mcp-go/mcp"
"github.com/spf13/cobra"
"io"
)
const (
@@ -113,11 +115,22 @@ func updateHandler(
output, _ = args["output"].(string)
jpath, _ = args["jsonpath"].(string)
slog.InfoContext(ctx, "channel update started")
var writer bytes.Buffer
err := update(&writer)
if err != nil {
slog.ErrorContext(
ctx, "channel update failed",
"error", err,
"args", args,
)
return mcp.NewToolResultError(err.Error()), err
}
slog.InfoContext(
ctx, "channel update completed successfully",
"resultSize", writer.Len(),
)
return mcp.NewToolResultText(writer.String()), nil
}
+14 -1
View File
@@ -3,11 +3,13 @@ package channelBanner
import (
"bytes"
"context"
"io"
"log/slog"
"github.com/eat-pray-ai/yutu/cmd"
"github.com/eat-pray-ai/yutu/pkg/channelBanner"
"github.com/mark3labs/mcp-go/mcp"
"github.com/spf13/cobra"
"io"
)
func init() {
@@ -86,11 +88,22 @@ func insertHandler(
output, _ = args["output"].(string)
jpath, _ = args["jsonpath"].(string)
slog.InfoContext(ctx, "channelBanner insert started")
var writer bytes.Buffer
err := insert(&writer)
if err != nil {
slog.ErrorContext(
ctx, "channelBanner insert failed",
"error", err,
"args", args,
)
return mcp.NewToolResultError(err.Error()), err
}
slog.InfoContext(
ctx, "channelBanner insert completed successfully",
"resultSize", writer.Len(),
)
return mcp.NewToolResultText(writer.String()), nil
}
+14 -1
View File
@@ -3,11 +3,13 @@ package channelSection
import (
"bytes"
"context"
"io"
"log/slog"
"github.com/eat-pray-ai/yutu/cmd"
"github.com/eat-pray-ai/yutu/pkg/channelSection"
"github.com/mark3labs/mcp-go/mcp"
"github.com/spf13/cobra"
"io"
)
const (
@@ -70,11 +72,22 @@ func deleteHandler(
}
onBehalfOfContentOwner, _ = args["onBehalfOfContentOwner"].(string)
slog.InfoContext(ctx, "channelSection delete started")
var writer bytes.Buffer
err := del(&writer)
if err != nil {
slog.ErrorContext(
ctx, "channelSection delete failed",
"error", err,
"args", args,
)
return mcp.NewToolResultError(err.Error()), err
}
slog.InfoContext(
ctx, "channelSection delete completed successfully",
"resultSize", writer.Len(),
)
return mcp.NewToolResultText(writer.String()), nil
}
+14 -1
View File
@@ -3,12 +3,14 @@ package channelSection
import (
"bytes"
"context"
"io"
"log/slog"
"github.com/eat-pray-ai/yutu/cmd"
"github.com/eat-pray-ai/yutu/pkg/channelSection"
"github.com/eat-pray-ai/yutu/pkg/utils"
"github.com/mark3labs/mcp-go/mcp"
"github.com/spf13/cobra"
"io"
)
const (
@@ -113,11 +115,22 @@ func listHandler(
output, _ = args["output"].(string)
jpath, _ = args["jsonpath"].(string)
slog.InfoContext(ctx, "channelSection list started")
var writer bytes.Buffer
err := list(&writer)
if err != nil {
slog.ErrorContext(
ctx, "channelSection list failed",
"error", err,
"args", args,
)
return mcp.NewToolResultError(err.Error()), err
}
slog.InfoContext(
ctx, "channelSection list completed successfully",
"resultSize", writer.Len(),
)
return mcp.NewToolResultText(writer.String()), nil
}
+14 -1
View File
@@ -3,11 +3,13 @@ package comment
import (
"bytes"
"context"
"io"
"log/slog"
"github.com/eat-pray-ai/yutu/cmd"
"github.com/eat-pray-ai/yutu/pkg/comment"
"github.com/mark3labs/mcp-go/mcp"
"github.com/spf13/cobra"
"io"
)
const (
@@ -60,11 +62,22 @@ func deleteHandler(
ids[i] = id.(string)
}
slog.InfoContext(ctx, "comment delete started")
var writer bytes.Buffer
err := del(&writer)
if err != nil {
slog.ErrorContext(
ctx, "comment delete failed",
"error", err,
"args", args,
)
return mcp.NewToolResultError(err.Error()), err
}
slog.InfoContext(
ctx, "comment delete completed successfully",
"resultSize", writer.Len(),
)
return mcp.NewToolResultText(writer.String()), nil
}
+14 -1
View File
@@ -3,12 +3,14 @@ package comment
import (
"bytes"
"context"
"io"
"log/slog"
"github.com/eat-pray-ai/yutu/cmd"
"github.com/eat-pray-ai/yutu/pkg/comment"
"github.com/eat-pray-ai/yutu/pkg/utils"
"github.com/mark3labs/mcp-go/mcp"
"github.com/spf13/cobra"
"io"
)
const (
@@ -113,11 +115,22 @@ func insertHandler(
output, _ = args["output"].(string)
jpath, _ = args["jsonpath"].(string)
slog.InfoContext(ctx, "comment insert started")
var writer bytes.Buffer
err := insert(&writer)
if err != nil {
slog.ErrorContext(
ctx, "comment insert failed",
"error", err,
"args", args,
)
return mcp.NewToolResultError(err.Error()), err
}
slog.InfoContext(
ctx, "comment insert completed successfully",
"resultSize", writer.Len(),
)
return mcp.NewToolResultText(writer.String()), nil
}
+14 -1
View File
@@ -3,11 +3,13 @@ package comment
import (
"bytes"
"context"
"io"
"log/slog"
"github.com/eat-pray-ai/yutu/cmd"
"github.com/eat-pray-ai/yutu/pkg/comment"
"github.com/mark3labs/mcp-go/mcp"
"github.com/spf13/cobra"
"io"
)
const (
@@ -109,11 +111,22 @@ func listHandler(
output, _ = args["output"].(string)
jpath, _ = args["jsonpath"].(string)
slog.InfoContext(ctx, "comment list started")
var writer bytes.Buffer
err := list(&writer)
if err != nil {
slog.ErrorContext(
ctx, "comment list failed",
"error", err,
"args", args,
)
return mcp.NewToolResultError(err.Error()), err
}
slog.InfoContext(
ctx, "comment list completed successfully",
"resultSize", writer.Len(),
)
return mcp.NewToolResultText(writer.String()), nil
}
+14 -1
View File
@@ -3,11 +3,13 @@ package comment
import (
"bytes"
"context"
"io"
"log/slog"
"github.com/eat-pray-ai/yutu/cmd"
"github.com/eat-pray-ai/yutu/pkg/comment"
"github.com/mark3labs/mcp-go/mcp"
"github.com/spf13/cobra"
"io"
)
const (
@@ -73,11 +75,22 @@ func markAsSpamHandler(
output, _ = args["output"].(string)
jpath, _ = args["jsonpath"].(string)
slog.InfoContext(ctx, "comment markAsSpam started")
var writer bytes.Buffer
err := markAsSpam(&writer)
if err != nil {
slog.ErrorContext(
ctx, "comment markAsSpam failed",
"error", err,
"args", args,
)
return mcp.NewToolResultError(err.Error()), err
}
slog.InfoContext(
ctx, "comment markAsSpam completed successfully",
"resultSize", writer.Len(),
)
return mcp.NewToolResultText(writer.String()), nil
}
+14 -1
View File
@@ -3,12 +3,14 @@ package comment
import (
"bytes"
"context"
"io"
"log/slog"
"github.com/eat-pray-ai/yutu/cmd"
"github.com/eat-pray-ai/yutu/pkg/comment"
"github.com/eat-pray-ai/yutu/pkg/utils"
"github.com/mark3labs/mcp-go/mcp"
"github.com/spf13/cobra"
"io"
)
const (
@@ -98,11 +100,22 @@ func setModerationStatusHandler(
output, _ = args["output"].(string)
jpath, _ = args["jsonpath"].(string)
slog.InfoContext(ctx, "comment setModerationStatus started")
var writer bytes.Buffer
err := setModerationStatus(&writer)
if err != nil {
slog.ErrorContext(
ctx, "comment setModerationStatus failed",
"error", err,
"args", args,
)
return mcp.NewToolResultError(err.Error()), err
}
slog.InfoContext(
ctx, "comment setModerationStatus completed successfully",
"resultSize", writer.Len(),
)
return mcp.NewToolResultText(writer.String()), nil
}
+14 -1
View File
@@ -3,12 +3,14 @@ package comment
import (
"bytes"
"context"
"io"
"log/slog"
"github.com/eat-pray-ai/yutu/cmd"
"github.com/eat-pray-ai/yutu/pkg/comment"
"github.com/eat-pray-ai/yutu/pkg/utils"
"github.com/mark3labs/mcp-go/mcp"
"github.com/spf13/cobra"
"io"
)
const (
@@ -98,11 +100,22 @@ func updateHandler(
output, _ = args["output"].(string)
jpath, _ = args["jsonpath"].(string)
slog.InfoContext(ctx, "comment update started")
var writer bytes.Buffer
err := update(&writer)
if err != nil {
slog.ErrorContext(
ctx, "comment update failed",
"error", err,
"args", args,
)
return mcp.NewToolResultError(err.Error()), err
}
slog.InfoContext(
ctx, "comment update completed successfully",
"resultSize", writer.Len(),
)
return mcp.NewToolResultText(writer.String()), nil
}
+14 -1
View File
@@ -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
}
+14 -1
View File
@@ -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
}
+27
View File
@@ -4,6 +4,7 @@ import (
"bytes"
"context"
"io"
"log/slog"
"github.com/eat-pray-ai/yutu/cmd"
"github.com/eat-pray-ai/yutu/pkg/i18nLanguage"
@@ -50,12 +51,25 @@ func hlHandler(
parts = defaultParts
output = "json"
jpath = "$.*.snippet.hl"
slog.InfoContext(ctx, "i18nLanguage hl list started")
var writer bytes.Buffer
err := list(&writer)
if err != nil {
slog.ErrorContext(
ctx, "i18nLanguage hl list failed",
"error", err,
"uri", request.Params.URI,
)
return nil, err
}
slog.InfoContext(
ctx, "i18nLanguage hl list completed successfully",
"resultSize", writer.Len(),
)
contents := []mcp.ResourceContents{
mcp.TextResourceContents{
URI: hlURI,
@@ -79,12 +93,25 @@ func langsHandler(
parts = defaultParts
hl = utils.ExtractHl(request.Params.URI)
output = "json"
slog.InfoContext(ctx, "i18nLanguage list started")
var writer bytes.Buffer
err := list(&writer)
if err != nil {
slog.ErrorContext(
ctx, "i18nLanguage list failed",
"error", err,
"uri", request.Params.URI,
)
return nil, err
}
slog.InfoContext(
ctx, "i18nLanguage list completed successfully",
"resultSize", writer.Len(),
)
contents := []mcp.ResourceContents{
mcp.TextResourceContents{
URI: request.Params.URI,
+14
View File
@@ -4,6 +4,7 @@ import (
"bytes"
"context"
"io"
"log/slog"
"github.com/eat-pray-ai/yutu/cmd"
"github.com/eat-pray-ai/yutu/pkg/i18nRegion"
@@ -49,12 +50,25 @@ func regionsHandler(
parts = defaultParts
hl = utils.ExtractHl(request.Params.URI)
output = "json"
slog.InfoContext(ctx, "i18nRegion list started")
var writer bytes.Buffer
err := list(&writer)
if err != nil {
slog.ErrorContext(
ctx, "i18nRegion list failed",
"error", err,
"uri", request.Params.URI,
)
return nil, err
}
slog.InfoContext(
ctx, "i18nRegion list completed successfully",
"resultSize", writer.Len(),
)
contents := []mcp.ResourceContents{
mcp.TextResourceContents{
URI: request.Params.URI,
+14 -1
View File
@@ -3,11 +3,13 @@ package member
import (
"bytes"
"context"
"io"
"log/slog"
"github.com/eat-pray-ai/yutu/cmd"
"github.com/eat-pray-ai/yutu/pkg/member"
"github.com/mark3labs/mcp-go/mcp"
"github.com/spf13/cobra"
"io"
)
func init() {
@@ -97,11 +99,22 @@ func listHandler(
output, _ = args["output"].(string)
jpath, _ = args["jsonpath"].(string)
slog.InfoContext(ctx, "member list started")
var writer bytes.Buffer
err := list(&writer)
if err != nil {
slog.ErrorContext(
ctx, "member list failed",
"error", err,
"args", args,
)
return mcp.NewToolResultError(err.Error()), err
}
slog.InfoContext(
ctx, "member list completed successfully",
"resultSize", writer.Len(),
)
return mcp.NewToolResultText(writer.String()), nil
}
+14 -1
View File
@@ -3,11 +3,13 @@ package membershipsLevel
import (
"bytes"
"context"
"io"
"log/slog"
"github.com/eat-pray-ai/yutu/cmd"
"github.com/eat-pray-ai/yutu/pkg/membershipsLevel"
"github.com/mark3labs/mcp-go/mcp"
"github.com/spf13/cobra"
"io"
)
func init() {
@@ -68,11 +70,22 @@ func listHandler(
output, _ = args["output"].(string)
jpath, _ = args["jsonpath"].(string)
slog.InfoContext(ctx, "membershipsLevel list started")
var writer bytes.Buffer
err := list(&writer)
if err != nil {
slog.ErrorContext(
ctx, "membershipsLevel list failed",
"error", err,
"args", args,
)
return mcp.NewToolResultError(err.Error()), err
}
slog.InfoContext(
ctx, "membershipsLevel list completed successfully",
"resultSize", writer.Len(),
)
return mcp.NewToolResultText(writer.String()), nil
}
+14 -1
View File
@@ -3,11 +3,13 @@ package playlist
import (
"bytes"
"context"
"io"
"log/slog"
"github.com/eat-pray-ai/yutu/cmd"
"github.com/eat-pray-ai/yutu/pkg/playlist"
"github.com/mark3labs/mcp-go/mcp"
"github.com/spf13/cobra"
"io"
)
const (
@@ -70,11 +72,22 @@ func deleteHandler(
}
onBehalfOfContentOwner, _ = args["onBehalfOfContentOwner"].(string)
slog.InfoContext(ctx, "playlist delete started")
var writer bytes.Buffer
err := del(&writer)
if err != nil {
slog.ErrorContext(
ctx, "playlist delete failed",
"error", err,
"args", args,
)
return mcp.NewToolResultError(err.Error()), err
}
slog.InfoContext(
ctx, "playlist delete completed successfully",
"resultSize", writer.Len(),
)
return mcp.NewToolResultText(writer.String()), nil
}
+14 -1
View File
@@ -3,11 +3,13 @@ package playlist
import (
"bytes"
"context"
"io"
"log/slog"
"github.com/eat-pray-ai/yutu/cmd"
"github.com/eat-pray-ai/yutu/pkg/playlist"
"github.com/mark3labs/mcp-go/mcp"
"github.com/spf13/cobra"
"io"
)
const (
@@ -106,11 +108,22 @@ func insertHandler(
output, _ = args["output"].(string)
jpath, _ = args["jsonpath"].(string)
slog.InfoContext(ctx, "playlist insert started")
var writer bytes.Buffer
err := insert(&writer)
if err != nil {
slog.ErrorContext(
ctx, "playlist insert failed",
"error", err,
"args", args,
)
return mcp.NewToolResultError(err.Error()), err
}
slog.InfoContext(
ctx, "playlist insert completed successfully",
"resultSize", writer.Len(),
)
return mcp.NewToolResultText(writer.String()), nil
}
+14 -1
View File
@@ -3,12 +3,14 @@ package playlist
import (
"bytes"
"context"
"io"
"log/slog"
"github.com/eat-pray-ai/yutu/cmd"
"github.com/eat-pray-ai/yutu/pkg/playlist"
"github.com/eat-pray-ai/yutu/pkg/utils"
"github.com/mark3labs/mcp-go/mcp"
"github.com/spf13/cobra"
"io"
)
const (
@@ -132,11 +134,22 @@ func listHandler(
output, _ = args["output"].(string)
jpath, _ = args["jsonpath"].(string)
slog.InfoContext(ctx, "playlist list started")
var writer bytes.Buffer
err := list(&writer)
if err != nil {
slog.ErrorContext(
ctx, "playlist list failed",
"error", err,
"args", args,
)
return mcp.NewToolResultError(err.Error()), err
}
slog.InfoContext(
ctx, "playlist list completed successfully",
"resultSize", writer.Len(),
)
return mcp.NewToolResultText(writer.String()), nil
}
+14 -1
View File
@@ -3,11 +3,13 @@ package playlist
import (
"bytes"
"context"
"io"
"log/slog"
"github.com/eat-pray-ai/yutu/cmd"
"github.com/eat-pray-ai/yutu/pkg/playlist"
"github.com/mark3labs/mcp-go/mcp"
"github.com/spf13/cobra"
"io"
)
const (
@@ -109,11 +111,22 @@ func updateHandler(
output, _ = args["output"].(string)
jpath, _ = args["jsonpath"].(string)
slog.InfoContext(ctx, "playlist update started")
var writer bytes.Buffer
err := update(&writer)
if err != nil {
slog.ErrorContext(
ctx, "playlist update failed",
"error", err,
"args", args,
)
return mcp.NewToolResultError(err.Error()), err
}
slog.InfoContext(
ctx, "playlist update completed successfully",
"resultSize", writer.Len(),
)
return mcp.NewToolResultText(writer.String()), nil
}
+14 -1
View File
@@ -3,11 +3,13 @@ package playlistImage
import (
"bytes"
"context"
"io"
"log/slog"
"github.com/eat-pray-ai/yutu/cmd"
"github.com/eat-pray-ai/yutu/pkg/playlistImage"
"github.com/mark3labs/mcp-go/mcp"
"github.com/spf13/cobra"
"io"
)
const (
@@ -69,11 +71,22 @@ func deleteHandler(
}
onBehalfOfContentOwner, _ = args["onBehalfOfContentOwner"].(string)
slog.InfoContext(ctx, "playlistImage delete started")
var writer bytes.Buffer
err := del(&writer)
if err != nil {
slog.ErrorContext(
ctx, "playlistImage delete failed",
"error", err,
"args", args,
)
return mcp.NewToolResultError(err.Error()), err
}
slog.InfoContext(
ctx, "playlistImage delete completed successfully",
"resultSize", writer.Len(),
)
return mcp.NewToolResultText(writer.String()), nil
}
+14 -1
View File
@@ -3,11 +3,13 @@ package playlistImage
import (
"bytes"
"context"
"io"
"log/slog"
"github.com/eat-pray-ai/yutu/cmd"
"github.com/eat-pray-ai/yutu/pkg/playlistImage"
"github.com/mark3labs/mcp-go/mcp"
"github.com/spf13/cobra"
"io"
)
const (
@@ -95,11 +97,22 @@ func insertHandler(
output, _ = args["output"].(string)
jpath, _ = args["jsonpath"].(string)
slog.InfoContext(ctx, "playlistImage insert started")
var writer bytes.Buffer
err := insert(&writer)
if err != nil {
slog.ErrorContext(
ctx, "playlistImage insert failed",
"error", err,
"args", args,
)
return mcp.NewToolResultError(err.Error()), err
}
slog.InfoContext(
ctx, "playlistImage insert completed successfully",
"resultSize", writer.Len(),
)
return mcp.NewToolResultText(writer.String()), nil
}
+14 -1
View File
@@ -3,11 +3,13 @@ package playlistImage
import (
"bytes"
"context"
"io"
"log/slog"
"github.com/eat-pray-ai/yutu/cmd"
"github.com/eat-pray-ai/yutu/pkg/playlistImage"
"github.com/mark3labs/mcp-go/mcp"
"github.com/spf13/cobra"
"io"
)
const (
@@ -102,11 +104,22 @@ func listHandler(
onBehalfOfContentOwner, _ = args["onBehalfOfContentOwner"].(string)
onBehalfOfContentOwnerChannel, _ = args["onBehalfOfContentOwnerChannel"].(string)
slog.InfoContext(ctx, "playlistImage list started")
var writer bytes.Buffer
err := list(&writer)
if err != nil {
slog.ErrorContext(
ctx, "playlistImage list failed",
"error", err,
"args", args,
)
return mcp.NewToolResultError(err.Error()), err
}
slog.InfoContext(
ctx, "playlistImage list completed successfully",
"resultSize", writer.Len(),
)
return mcp.NewToolResultText(writer.String()), nil
}
+14 -1
View File
@@ -3,11 +3,13 @@ package playlistImage
import (
"bytes"
"context"
"io"
"log/slog"
"github.com/eat-pray-ai/yutu/cmd"
"github.com/eat-pray-ai/yutu/pkg/playlistImage"
"github.com/mark3labs/mcp-go/mcp"
"github.com/spf13/cobra"
"io"
)
const (
@@ -88,11 +90,22 @@ func updateHandler(
output, _ = args["output"].(string)
jpath, _ = args["jsonpath"].(string)
slog.InfoContext(ctx, "playlistImage update started")
var writer bytes.Buffer
err := update(&writer)
if err != nil {
slog.ErrorContext(
ctx, "playlistImage update failed",
"error", err,
"args", args,
)
return mcp.NewToolResultError(err.Error()), err
}
slog.InfoContext(
ctx, "playlistImage update completed successfully",
"resultSize", writer.Len(),
)
return mcp.NewToolResultText(writer.String()), nil
}
+14 -1
View File
@@ -3,11 +3,13 @@ package playlistItem
import (
"bytes"
"context"
"io"
"log/slog"
"github.com/eat-pray-ai/yutu/cmd"
"github.com/eat-pray-ai/yutu/pkg/playlistItem"
"github.com/mark3labs/mcp-go/mcp"
"github.com/spf13/cobra"
"io"
)
const (
@@ -70,11 +72,22 @@ func deleteHandler(
}
onBehalfOfContentOwner, _ = args["onBehalfOfContentOwner"].(string)
slog.InfoContext(ctx, "playlistItem delete started")
var writer bytes.Buffer
err := del(&writer)
if err != nil {
slog.ErrorContext(
ctx, "playlistItem delete failed",
"error", err,
"args", args,
)
return mcp.NewToolResultError(err.Error()), err
}
slog.InfoContext(
ctx, "playlistItem delete completed successfully",
"resultSize", writer.Len(),
)
return mcp.NewToolResultText(writer.String()), nil
}
+14 -1
View File
@@ -3,11 +3,13 @@ package playlistItem
import (
"bytes"
"context"
"io"
"log/slog"
"github.com/eat-pray-ai/yutu/cmd"
"github.com/eat-pray-ai/yutu/pkg/playlistItem"
"github.com/mark3labs/mcp-go/mcp"
"github.com/spf13/cobra"
"io"
)
const (
@@ -129,11 +131,22 @@ func insertHandler(
output, _ = args["output"].(string)
jpath, _ = args["jsonpath"].(string)
slog.InfoContext(ctx, "playlistItem insert started")
var writer bytes.Buffer
err := insert(&writer)
if err != nil {
slog.ErrorContext(
ctx, "playlistItem insert failed",
"error", err,
"args", args,
)
return mcp.NewToolResultError(err.Error()), err
}
slog.InfoContext(
ctx, "playlistItem insert completed successfully",
"resultSize", writer.Len(),
)
return mcp.NewToolResultText(writer.String()), nil
}
+14 -1
View File
@@ -3,11 +3,13 @@ package playlistItem
import (
"bytes"
"context"
"io"
"log/slog"
"github.com/eat-pray-ai/yutu/cmd"
"github.com/eat-pray-ai/yutu/pkg/playlistItem"
"github.com/mark3labs/mcp-go/mcp"
"github.com/spf13/cobra"
"io"
)
const (
@@ -113,11 +115,22 @@ func listHandler(
output, _ = args["output"].(string)
jpath, _ = args["jsonpath"].(string)
slog.InfoContext(ctx, "playlistItem list started")
var writer bytes.Buffer
err := list(&writer)
if err != nil {
slog.ErrorContext(
ctx, "playlistItem list failed",
"error", err,
"args", args,
)
return mcp.NewToolResultError(err.Error()), err
}
slog.InfoContext(
ctx, "playlistItem list completed successfully",
"resultSize", writer.Len(),
)
return mcp.NewToolResultText(writer.String()), nil
}
+14 -1
View File
@@ -3,11 +3,13 @@ package playlistItem
import (
"bytes"
"context"
"io"
"log/slog"
"github.com/eat-pray-ai/yutu/cmd"
"github.com/eat-pray-ai/yutu/pkg/playlistItem"
"github.com/mark3labs/mcp-go/mcp"
"github.com/spf13/cobra"
"io"
)
const (
@@ -100,11 +102,22 @@ func updateHandler(
output, _ = args["output"].(string)
jpath, _ = args["jsonpath"].(string)
slog.InfoContext(ctx, "playlistItem update started")
var writer bytes.Buffer
err := update(&writer)
if err != nil {
slog.ErrorContext(
ctx, "playlistItem update failed",
"error", err,
"args", args,
)
return mcp.NewToolResultError(err.Error()), err
}
slog.InfoContext(
ctx, "playlistItem update completed successfully",
"resultSize", writer.Len(),
)
return mcp.NewToolResultText(writer.String()), nil
}
+14 -1
View File
@@ -3,12 +3,14 @@ package search
import (
"bytes"
"context"
"io"
"log/slog"
"github.com/eat-pray-ai/yutu/cmd"
"github.com/eat-pray-ai/yutu/pkg/search"
"github.com/eat-pray-ai/yutu/pkg/utils"
"github.com/mark3labs/mcp-go/mcp"
"github.com/spf13/cobra"
"io"
)
func init() {
@@ -266,11 +268,22 @@ func listHandler(
output, _ = args["output"].(string)
jpath, _ = args["jsonpath"].(string)
slog.InfoContext(ctx, "search list started")
var writer bytes.Buffer
err := list(&writer)
if err != nil {
slog.ErrorContext(
ctx, "search list failed",
"error", err,
"args", args,
)
return mcp.NewToolResultError(err.Error()), err
}
slog.InfoContext(
ctx, "search list completed successfully",
"resultSize", writer.Len(),
)
return mcp.NewToolResultText(writer.String()), nil
}
+14 -1
View File
@@ -3,11 +3,13 @@ package subscription
import (
"bytes"
"context"
"io"
"log/slog"
"github.com/eat-pray-ai/yutu/cmd"
"github.com/eat-pray-ai/yutu/pkg/subscription"
"github.com/mark3labs/mcp-go/mcp"
"github.com/spf13/cobra"
"io"
)
const (
@@ -61,11 +63,22 @@ func deleteHandler(
ids[i] = id.(string)
}
slog.InfoContext(ctx, "subscription delete started")
var writer bytes.Buffer
err := del(&writer)
if err != nil {
slog.ErrorContext(
ctx, "subscription delete failed",
"error", err,
"args", args,
)
return mcp.NewToolResultError(err.Error()), err
}
slog.InfoContext(
ctx, "subscription delete completed successfully",
"resultSize", writer.Len(),
)
return mcp.NewToolResultText(writer.String()), nil
}
+14 -1
View File
@@ -3,11 +3,13 @@ package subscription
import (
"bytes"
"context"
"io"
"log/slog"
"github.com/eat-pray-ai/yutu/cmd"
"github.com/eat-pray-ai/yutu/pkg/subscription"
"github.com/mark3labs/mcp-go/mcp"
"github.com/spf13/cobra"
"io"
)
const (
@@ -90,11 +92,22 @@ func insertHandler(
output, _ = args["output"].(string)
jpath, _ = args["jsonpath"].(string)
slog.InfoContext(ctx, "subscription insert started")
var writer bytes.Buffer
err := insert(&writer)
if err != nil {
slog.ErrorContext(
ctx, "subscription insert failed",
"error", err,
"args", args,
)
return mcp.NewToolResultError(err.Error()), err
}
slog.InfoContext(
ctx, "subscription insert completed successfully",
"resultSize", writer.Len(),
)
return mcp.NewToolResultText(writer.String()), nil
}
+14 -1
View File
@@ -3,12 +3,14 @@ package subscription
import (
"bytes"
"context"
"io"
"log/slog"
"github.com/eat-pray-ai/yutu/cmd"
"github.com/eat-pray-ai/yutu/pkg/subscription"
"github.com/eat-pray-ai/yutu/pkg/utils"
"github.com/mark3labs/mcp-go/mcp"
"github.com/spf13/cobra"
"io"
)
const (
@@ -156,11 +158,22 @@ func listHandler(
output, _ = args["output"].(string)
jpath, _ = args["jsonpath"].(string)
slog.InfoContext(ctx, "subscription list started")
var writer bytes.Buffer
err := list(&writer)
if err != nil {
slog.ErrorContext(
ctx, "subscription list failed",
"error", err,
"args", args,
)
return mcp.NewToolResultError(err.Error()), err
}
slog.InfoContext(
ctx, "subscription list completed successfully",
"resultSize", writer.Len(),
)
return mcp.NewToolResultText(writer.String()), nil
}
+14 -1
View File
@@ -3,11 +3,13 @@ package superChatEvent
import (
"bytes"
"context"
"io"
"log/slog"
"github.com/eat-pray-ai/yutu/cmd"
"github.com/eat-pray-ai/yutu/pkg/superChatEvent"
"github.com/mark3labs/mcp-go/mcp"
"github.com/spf13/cobra"
"io"
)
func init() {
@@ -81,11 +83,22 @@ func listHandler(
output, _ = args["output"].(string)
jpath, _ = args["jsonpath"].(string)
slog.InfoContext(ctx, "superChatEvent list started")
var writer bytes.Buffer
err := list(&writer)
if err != nil {
slog.ErrorContext(
ctx, "superChatEvent list failed",
"error", err,
"args", args,
)
return mcp.NewToolResultError(err.Error()), err
}
slog.InfoContext(
ctx, "superChatEvent list completed successfully",
"resultSize", writer.Len(),
)
return mcp.NewToolResultText(writer.String()), nil
}
+14 -1
View File
@@ -3,11 +3,13 @@ package thumbnail
import (
"bytes"
"context"
"io"
"log/slog"
"github.com/eat-pray-ai/yutu/cmd"
"github.com/eat-pray-ai/yutu/pkg/thumbnail"
"github.com/mark3labs/mcp-go/mcp"
"github.com/spf13/cobra"
"io"
)
func init() {
@@ -70,11 +72,22 @@ func setHandler(
output, _ = args["output"].(string)
jpath, _ = args["jsonpath"].(string)
slog.InfoContext(ctx, "thumbnail set started")
var writer bytes.Buffer
err := set(&writer)
if err != nil {
slog.ErrorContext(
ctx, "thumbnail set failed",
"error", err,
"args", args,
)
return mcp.NewToolResultError(err.Error()), err
}
slog.InfoContext(
ctx, "thumbnail set completed successfully",
"resultSize", writer.Len(),
)
return mcp.NewToolResultText(writer.String()), nil
}
+14 -1
View File
@@ -3,11 +3,13 @@ package video
import (
"bytes"
"context"
"io"
"log/slog"
"github.com/eat-pray-ai/yutu/cmd"
"github.com/eat-pray-ai/yutu/pkg/video"
"github.com/mark3labs/mcp-go/mcp"
"github.com/spf13/cobra"
"io"
)
const (
@@ -61,11 +63,22 @@ func deleteHandler(
ids[i] = id.(string)
}
slog.InfoContext(ctx, "video delete started")
var writer bytes.Buffer
err := del(&writer)
if err != nil {
slog.ErrorContext(
ctx, "video delete failed",
"error", err,
"args", args,
)
return mcp.NewToolResultError(err.Error()), err
}
slog.InfoContext(
ctx, "video delete completed successfully",
"resultSize", writer.Len(),
)
return mcp.NewToolResultText(writer.String()), nil
}
+14 -1
View File
@@ -3,11 +3,13 @@ package video
import (
"bytes"
"context"
"io"
"log/slog"
"github.com/eat-pray-ai/yutu/cmd"
"github.com/eat-pray-ai/yutu/pkg/video"
"github.com/mark3labs/mcp-go/mcp"
"github.com/spf13/cobra"
"io"
)
const (
@@ -82,11 +84,22 @@ func getRatingHandler(
output, _ = args["output"].(string)
jpath, _ = args["jsonpath"].(string)
slog.InfoContext(ctx, "video getRating started")
var writer bytes.Buffer
err := getRating(&writer)
if err != nil {
slog.ErrorContext(
ctx, "video getRating failed",
"error", err,
"args", args,
)
return mcp.NewToolResultError(err.Error()), err
}
slog.InfoContext(
ctx, "video getRating completed successfully",
"resultSize", writer.Len(),
)
return mcp.NewToolResultText(writer.String()), nil
}
+14 -1
View File
@@ -3,12 +3,14 @@ package video
import (
"bytes"
"context"
"io"
"log/slog"
"github.com/eat-pray-ai/yutu/cmd"
"github.com/eat-pray-ai/yutu/pkg/utils"
"github.com/eat-pray-ai/yutu/pkg/video"
"github.com/mark3labs/mcp-go/mcp"
"github.com/spf13/cobra"
"io"
)
const (
@@ -209,11 +211,22 @@ func insertHandler(
output, _ = args["output"].(string)
jpath, _ = args["jsonpath"].(string)
slog.InfoContext(ctx, "video insert started")
var writer bytes.Buffer
err := insert(&writer)
if err != nil {
slog.ErrorContext(
ctx, "video insert failed",
"error", err,
"args", args,
)
return mcp.NewToolResultError(err.Error()), err
}
slog.InfoContext(
ctx, "video insert completed successfully",
"resultSize", writer.Len(),
)
return mcp.NewToolResultText(writer.String()), nil
}
+14 -1
View File
@@ -3,11 +3,13 @@ package video
import (
"bytes"
"context"
"io"
"log/slog"
"github.com/eat-pray-ai/yutu/cmd"
"github.com/eat-pray-ai/yutu/pkg/video"
"github.com/mark3labs/mcp-go/mcp"
"github.com/spf13/cobra"
"io"
)
const (
@@ -151,11 +153,22 @@ func listHandler(
output, _ = args["output"].(string)
jpath, _ = args["jsonpath"].(string)
slog.InfoContext(ctx, "video list started")
var writer bytes.Buffer
err := list(&writer)
if err != nil {
slog.ErrorContext(
ctx, "video list failed",
"error", err,
"args", args,
)
return mcp.NewToolResultError(err.Error()), err
}
slog.InfoContext(
ctx, "video list completed successfully",
"resultSize", writer.Len(),
)
return mcp.NewToolResultText(writer.String()), nil
}
+14 -1
View File
@@ -3,11 +3,13 @@ package video
import (
"bytes"
"context"
"io"
"log/slog"
"github.com/eat-pray-ai/yutu/cmd"
"github.com/eat-pray-ai/yutu/pkg/video"
"github.com/mark3labs/mcp-go/mcp"
"github.com/spf13/cobra"
"io"
)
const (
@@ -70,11 +72,22 @@ func rateHandler(
}
rating, _ = args["rating"].(string)
slog.InfoContext(ctx, "video rate started")
var writer bytes.Buffer
err := rate(&writer)
if err != nil {
slog.ErrorContext(
ctx, "video rate failed",
"error", err,
"args", args,
)
return mcp.NewToolResultError(err.Error()), err
}
slog.InfoContext(
ctx, "video rate completed successfully",
"resultSize", writer.Len(),
)
return mcp.NewToolResultText(writer.String()), nil
}
+14 -1
View File
@@ -3,11 +3,13 @@ package video
import (
"bytes"
"context"
"io"
"log/slog"
"github.com/eat-pray-ai/yutu/cmd"
"github.com/eat-pray-ai/yutu/pkg/video"
"github.com/mark3labs/mcp-go/mcp"
"github.com/spf13/cobra"
"io"
)
const (
@@ -101,11 +103,22 @@ func reportAbuseHandler(
language, _ = args["language"].(string)
onBehalfOfContentOwner, _ = args["onBehalfOfContentOwner"].(string)
slog.InfoContext(ctx, "video reportAbuse started")
var writer bytes.Buffer
err := reportAbuse(&writer)
if err != nil {
slog.ErrorContext(
ctx, "video reportAbuse failed",
"error", err,
"args", args,
)
return mcp.NewToolResultError(err.Error()), err
}
slog.InfoContext(
ctx, "video reportAbuse completed successfully",
"resultSize", writer.Len(),
)
return mcp.NewToolResultText(writer.String()), nil
}
+14 -1
View File
@@ -3,12 +3,14 @@ package video
import (
"bytes"
"context"
"io"
"log/slog"
"github.com/eat-pray-ai/yutu/cmd"
"github.com/eat-pray-ai/yutu/pkg/utils"
"github.com/eat-pray-ai/yutu/pkg/video"
"github.com/mark3labs/mcp-go/mcp"
"github.com/spf13/cobra"
"io"
)
const (
@@ -144,11 +146,22 @@ func updateHandler(
output, _ = args["output"].(string)
jpath, _ = args["jsonpath"].(string)
slog.InfoContext(ctx, "video update started")
var writer bytes.Buffer
err := update(&writer)
if err != nil {
slog.ErrorContext(
ctx, "video update failed",
"error", err,
"args", args,
)
return mcp.NewToolResultError(err.Error()), err
}
slog.InfoContext(
ctx, "video update completed successfully",
"resultSize", writer.Len(),
)
return mcp.NewToolResultText(writer.String()), nil
}
+14 -1
View File
@@ -3,11 +3,13 @@ package videoAbuseReportReason
import (
"bytes"
"context"
"io"
"log/slog"
"github.com/eat-pray-ai/yutu/cmd"
"github.com/eat-pray-ai/yutu/pkg/videoAbuseReportReason"
"github.com/mark3labs/mcp-go/mcp"
"github.com/spf13/cobra"
"io"
)
func init() {
@@ -74,11 +76,22 @@ func listHandler(
output, _ = args["output"].(string)
jpath, _ = args["jsonpath"].(string)
slog.InfoContext(ctx, "videoAbuseReportReason list started")
var writer bytes.Buffer
err := list(&writer)
if err != nil {
slog.ErrorContext(
ctx, "videoAbuseReportReason list failed",
"error", err,
"args", args,
)
return mcp.NewToolResultError(err.Error()), err
}
slog.InfoContext(
ctx, "videoAbuseReportReason list completed successfully",
"resultSize", writer.Len(),
)
return mcp.NewToolResultText(writer.String()), nil
}
+14 -1
View File
@@ -3,11 +3,13 @@ package videoCategory
import (
"bytes"
"context"
"io"
"log/slog"
"github.com/eat-pray-ai/yutu/cmd"
"github.com/eat-pray-ai/yutu/pkg/videoCategory"
"github.com/mark3labs/mcp-go/mcp"
"github.com/spf13/cobra"
"io"
)
func init() {
@@ -91,11 +93,22 @@ func listHandler(
output, _ = args["output"].(string)
jpath, _ = args["jsonpath"].(string)
slog.InfoContext(ctx, "videoCategory list started")
var writer bytes.Buffer
err := list(&writer)
if err != nil {
slog.ErrorContext(
ctx, "videoCategory list failed",
"error", err,
"args", args,
)
return mcp.NewToolResultError(err.Error()), err
}
slog.InfoContext(
ctx, "videoCategory list completed successfully",
"resultSize", writer.Len(),
)
return mcp.NewToolResultText(writer.String()), nil
}
+14 -1
View File
@@ -3,11 +3,13 @@ package watermark
import (
"bytes"
"context"
"io"
"log/slog"
"github.com/eat-pray-ai/yutu/cmd"
"github.com/eat-pray-ai/yutu/pkg/watermark"
"github.com/mark3labs/mcp-go/mcp"
"github.com/spf13/cobra"
"io"
)
const (
@@ -100,11 +102,22 @@ func setHandler(
offsetType, _ = args["offsetType"].(string)
onBehalfOfContentOwner, _ = args["onBehalfOfContentOwner"].(string)
slog.InfoContext(ctx, "watermark set started")
var writer bytes.Buffer
err := set(&writer)
if err != nil {
slog.ErrorContext(
ctx, "watermark set failed",
"error", err,
"args", args,
)
return mcp.NewToolResultError(err.Error()), err
}
slog.InfoContext(
ctx, "watermark set completed successfully",
"resultSize", writer.Len(),
)
return mcp.NewToolResultText(writer.String()), nil
}
+14 -1
View File
@@ -3,11 +3,13 @@ package watermark
import (
"bytes"
"context"
"io"
"log/slog"
"github.com/eat-pray-ai/yutu/cmd"
"github.com/eat-pray-ai/yutu/pkg/watermark"
"github.com/mark3labs/mcp-go/mcp"
"github.com/spf13/cobra"
"io"
)
const (
@@ -55,11 +57,22 @@ func unsetHandler(
args := request.GetArguments()
channelId, _ = args["channelId"].(string)
slog.InfoContext(ctx, "watermark unset started")
var writer bytes.Buffer
err := unset(&writer)
if err != nil {
slog.ErrorContext(
ctx, "watermark unset failed",
"error", err,
"args", args,
)
return mcp.NewToolResultError(err.Error()), err
}
slog.InfoContext(
ctx, "watermark unset completed successfully",
"resultSize", writer.Len(),
)
return mcp.NewToolResultText(writer.String()), nil
}