♻️ Support MCP MRTR and extract confirmation
This commit is contained in:
1 parent
1326df816b
commit
62aed227ee
53 files changed
+627
-561
No files matched your search
+13
-10
@@ -20,6 +20,7 @@ import (
|
||||
|
||||
const (
|
||||
insertTool = "abuseReport-insert"
|
||||
insertConfirm = "Report abuse for %s %s"
|
||||
insertShort = "Insert an abuse report"
|
||||
insertLong = "Insert an abuse report. Use this tool to report abusive content on YouTube such as spam, harassment, or violent content."
|
||||
insertExample = `# Report a video as spam
|
||||
@@ -49,7 +50,6 @@ var insertInSchema = &jsonschema.Schema{
|
||||
Type: "string", Enum: []any{"json", "yaml", "silent"},
|
||||
Description: pkg.SilentUsage, Default: jsontext.Value(`"yaml"`),
|
||||
},
|
||||
"confirmed": {Type: "boolean", Description: pkg.ConfirmedUsage},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -63,13 +63,15 @@ func init() {
|
||||
OpenWorldHint: new(true),
|
||||
ReadOnlyHint: false,
|
||||
},
|
||||
}, cobramcp.GenToolHandler(
|
||||
insertTool, func(input abuseReport.AbuseReport, writer io.Writer) error {
|
||||
if !input.Confirmed {
|
||||
return utils.ErrNotConfirmed
|
||||
}
|
||||
return input.Insert(writer)
|
||||
},
|
||||
}, cobramcp.GenToolHandlerWithMRTR(
|
||||
insertTool, cobramcp.ConfirmThen(
|
||||
func(input abuseReport.AbuseReport) string {
|
||||
return fmt.Sprintf(insertConfirm, input.SubjectTypeId, input.SubjectId)
|
||||
},
|
||||
func(input abuseReport.AbuseReport, w io.Writer) error {
|
||||
return input.Insert(w)
|
||||
},
|
||||
),
|
||||
),
|
||||
)
|
||||
abuseReportCmd.AddCommand(insertCmd)
|
||||
@@ -106,8 +108,9 @@ var insertCmd = &cobra.Command{
|
||||
Long: insertLong,
|
||||
Example: insertExample,
|
||||
PreRunE: func(c *cobra.Command, _ []string) error {
|
||||
msg := fmt.Sprintf("Would report abuse for %s %s", subjectTypeId, subjectId)
|
||||
return utils.ConfirmPreRun(c, msg)
|
||||
return utils.ConfirmPreRun(
|
||||
c, fmt.Sprintf(insertConfirm, subjectTypeId, subjectId),
|
||||
)
|
||||
},
|
||||
Run: func(c *cobra.Command, _ []string) {
|
||||
output, _ := c.Flags().GetString("output")
|
||||
|
||||
+13
-10
@@ -21,6 +21,7 @@ import (
|
||||
const (
|
||||
deleteTool = "caption-delete"
|
||||
deleteIdsUsage = "IDs of the captions to delete"
|
||||
deleteConfirm = "Delete caption(s): %s"
|
||||
deleteShort = "Delete captions"
|
||||
deleteLong = "Delete captions. Use this tool to delete captions of a video by IDs."
|
||||
deleteExample = `# Delete a caption by ID
|
||||
@@ -39,7 +40,6 @@ var deleteInSchema = &jsonschema.Schema{
|
||||
},
|
||||
"on_behalf_of": {Type: "string", Description: pkg.OBOUsage},
|
||||
"on_behalf_of_content_owner": {Type: "string", Description: pkg.OBOCOUsage},
|
||||
"confirmed": {Type: "boolean", Description: pkg.ConfirmedUsage},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -53,13 +53,15 @@ func init() {
|
||||
OpenWorldHint: new(true),
|
||||
ReadOnlyHint: false,
|
||||
},
|
||||
}, cobramcp.GenToolHandler(
|
||||
deleteTool, func(input caption.Caption, writer io.Writer) error {
|
||||
if !input.Confirmed {
|
||||
return utils.ErrNotConfirmed
|
||||
}
|
||||
return input.Delete(writer)
|
||||
},
|
||||
}, cobramcp.GenToolHandlerWithMRTR(
|
||||
deleteTool, cobramcp.ConfirmThen(
|
||||
func(input caption.Caption) string {
|
||||
return fmt.Sprintf(deleteConfirm, strings.Join(input.Ids, ", "))
|
||||
},
|
||||
func(input caption.Caption, w io.Writer) error {
|
||||
return input.Delete(w)
|
||||
},
|
||||
),
|
||||
),
|
||||
)
|
||||
captionCmd.AddCommand(deleteCmd)
|
||||
@@ -79,8 +81,9 @@ var deleteCmd = &cobra.Command{
|
||||
Long: deleteLong,
|
||||
Example: deleteExample,
|
||||
PreRunE: func(c *cobra.Command, _ []string) error {
|
||||
msg := fmt.Sprintf("Would delete caption(s): %s", strings.Join(ids, ", "))
|
||||
return utils.ConfirmPreRun(c, msg)
|
||||
return utils.ConfirmPreRun(
|
||||
c, fmt.Sprintf(deleteConfirm, strings.Join(ids, ", ")),
|
||||
)
|
||||
},
|
||||
Run: func(c *cobra.Command, _ []string) {
|
||||
input := caption.NewCaption(
|
||||
|
||||
+11
-10
@@ -20,6 +20,7 @@ import (
|
||||
|
||||
const (
|
||||
insertTool = "caption-insert"
|
||||
insertConfirm = "Upload caption for video: %s"
|
||||
insertShort = "Insert a caption"
|
||||
insertLong = "Insert a caption. Use this tool to insert a caption to a video."
|
||||
insertExample = `# Insert a caption to a video
|
||||
@@ -60,7 +61,6 @@ var insertInSchema = &jsonschema.Schema{
|
||||
Enum: []any{"json", "yaml", "silent"},
|
||||
Default: jsontext.Value(`"yaml"`),
|
||||
},
|
||||
"confirmed": {Type: "boolean", Description: pkg.ConfirmedUsage},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -74,13 +74,15 @@ func init() {
|
||||
OpenWorldHint: new(true),
|
||||
ReadOnlyHint: false,
|
||||
},
|
||||
}, cobramcp.GenToolHandler(
|
||||
insertTool, func(input caption.Caption, writer io.Writer) error {
|
||||
if !input.Confirmed {
|
||||
return utils.ErrNotConfirmed
|
||||
}
|
||||
return input.Insert(writer)
|
||||
},
|
||||
}, cobramcp.GenToolHandlerWithMRTR(
|
||||
insertTool, cobramcp.ConfirmThen(
|
||||
func(input caption.Caption) string {
|
||||
return fmt.Sprintf(insertConfirm, input.VideoId)
|
||||
},
|
||||
func(input caption.Caption, w io.Writer) error {
|
||||
return input.Insert(w)
|
||||
},
|
||||
),
|
||||
),
|
||||
)
|
||||
captionCmd.AddCommand(insertCmd)
|
||||
@@ -120,8 +122,7 @@ var insertCmd = &cobra.Command{
|
||||
Long: insertLong,
|
||||
Example: insertExample,
|
||||
PreRunE: func(c *cobra.Command, _ []string) error {
|
||||
msg := fmt.Sprintf("Would insert caption: %s", file)
|
||||
return utils.ConfirmPreRun(c, msg)
|
||||
return utils.ConfirmPreRun(c, fmt.Sprintf(insertConfirm, videoId))
|
||||
},
|
||||
Run: func(c *cobra.Command, _ []string) {
|
||||
output, _ := c.Flags().GetString("output")
|
||||
|
||||
+11
-10
@@ -20,6 +20,7 @@ import (
|
||||
|
||||
const (
|
||||
updateTool = "caption-update"
|
||||
updateConfirm = "Update caption for video: %s"
|
||||
updateShort = "Update a video caption"
|
||||
updateLong = "Update a video caption. Use this tool to update a video caption."
|
||||
updateExample = `# Publish a draft caption
|
||||
@@ -59,7 +60,6 @@ var updateInSchema = &jsonschema.Schema{
|
||||
Enum: []any{"json", "yaml", "silent"},
|
||||
Default: jsontext.Value(`"yaml"`),
|
||||
},
|
||||
"confirmed": {Type: "boolean", Description: pkg.ConfirmedUsage},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -73,13 +73,15 @@ func init() {
|
||||
OpenWorldHint: new(true),
|
||||
ReadOnlyHint: false,
|
||||
},
|
||||
}, cobramcp.GenToolHandler(
|
||||
updateTool, func(input caption.Caption, writer io.Writer) error {
|
||||
if !input.Confirmed {
|
||||
return utils.ErrNotConfirmed
|
||||
}
|
||||
return input.Update(writer)
|
||||
},
|
||||
}, cobramcp.GenToolHandlerWithMRTR(
|
||||
updateTool, cobramcp.ConfirmThen(
|
||||
func(input caption.Caption) string {
|
||||
return fmt.Sprintf(updateConfirm, input.VideoId)
|
||||
},
|
||||
func(input caption.Caption, w io.Writer) error {
|
||||
return input.Update(w)
|
||||
},
|
||||
),
|
||||
),
|
||||
)
|
||||
captionCmd.AddCommand(updateCmd)
|
||||
@@ -118,8 +120,7 @@ var updateCmd = &cobra.Command{
|
||||
Long: updateLong,
|
||||
Example: updateExample,
|
||||
PreRunE: func(c *cobra.Command, _ []string) error {
|
||||
msg := fmt.Sprintf("Would update caption for video: %s", videoId)
|
||||
return utils.ConfirmPreRun(c, msg)
|
||||
return utils.ConfirmPreRun(c, fmt.Sprintf(updateConfirm, videoId))
|
||||
},
|
||||
Run: func(c *cobra.Command, _ []string) {
|
||||
output, _ := c.Flags().GetString("output")
|
||||
|
||||
+13
-10
@@ -22,6 +22,7 @@ import (
|
||||
const (
|
||||
updateTool = "channel-update"
|
||||
updateIdUsage = "ID of the channel to update"
|
||||
updateConfirm = "Update channel: %s"
|
||||
updateShort = "Update channel information"
|
||||
updateLong = "Update channel information. Use this tool to update channel information."
|
||||
updateExample = `# Update channel description
|
||||
@@ -49,7 +50,6 @@ var updateInSchema = &jsonschema.Schema{
|
||||
Type: "string", Enum: []any{"json", "yaml", "silent"},
|
||||
Description: pkg.SilentUsage, Default: jsontext.Value(`"yaml"`),
|
||||
},
|
||||
"confirmed": {Type: "boolean", Description: pkg.ConfirmedUsage},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -63,13 +63,15 @@ func init() {
|
||||
OpenWorldHint: new(true),
|
||||
ReadOnlyHint: false,
|
||||
},
|
||||
}, cobramcp.GenToolHandler(
|
||||
updateTool, func(input channel.Channel, writer io.Writer) error {
|
||||
if !input.Confirmed {
|
||||
return utils.ErrNotConfirmed
|
||||
}
|
||||
return input.Update(writer)
|
||||
},
|
||||
}, cobramcp.GenToolHandlerWithMRTR(
|
||||
updateTool, cobramcp.ConfirmThen(
|
||||
func(input channel.Channel) string {
|
||||
return fmt.Sprintf(updateConfirm, strings.Join(input.Ids, ", "))
|
||||
},
|
||||
func(input channel.Channel, w io.Writer) error {
|
||||
return input.Update(w)
|
||||
},
|
||||
),
|
||||
),
|
||||
)
|
||||
channelCmd.AddCommand(updateCmd)
|
||||
@@ -95,8 +97,9 @@ var updateCmd = &cobra.Command{
|
||||
Long: updateLong,
|
||||
Example: updateExample,
|
||||
PreRunE: func(c *cobra.Command, _ []string) error {
|
||||
msg := fmt.Sprintf("Would update channel: %s", strings.Join(ids, ", "))
|
||||
return utils.ConfirmPreRun(c, msg)
|
||||
return utils.ConfirmPreRun(
|
||||
c, fmt.Sprintf(updateConfirm, strings.Join(ids, ", ")),
|
||||
)
|
||||
},
|
||||
Run: func(c *cobra.Command, _ []string) {
|
||||
output, _ := c.Flags().GetString("output")
|
||||
|
||||
+11
-11
@@ -20,6 +20,7 @@ import (
|
||||
|
||||
const (
|
||||
insertTool = "channelBanner-insert"
|
||||
insertConfirm = "Insert channel banner: %s"
|
||||
insertShort = "Insert a channel banner"
|
||||
insertLong = "Insert a channel banner. Use this tool to upload a channel banner."
|
||||
insertExample = `# Upload a channel banner
|
||||
@@ -47,7 +48,6 @@ var insertInSchema = &jsonschema.Schema{
|
||||
Type: "string", Enum: []any{"json", "yaml", "silent"},
|
||||
Description: pkg.SilentUsage, Default: jsontext.Value(`"yaml"`),
|
||||
},
|
||||
"confirmed": {Type: "boolean", Description: pkg.ConfirmedUsage},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -61,14 +61,15 @@ func init() {
|
||||
OpenWorldHint: new(true),
|
||||
ReadOnlyHint: false,
|
||||
},
|
||||
}, cobramcp.GenToolHandler(
|
||||
insertTool,
|
||||
func(input channelBanner.ChannelBanner, writer io.Writer) error {
|
||||
if !input.Confirmed {
|
||||
return utils.ErrNotConfirmed
|
||||
}
|
||||
return input.Insert(writer)
|
||||
},
|
||||
}, cobramcp.GenToolHandlerWithMRTR(
|
||||
insertTool, cobramcp.ConfirmThen(
|
||||
func(input channelBanner.ChannelBanner) string {
|
||||
return fmt.Sprintf(insertConfirm, input.File)
|
||||
},
|
||||
func(input channelBanner.ChannelBanner, w io.Writer) error {
|
||||
return input.Insert(w)
|
||||
},
|
||||
),
|
||||
),
|
||||
)
|
||||
channelBannerCmd.AddCommand(insertCmd)
|
||||
@@ -94,8 +95,7 @@ var insertCmd = &cobra.Command{
|
||||
Long: insertLong,
|
||||
Example: insertExample,
|
||||
PreRunE: func(c *cobra.Command, _ []string) error {
|
||||
msg := fmt.Sprintf("Would insert channel banner: %s", file)
|
||||
return utils.ConfirmPreRun(c, msg)
|
||||
return utils.ConfirmPreRun(c, fmt.Sprintf(insertConfirm, file))
|
||||
},
|
||||
Run: func(c *cobra.Command, _ []string) {
|
||||
output, _ := c.Flags().GetString("output")
|
||||
|
||||
@@ -21,6 +21,7 @@ import (
|
||||
const (
|
||||
deleteTool = "channelSection-delete"
|
||||
deleteIdsUsage = "Delete the channel sections with the given ids"
|
||||
deleteConfirm = "Delete channel section(s): %s"
|
||||
deleteShort = "Delete channel sections"
|
||||
deleteLong = "Delete channel sections. Use this tool to delete channel sections by IDs."
|
||||
deleteExample = `# Delete a channel section by ID
|
||||
@@ -38,7 +39,6 @@ var deleteInSchema = &jsonschema.Schema{
|
||||
Items: &jsonschema.Schema{Type: "string"},
|
||||
},
|
||||
"on_behalf_of_content_owner": {Type: "string", Description: pkg.OBOCOUsage},
|
||||
"confirmed": {Type: "boolean", Description: pkg.ConfirmedUsage},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -52,14 +52,15 @@ func init() {
|
||||
OpenWorldHint: new(true),
|
||||
ReadOnlyHint: false,
|
||||
},
|
||||
}, cobramcp.GenToolHandler(
|
||||
deleteTool,
|
||||
func(input channelSection.ChannelSection, writer io.Writer) error {
|
||||
if !input.Confirmed {
|
||||
return utils.ErrNotConfirmed
|
||||
}
|
||||
return input.Delete(writer)
|
||||
},
|
||||
}, cobramcp.GenToolHandlerWithMRTR(
|
||||
deleteTool, cobramcp.ConfirmThen(
|
||||
func(input channelSection.ChannelSection) string {
|
||||
return fmt.Sprintf(deleteConfirm, strings.Join(input.Ids, ", "))
|
||||
},
|
||||
func(input channelSection.ChannelSection, w io.Writer) error {
|
||||
return input.Delete(w)
|
||||
},
|
||||
),
|
||||
),
|
||||
)
|
||||
channelSectionCmd.AddCommand(deleteCmd)
|
||||
@@ -78,10 +79,9 @@ var deleteCmd = &cobra.Command{
|
||||
Long: deleteLong,
|
||||
Example: deleteExample,
|
||||
PreRunE: func(c *cobra.Command, _ []string) error {
|
||||
msg := fmt.Sprintf(
|
||||
"Would delete channel section(s): %s", strings.Join(ids, ", "),
|
||||
return utils.ConfirmPreRun(
|
||||
c, fmt.Sprintf(deleteConfirm, strings.Join(ids, ", ")),
|
||||
)
|
||||
return utils.ConfirmPreRun(c, msg)
|
||||
},
|
||||
Run: func(c *cobra.Command, _ []string) {
|
||||
input := channelSection.NewChannelSection(
|
||||
|
||||
+13
-10
@@ -20,6 +20,7 @@ import (
|
||||
|
||||
const (
|
||||
deleteTool = "comment-delete"
|
||||
deleteConfirm = "Delete comment(s): %s"
|
||||
deleteShort = "Delete comments"
|
||||
deleteLong = "Delete comments. Use this tool to delete comments by IDs."
|
||||
deleteExample = `# Delete a comment by ID
|
||||
@@ -36,7 +37,6 @@ var deleteInSchema = &jsonschema.Schema{
|
||||
Type: "array", Description: idsUsage,
|
||||
Items: &jsonschema.Schema{Type: "string"},
|
||||
},
|
||||
"confirmed": {Type: "boolean", Description: pkg.ConfirmedUsage},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -50,13 +50,15 @@ func init() {
|
||||
OpenWorldHint: new(true),
|
||||
ReadOnlyHint: false,
|
||||
},
|
||||
}, cobramcp.GenToolHandler(
|
||||
deleteTool, func(input comment.Comment, writer io.Writer) error {
|
||||
if !input.Confirmed {
|
||||
return utils.ErrNotConfirmed
|
||||
}
|
||||
return input.Delete(writer)
|
||||
},
|
||||
}, cobramcp.GenToolHandlerWithMRTR(
|
||||
deleteTool, cobramcp.ConfirmThen(
|
||||
func(input comment.Comment) string {
|
||||
return fmt.Sprintf(deleteConfirm, strings.Join(input.Ids, ", "))
|
||||
},
|
||||
func(input comment.Comment, w io.Writer) error {
|
||||
return input.Delete(w)
|
||||
},
|
||||
),
|
||||
),
|
||||
)
|
||||
commentCmd.AddCommand(deleteCmd)
|
||||
@@ -72,8 +74,9 @@ var deleteCmd = &cobra.Command{
|
||||
Long: deleteLong,
|
||||
Example: deleteExample,
|
||||
PreRunE: func(c *cobra.Command, _ []string) error {
|
||||
msg := fmt.Sprintf("Would delete comment(s): %s", strings.Join(ids, ", "))
|
||||
return utils.ConfirmPreRun(c, msg)
|
||||
return utils.ConfirmPreRun(
|
||||
c, fmt.Sprintf(deleteConfirm, strings.Join(ids, ", ")),
|
||||
)
|
||||
},
|
||||
Run: func(c *cobra.Command, _ []string) {
|
||||
input := comment.NewComment(comment.WithIds(ids))
|
||||
|
||||
+11
-10
@@ -21,6 +21,7 @@ import (
|
||||
const (
|
||||
insertTool = "comment-insert"
|
||||
insertPidUsage = "ID of the parent comment"
|
||||
insertConfirm = "Insert comment on parent: %s"
|
||||
insertShort = "Create a comment"
|
||||
insertLong = "Create a comment. Use this tool to create a comment on a video."
|
||||
insertExample = `# Reply to a comment
|
||||
@@ -45,7 +46,6 @@ var insertInSchema = &jsonschema.Schema{
|
||||
Type: "string", Enum: []any{"json", "yaml", "silent"},
|
||||
Description: pkg.SilentUsage, Default: jsontext.Value(`"yaml"`),
|
||||
},
|
||||
"confirmed": {Type: "boolean", Description: pkg.ConfirmedUsage},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -59,13 +59,15 @@ func init() {
|
||||
OpenWorldHint: new(true),
|
||||
ReadOnlyHint: false,
|
||||
},
|
||||
}, cobramcp.GenToolHandler(
|
||||
insertTool, func(input comment.Comment, writer io.Writer) error {
|
||||
if !input.Confirmed {
|
||||
return utils.ErrNotConfirmed
|
||||
}
|
||||
return input.Insert(writer)
|
||||
},
|
||||
}, cobramcp.GenToolHandlerWithMRTR(
|
||||
insertTool, cobramcp.ConfirmThen(
|
||||
func(input comment.Comment) string {
|
||||
return fmt.Sprintf(insertConfirm, input.ParentId)
|
||||
},
|
||||
func(input comment.Comment, w io.Writer) error {
|
||||
return input.Insert(w)
|
||||
},
|
||||
),
|
||||
),
|
||||
)
|
||||
commentCmd.AddCommand(insertCmd)
|
||||
@@ -96,8 +98,7 @@ var insertCmd = &cobra.Command{
|
||||
Long: insertLong,
|
||||
Example: insertExample,
|
||||
PreRunE: func(c *cobra.Command, _ []string) error {
|
||||
msg := fmt.Sprintf("Would insert comment on parent: %s", parentId)
|
||||
return utils.ConfirmPreRun(c, msg)
|
||||
return utils.ConfirmPreRun(c, fmt.Sprintf(insertConfirm, parentId))
|
||||
},
|
||||
Run: func(c *cobra.Command, _ []string) {
|
||||
output, _ := c.Flags().GetString("output")
|
||||
|
||||
+12
-11
@@ -21,6 +21,7 @@ import (
|
||||
|
||||
const (
|
||||
masTool = "comment-markAsSpam"
|
||||
masConfirm = "Mark comment(s) as spam: %s"
|
||||
masShort = "Mark comments as spam"
|
||||
masLong = "Mark comments as spam. Use this tool to mark comments as spam."
|
||||
masExample = `# Mark a comment as spam
|
||||
@@ -41,7 +42,6 @@ var markAsSpamInSchema = &jsonschema.Schema{
|
||||
Type: "string", Enum: []any{"json", "yaml", "silent"},
|
||||
Description: pkg.SilentUsage, Default: jsontext.Value(`"yaml"`),
|
||||
},
|
||||
"confirmed": {Type: "boolean", Description: pkg.ConfirmedUsage},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -55,13 +55,15 @@ func init() {
|
||||
OpenWorldHint: new(true),
|
||||
ReadOnlyHint: false,
|
||||
},
|
||||
}, cobramcp.GenToolHandler(
|
||||
masTool, func(input comment.Comment, writer io.Writer) error {
|
||||
if !input.Confirmed {
|
||||
return utils.ErrNotConfirmed
|
||||
}
|
||||
return input.MarkAsSpam(writer)
|
||||
},
|
||||
}, cobramcp.GenToolHandlerWithMRTR(
|
||||
masTool, cobramcp.ConfirmThen(
|
||||
func(input comment.Comment) string {
|
||||
return fmt.Sprintf(masConfirm, strings.Join(input.Ids, ", "))
|
||||
},
|
||||
func(input comment.Comment, w io.Writer) error {
|
||||
return input.MarkAsSpam(w)
|
||||
},
|
||||
),
|
||||
),
|
||||
)
|
||||
commentCmd.AddCommand(markAsSpamCmd)
|
||||
@@ -78,10 +80,9 @@ var markAsSpamCmd = &cobra.Command{
|
||||
Long: masLong,
|
||||
Example: masExample,
|
||||
PreRunE: func(c *cobra.Command, _ []string) error {
|
||||
msg := fmt.Sprintf(
|
||||
"Would mark comment(s) as spam: %s", strings.Join(ids, ", "),
|
||||
return utils.ConfirmPreRun(
|
||||
c, fmt.Sprintf(masConfirm, strings.Join(ids, ", ")),
|
||||
)
|
||||
return utils.ConfirmPreRun(c, msg)
|
||||
},
|
||||
Run: func(c *cobra.Command, _ []string) {
|
||||
output, _ := c.Flags().GetString("output")
|
||||
|
||||
@@ -21,6 +21,7 @@ import (
|
||||
|
||||
const (
|
||||
smsTool = "comment-setModerationStatus"
|
||||
smsConfirm = "Set moderation status of comment(s): %s to %s"
|
||||
smsShort = "Set comment moderation status"
|
||||
smsLong = "Set comment moderation status. Use this tool to set comment moderation status."
|
||||
smsExample = `# Publish a held comment
|
||||
@@ -48,7 +49,6 @@ var setModerationStatusInSchema = &jsonschema.Schema{
|
||||
Type: "string", Enum: []any{"json", "yaml", "silent"},
|
||||
Description: pkg.SilentUsage, Default: jsontext.Value(`"yaml"`),
|
||||
},
|
||||
"confirmed": {Type: "boolean", Description: pkg.ConfirmedUsage},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -63,13 +63,17 @@ func init() {
|
||||
OpenWorldHint: new(true),
|
||||
ReadOnlyHint: false,
|
||||
},
|
||||
}, cobramcp.GenToolHandler(
|
||||
smsTool, func(input comment.Comment, writer io.Writer) error {
|
||||
if !input.Confirmed {
|
||||
return utils.ErrNotConfirmed
|
||||
}
|
||||
return input.SetModerationStatus(writer)
|
||||
},
|
||||
}, cobramcp.GenToolHandlerWithMRTR(
|
||||
smsTool, cobramcp.ConfirmThen(
|
||||
func(input comment.Comment) string {
|
||||
return fmt.Sprintf(
|
||||
smsConfirm, strings.Join(input.Ids, ", "), input.ModerationStatus,
|
||||
)
|
||||
},
|
||||
func(input comment.Comment, w io.Writer) error {
|
||||
return input.SetModerationStatus(w)
|
||||
},
|
||||
),
|
||||
),
|
||||
)
|
||||
commentCmd.AddCommand(setModerationStatusCmd)
|
||||
@@ -95,11 +99,9 @@ var setModerationStatusCmd = &cobra.Command{
|
||||
Long: smsLong,
|
||||
Example: smsExample,
|
||||
PreRunE: func(c *cobra.Command, _ []string) error {
|
||||
msg := fmt.Sprintf(
|
||||
"Would set moderation status of comment(s): %s to %s",
|
||||
strings.Join(ids, ", "), moderationStatus,
|
||||
return utils.ConfirmPreRun(
|
||||
c, fmt.Sprintf(smsConfirm, strings.Join(ids, ", "), moderationStatus),
|
||||
)
|
||||
return utils.ConfirmPreRun(c, msg)
|
||||
},
|
||||
Run: func(c *cobra.Command, _ []string) {
|
||||
output, _ := c.Flags().GetString("output")
|
||||
|
||||
+13
-10
@@ -22,6 +22,7 @@ import (
|
||||
const (
|
||||
updateTool = "comment-update"
|
||||
updateIdUsage = "ID of the comment"
|
||||
updateConfirm = "Update comment: %s"
|
||||
updateShort = "Update a comment on a video"
|
||||
updateLong = "Update a comment on a video. Use this tool to update a comment on a video."
|
||||
updateExample = `# Update comment text
|
||||
@@ -50,7 +51,6 @@ var updateInSchema = &jsonschema.Schema{
|
||||
Type: "string", Enum: []any{"json", "yaml", "silent"},
|
||||
Description: pkg.SilentUsage, Default: jsontext.Value(`"yaml"`),
|
||||
},
|
||||
"confirmed": {Type: "boolean", Description: pkg.ConfirmedUsage},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -64,13 +64,15 @@ func init() {
|
||||
OpenWorldHint: new(true),
|
||||
ReadOnlyHint: false,
|
||||
},
|
||||
}, cobramcp.GenToolHandler(
|
||||
updateTool, func(input comment.Comment, writer io.Writer) error {
|
||||
if !input.Confirmed {
|
||||
return utils.ErrNotConfirmed
|
||||
}
|
||||
return input.Update(writer)
|
||||
},
|
||||
}, cobramcp.GenToolHandlerWithMRTR(
|
||||
updateTool, cobramcp.ConfirmThen(
|
||||
func(input comment.Comment) string {
|
||||
return fmt.Sprintf(updateConfirm, strings.Join(input.Ids, ", "))
|
||||
},
|
||||
func(input comment.Comment, w io.Writer) error {
|
||||
return input.Update(w)
|
||||
},
|
||||
),
|
||||
),
|
||||
)
|
||||
commentCmd.AddCommand(updateCmd)
|
||||
@@ -94,8 +96,9 @@ var updateCmd = &cobra.Command{
|
||||
Long: updateLong,
|
||||
Example: updateExample,
|
||||
PreRunE: func(c *cobra.Command, _ []string) error {
|
||||
msg := fmt.Sprintf("Would update comment: %s", strings.Join(ids, ", "))
|
||||
return utils.ConfirmPreRun(c, msg)
|
||||
return utils.ConfirmPreRun(
|
||||
c, fmt.Sprintf(updateConfirm, strings.Join(ids, ", ")),
|
||||
)
|
||||
},
|
||||
Run: func(c *cobra.Command, _ []string) {
|
||||
output, _ := c.Flags().GetString("output")
|
||||
|
||||
+11
-11
@@ -21,6 +21,7 @@ import (
|
||||
const (
|
||||
insertTool = "commentThread-insert"
|
||||
insertVidUsage = "ID of the video"
|
||||
insertConfirm = "Insert comment thread on video: %s"
|
||||
insertShort = "Insert a new comment thread"
|
||||
insertLong = "Insert a new comment thread. Use this tool to insert a new comment thread."
|
||||
insertExample = `# Post a comment on a video
|
||||
@@ -43,7 +44,6 @@ var insertInSchema = &jsonschema.Schema{
|
||||
Type: "string", Enum: []any{"json", "yaml", "silent"},
|
||||
Description: pkg.SilentUsage, Default: jsontext.Value(`"yaml"`),
|
||||
},
|
||||
"confirmed": {Type: "boolean", Description: pkg.ConfirmedUsage},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -57,14 +57,15 @@ func init() {
|
||||
OpenWorldHint: new(true),
|
||||
ReadOnlyHint: false,
|
||||
},
|
||||
}, cobramcp.GenToolHandler(
|
||||
insertTool,
|
||||
func(input commentThread.CommentThread, writer io.Writer) error {
|
||||
if !input.Confirmed {
|
||||
return utils.ErrNotConfirmed
|
||||
}
|
||||
return input.Insert(writer)
|
||||
},
|
||||
}, cobramcp.GenToolHandlerWithMRTR(
|
||||
insertTool, cobramcp.ConfirmThen(
|
||||
func(input commentThread.CommentThread) string {
|
||||
return fmt.Sprintf(insertConfirm, input.VideoId)
|
||||
},
|
||||
func(input commentThread.CommentThread, w io.Writer) error {
|
||||
return input.Insert(w)
|
||||
},
|
||||
),
|
||||
),
|
||||
)
|
||||
commentThreadCmd.AddCommand(insertCmd)
|
||||
@@ -87,8 +88,7 @@ var insertCmd = &cobra.Command{
|
||||
Long: insertLong,
|
||||
Example: insertExample,
|
||||
PreRunE: func(c *cobra.Command, _ []string) error {
|
||||
msg := fmt.Sprintf("Would insert comment thread on video: %s", videoId)
|
||||
return utils.ConfirmPreRun(c, msg)
|
||||
return utils.ConfirmPreRun(c, fmt.Sprintf(insertConfirm, videoId))
|
||||
},
|
||||
Run: func(c *cobra.Command, _ []string) {
|
||||
output, _ := c.Flags().GetString("output")
|
||||
|
||||
+14
-12
@@ -21,6 +21,7 @@ import (
|
||||
|
||||
const (
|
||||
bindTool = "liveBroadcast-bind"
|
||||
bindConfirm = "Bind live broadcast(s) %s to stream %s"
|
||||
bindShort = "Bind a live broadcast to a stream"
|
||||
bindLong = "Bind a live broadcast to a stream. Use this tool to bind or unbind a live stream to/from a live broadcast."
|
||||
bindExample = `# Bind a broadcast to a stream
|
||||
@@ -51,7 +52,6 @@ var bindInSchema = &jsonschema.Schema{
|
||||
Type: "string", Enum: []any{"json", "yaml", "silent"},
|
||||
Description: pkg.SilentUsage, Default: jsontext.Value(`"yaml"`),
|
||||
},
|
||||
"confirmed": {Type: "boolean", Description: pkg.ConfirmedUsage},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -65,13 +65,17 @@ func init() {
|
||||
OpenWorldHint: new(true),
|
||||
ReadOnlyHint: false,
|
||||
},
|
||||
}, cobramcp.GenToolHandler(
|
||||
bindTool, func(input liveBroadcast.LiveBroadcast, writer io.Writer) error {
|
||||
if !input.Confirmed {
|
||||
return utils.ErrNotConfirmed
|
||||
}
|
||||
return input.Bind(writer)
|
||||
},
|
||||
}, cobramcp.GenToolHandlerWithMRTR(
|
||||
bindTool, cobramcp.ConfirmThen(
|
||||
func(input liveBroadcast.LiveBroadcast) string {
|
||||
return fmt.Sprintf(
|
||||
bindConfirm, strings.Join(input.Ids, ", "), input.StreamId,
|
||||
)
|
||||
},
|
||||
func(input liveBroadcast.LiveBroadcast, w io.Writer) error {
|
||||
return input.Bind(w)
|
||||
},
|
||||
),
|
||||
),
|
||||
)
|
||||
liveBroadcastCmd.AddCommand(bindCmd)
|
||||
@@ -102,11 +106,9 @@ var bindCmd = &cobra.Command{
|
||||
Long: bindLong,
|
||||
Example: bindExample,
|
||||
PreRunE: func(c *cobra.Command, _ []string) error {
|
||||
msg := fmt.Sprintf(
|
||||
"Would bind live broadcast(s) %s to stream %s",
|
||||
strings.Join(ids, ", "), streamId,
|
||||
return utils.ConfirmPreRun(
|
||||
c, fmt.Sprintf(bindConfirm, strings.Join(ids, ", "), streamId),
|
||||
)
|
||||
return utils.ConfirmPreRun(c, msg)
|
||||
},
|
||||
Run: func(c *cobra.Command, _ []string) {
|
||||
output, _ := c.Flags().GetString("output")
|
||||
|
||||
+12
-12
@@ -20,6 +20,7 @@ import (
|
||||
|
||||
const (
|
||||
deleteTool = "liveBroadcast-delete"
|
||||
deleteConfirm = "Delete live broadcast(s): %s"
|
||||
deleteIdsUsage = "IDs of the live broadcasts to delete"
|
||||
deleteShort = "Delete live broadcasts"
|
||||
deleteLong = "Delete live broadcasts. Use this tool to delete live broadcasts by their IDs."
|
||||
@@ -41,7 +42,6 @@ var deleteInSchema = &jsonschema.Schema{
|
||||
"on_behalf_of_content_owner_channel": {
|
||||
Type: "string", Description: obococUsage,
|
||||
},
|
||||
"confirmed": {Type: "boolean", Description: pkg.ConfirmedUsage},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -55,14 +55,15 @@ func init() {
|
||||
OpenWorldHint: new(true),
|
||||
ReadOnlyHint: false,
|
||||
},
|
||||
}, cobramcp.GenToolHandler(
|
||||
deleteTool,
|
||||
func(input liveBroadcast.LiveBroadcast, writer io.Writer) error {
|
||||
if !input.Confirmed {
|
||||
return utils.ErrNotConfirmed
|
||||
}
|
||||
return input.Delete(writer)
|
||||
},
|
||||
}, cobramcp.GenToolHandlerWithMRTR(
|
||||
deleteTool, cobramcp.ConfirmThen(
|
||||
func(input liveBroadcast.LiveBroadcast) string {
|
||||
return fmt.Sprintf(deleteConfirm, strings.Join(input.Ids, ", "))
|
||||
},
|
||||
func(input liveBroadcast.LiveBroadcast, w io.Writer) error {
|
||||
return input.Delete(w)
|
||||
},
|
||||
),
|
||||
),
|
||||
)
|
||||
liveBroadcastCmd.AddCommand(deleteCmd)
|
||||
@@ -85,10 +86,9 @@ var deleteCmd = &cobra.Command{
|
||||
Long: deleteLong,
|
||||
Example: deleteExample,
|
||||
PreRunE: func(c *cobra.Command, _ []string) error {
|
||||
msg := fmt.Sprintf(
|
||||
"Would delete live broadcast(s): %s", strings.Join(ids, ", "),
|
||||
return utils.ConfirmPreRun(
|
||||
c, fmt.Sprintf(deleteConfirm, strings.Join(ids, ", ")),
|
||||
)
|
||||
return utils.ConfirmPreRun(c, msg)
|
||||
},
|
||||
Run: func(c *cobra.Command, _ []string) {
|
||||
input := liveBroadcast.NewLiveBroadcast(
|
||||
|
||||
+11
-11
@@ -20,6 +20,7 @@ import (
|
||||
|
||||
const (
|
||||
insertTool = "liveBroadcast-insert"
|
||||
insertConfirm = "Create live broadcast: %s"
|
||||
insertShort = "Insert a live broadcast"
|
||||
insertLong = "Insert a live broadcast. Use this tool to create a new live broadcast for the authenticated user."
|
||||
insertExample = `# Create a public live broadcast
|
||||
@@ -53,7 +54,6 @@ var insertInSchema = &jsonschema.Schema{
|
||||
Type: "string", Enum: []any{"json", "yaml", "silent"},
|
||||
Description: pkg.SilentUsage, Default: jsontext.Value(`"yaml"`),
|
||||
},
|
||||
"confirmed": {Type: "boolean", Description: pkg.ConfirmedUsage},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -67,14 +67,15 @@ func init() {
|
||||
OpenWorldHint: new(true),
|
||||
ReadOnlyHint: false,
|
||||
},
|
||||
}, cobramcp.GenToolHandler(
|
||||
insertTool,
|
||||
func(input liveBroadcast.LiveBroadcast, writer io.Writer) error {
|
||||
if !input.Confirmed {
|
||||
return utils.ErrNotConfirmed
|
||||
}
|
||||
return input.Insert(writer)
|
||||
},
|
||||
}, cobramcp.GenToolHandlerWithMRTR(
|
||||
insertTool, cobramcp.ConfirmThen(
|
||||
func(input liveBroadcast.LiveBroadcast) string {
|
||||
return fmt.Sprintf(insertConfirm, input.Title)
|
||||
},
|
||||
func(input liveBroadcast.LiveBroadcast, w io.Writer) error {
|
||||
return input.Insert(w)
|
||||
},
|
||||
),
|
||||
),
|
||||
)
|
||||
liveBroadcastCmd.AddCommand(insertCmd)
|
||||
@@ -111,8 +112,7 @@ var insertCmd = &cobra.Command{
|
||||
Long: insertLong,
|
||||
Example: insertExample,
|
||||
PreRunE: func(c *cobra.Command, _ []string) error {
|
||||
msg := fmt.Sprintf("Would create live broadcast: %s", title)
|
||||
return utils.ConfirmPreRun(c, msg)
|
||||
return utils.ConfirmPreRun(c, fmt.Sprintf(insertConfirm, title))
|
||||
},
|
||||
Run: func(c *cobra.Command, _ []string) {
|
||||
output, _ := c.Flags().GetString("output")
|
||||
|
||||
@@ -21,6 +21,7 @@ import (
|
||||
|
||||
const (
|
||||
insertCuepointTool = "liveBroadcast-insertCuepoint"
|
||||
insertCuepointConfirm = "Insert cuepoint into live broadcast(s): %s"
|
||||
insertCuepointShort = "Insert a cuepoint into a live broadcast"
|
||||
insertCuepointLong = "Insert a cuepoint into a live broadcast. Use this tool to insert an ad break cuepoint into a currently live broadcast."
|
||||
insertCuepointExample = `# Insert an ad cuepoint of 30 seconds
|
||||
@@ -52,7 +53,6 @@ var insertCuepointInSchema = &jsonschema.Schema{
|
||||
Type: "string", Enum: []any{"json", "yaml", "silent"},
|
||||
Description: pkg.SilentUsage, Default: jsontext.Value(`"yaml"`),
|
||||
},
|
||||
"confirmed": {Type: "boolean", Description: pkg.ConfirmedUsage},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -66,14 +66,17 @@ func init() {
|
||||
OpenWorldHint: new(true),
|
||||
ReadOnlyHint: false,
|
||||
},
|
||||
}, cobramcp.GenToolHandler(
|
||||
insertCuepointTool,
|
||||
func(input liveBroadcast.LiveBroadcast, writer io.Writer) error {
|
||||
if !input.Confirmed {
|
||||
return utils.ErrNotConfirmed
|
||||
}
|
||||
return input.InsertCuepoint(writer)
|
||||
},
|
||||
}, cobramcp.GenToolHandlerWithMRTR(
|
||||
insertCuepointTool, cobramcp.ConfirmThen(
|
||||
func(input liveBroadcast.LiveBroadcast) string {
|
||||
return fmt.Sprintf(
|
||||
insertCuepointConfirm, strings.Join(input.Ids, ", "),
|
||||
)
|
||||
},
|
||||
func(input liveBroadcast.LiveBroadcast, w io.Writer) error {
|
||||
return input.InsertCuepoint(w)
|
||||
},
|
||||
),
|
||||
),
|
||||
)
|
||||
liveBroadcastCmd.AddCommand(insertCuepointCmd)
|
||||
@@ -111,11 +114,9 @@ var insertCuepointCmd = &cobra.Command{
|
||||
Long: insertCuepointLong,
|
||||
Example: insertCuepointExample,
|
||||
PreRunE: func(c *cobra.Command, _ []string) error {
|
||||
msg := fmt.Sprintf(
|
||||
"Would insert cuepoint into live broadcast(s): %s",
|
||||
strings.Join(ids, ", "),
|
||||
return utils.ConfirmPreRun(
|
||||
c, fmt.Sprintf(insertCuepointConfirm, strings.Join(ids, ", ")),
|
||||
)
|
||||
return utils.ConfirmPreRun(c, msg)
|
||||
},
|
||||
Run: func(c *cobra.Command, _ []string) {
|
||||
output, _ := c.Flags().GetString("output")
|
||||
|
||||
@@ -21,6 +21,7 @@ import (
|
||||
|
||||
const (
|
||||
transitionTool = "liveBroadcast-transition"
|
||||
transitionConfirm = "Transition live broadcast(s) %s to %s"
|
||||
transitionBsUsage = "Broadcast status to transition to (testing, live, complete)"
|
||||
transitionShort = "Transition a live broadcast"
|
||||
transitionLong = "Transition a live broadcast. Use this tool to change the status of a live broadcast (e.g., go live, end broadcast)."
|
||||
@@ -55,7 +56,6 @@ var transitionInSchema = &jsonschema.Schema{
|
||||
Type: "string", Enum: []any{"json", "yaml", "silent"},
|
||||
Description: pkg.SilentUsage, Default: jsontext.Value(`"yaml"`),
|
||||
},
|
||||
"confirmed": {Type: "boolean", Description: pkg.ConfirmedUsage},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -69,14 +69,18 @@ func init() {
|
||||
OpenWorldHint: new(true),
|
||||
ReadOnlyHint: false,
|
||||
},
|
||||
}, cobramcp.GenToolHandler(
|
||||
transitionTool,
|
||||
func(input liveBroadcast.LiveBroadcast, writer io.Writer) error {
|
||||
if !input.Confirmed {
|
||||
return utils.ErrNotConfirmed
|
||||
}
|
||||
return input.Transition(writer)
|
||||
},
|
||||
}, cobramcp.GenToolHandlerWithMRTR(
|
||||
transitionTool, cobramcp.ConfirmThen(
|
||||
func(input liveBroadcast.LiveBroadcast) string {
|
||||
return fmt.Sprintf(
|
||||
transitionConfirm, strings.Join(input.Ids, ", "),
|
||||
input.BroadcastStatus,
|
||||
)
|
||||
},
|
||||
func(input liveBroadcast.LiveBroadcast, w io.Writer) error {
|
||||
return input.Transition(w)
|
||||
},
|
||||
),
|
||||
),
|
||||
)
|
||||
liveBroadcastCmd.AddCommand(transitionCmd)
|
||||
@@ -109,11 +113,10 @@ var transitionCmd = &cobra.Command{
|
||||
Long: transitionLong,
|
||||
Example: transitionExample,
|
||||
PreRunE: func(c *cobra.Command, _ []string) error {
|
||||
msg := fmt.Sprintf(
|
||||
"Would transition live broadcast(s) %s to %s",
|
||||
strings.Join(ids, ", "), broadcastStatus,
|
||||
return utils.ConfirmPreRun(
|
||||
c,
|
||||
fmt.Sprintf(transitionConfirm, strings.Join(ids, ", "), broadcastStatus),
|
||||
)
|
||||
return utils.ConfirmPreRun(c, msg)
|
||||
},
|
||||
Run: func(c *cobra.Command, _ []string) {
|
||||
output, _ := c.Flags().GetString("output")
|
||||
|
||||
+13
-13
@@ -21,6 +21,7 @@ import (
|
||||
|
||||
const (
|
||||
updateTool = "liveBroadcast-update"
|
||||
updateConfirm = "Update live broadcast: %s"
|
||||
updateIdUsage = "ID of the live broadcast to update"
|
||||
updateShort = "Update a live broadcast"
|
||||
updateLong = "Update a live broadcast. Use this tool to update an existing live broadcast's settings."
|
||||
@@ -54,7 +55,6 @@ var updateInSchema = &jsonschema.Schema{
|
||||
Type: "string", Enum: []any{"json", "yaml", "silent"},
|
||||
Description: pkg.SilentUsage, Default: jsontext.Value(`"yaml"`),
|
||||
},
|
||||
"confirmed": {Type: "boolean", Description: pkg.ConfirmedUsage},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -68,15 +68,16 @@ func init() {
|
||||
OpenWorldHint: new(true),
|
||||
ReadOnlyHint: false,
|
||||
},
|
||||
}, cobramcp.GenToolHandler(
|
||||
updateTool,
|
||||
func(input liveBroadcast.LiveBroadcast, writer io.Writer) error {
|
||||
if !input.Confirmed {
|
||||
return utils.ErrNotConfirmed
|
||||
}
|
||||
input.MaxResults = 1
|
||||
return input.Update(writer)
|
||||
},
|
||||
}, cobramcp.GenToolHandlerWithMRTR(
|
||||
updateTool, cobramcp.ConfirmThen(
|
||||
func(input liveBroadcast.LiveBroadcast) string {
|
||||
return fmt.Sprintf(updateConfirm, strings.Join(input.Ids, ", "))
|
||||
},
|
||||
func(input liveBroadcast.LiveBroadcast, w io.Writer) error {
|
||||
input.MaxResults = 1
|
||||
return input.Update(w)
|
||||
},
|
||||
),
|
||||
),
|
||||
)
|
||||
liveBroadcastCmd.AddCommand(updateCmd)
|
||||
@@ -109,10 +110,9 @@ var updateCmd = &cobra.Command{
|
||||
Long: updateLong,
|
||||
Example: updateExample,
|
||||
PreRunE: func(c *cobra.Command, _ []string) error {
|
||||
msg := fmt.Sprintf(
|
||||
"Would update live broadcast: %s", strings.Join(ids, ", "),
|
||||
return utils.ConfirmPreRun(
|
||||
c, fmt.Sprintf(updateConfirm, strings.Join(ids, ", ")),
|
||||
)
|
||||
return utils.ConfirmPreRun(c, msg)
|
||||
},
|
||||
Run: func(c *cobra.Command, _ []string) {
|
||||
output, _ := c.Flags().GetString("output")
|
||||
|
||||
+12
-11
@@ -20,6 +20,7 @@ import (
|
||||
|
||||
const (
|
||||
deleteTool = "liveChatBan-delete"
|
||||
deleteConfirm = "Delete live chat ban(s): %s"
|
||||
deleteIdsUsage = "IDs of the live chat bans to delete"
|
||||
deleteShort = "Delete live chat bans"
|
||||
deleteLong = "Delete live chat bans. Use this tool to unban users from a live chat by ban IDs."
|
||||
@@ -37,7 +38,6 @@ var deleteInSchema = &jsonschema.Schema{
|
||||
Type: "array", Description: deleteIdsUsage,
|
||||
Items: &jsonschema.Schema{Type: "string"},
|
||||
},
|
||||
"confirmed": {Type: "boolean", Description: pkg.ConfirmedUsage},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -51,13 +51,15 @@ func init() {
|
||||
OpenWorldHint: new(true),
|
||||
ReadOnlyHint: false,
|
||||
},
|
||||
}, cobramcp.GenToolHandler(
|
||||
deleteTool, func(input liveChatBan.LiveChatBan, writer io.Writer) error {
|
||||
if !input.Confirmed {
|
||||
return utils.ErrNotConfirmed
|
||||
}
|
||||
return input.Delete(writer)
|
||||
},
|
||||
}, cobramcp.GenToolHandlerWithMRTR(
|
||||
deleteTool, cobramcp.ConfirmThen(
|
||||
func(input liveChatBan.LiveChatBan) string {
|
||||
return fmt.Sprintf(deleteConfirm, strings.Join(input.Ids, ", "))
|
||||
},
|
||||
func(input liveChatBan.LiveChatBan, w io.Writer) error {
|
||||
return input.Delete(w)
|
||||
},
|
||||
),
|
||||
),
|
||||
)
|
||||
liveChatBanCmd.AddCommand(deleteCmd)
|
||||
@@ -73,10 +75,9 @@ var deleteCmd = &cobra.Command{
|
||||
Long: deleteLong,
|
||||
Example: deleteExample,
|
||||
PreRunE: func(c *cobra.Command, _ []string) error {
|
||||
msg := fmt.Sprintf(
|
||||
"Would delete live chat ban(s): %s", strings.Join(ids, ", "),
|
||||
return utils.ConfirmPreRun(
|
||||
c, fmt.Sprintf(deleteConfirm, strings.Join(ids, ", ")),
|
||||
)
|
||||
return utils.ConfirmPreRun(c, msg)
|
||||
},
|
||||
Run: func(c *cobra.Command, _ []string) {
|
||||
input := liveChatBan.NewLiveChatBan(
|
||||
|
||||
+14
-11
@@ -20,6 +20,7 @@ import (
|
||||
|
||||
const (
|
||||
insertTool = "liveChatBan-insert"
|
||||
insertConfirm = "Ban user %s in live chat %s"
|
||||
insertShort = "Insert a live chat ban"
|
||||
insertLong = "Insert a live chat ban. Use this tool to ban a user from a live chat."
|
||||
insertExample = `# Ban a user permanently
|
||||
@@ -44,7 +45,6 @@ var insertInSchema = &jsonschema.Schema{
|
||||
Type: "string", Enum: []any{"json", "yaml", "silent"},
|
||||
Description: pkg.SilentUsage, Default: jsontext.Value(`"yaml"`),
|
||||
},
|
||||
"confirmed": {Type: "boolean", Description: pkg.ConfirmedUsage},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -58,13 +58,17 @@ func init() {
|
||||
OpenWorldHint: new(true),
|
||||
ReadOnlyHint: false,
|
||||
},
|
||||
}, cobramcp.GenToolHandler(
|
||||
insertTool, func(input liveChatBan.LiveChatBan, writer io.Writer) error {
|
||||
if !input.Confirmed {
|
||||
return utils.ErrNotConfirmed
|
||||
}
|
||||
return input.Insert(writer)
|
||||
},
|
||||
}, cobramcp.GenToolHandlerWithMRTR(
|
||||
insertTool, cobramcp.ConfirmThen(
|
||||
func(input liveChatBan.LiveChatBan) string {
|
||||
return fmt.Sprintf(
|
||||
insertConfirm, input.BannedUserChannelId, input.LiveChatId,
|
||||
)
|
||||
},
|
||||
func(input liveChatBan.LiveChatBan, w io.Writer) error {
|
||||
return input.Insert(w)
|
||||
},
|
||||
),
|
||||
),
|
||||
)
|
||||
liveChatBanCmd.AddCommand(insertCmd)
|
||||
@@ -93,10 +97,9 @@ var insertCmd = &cobra.Command{
|
||||
Long: insertLong,
|
||||
Example: insertExample,
|
||||
PreRunE: func(c *cobra.Command, _ []string) error {
|
||||
msg := fmt.Sprintf(
|
||||
"Would ban user %s in live chat %s", bannedUserChannelId, liveChatId,
|
||||
return utils.ConfirmPreRun(
|
||||
c, fmt.Sprintf(insertConfirm, bannedUserChannelId, liveChatId),
|
||||
)
|
||||
return utils.ConfirmPreRun(c, msg)
|
||||
},
|
||||
Run: func(c *cobra.Command, _ []string) {
|
||||
output, _ := c.Flags().GetString("output")
|
||||
|
||||
@@ -20,6 +20,7 @@ import (
|
||||
|
||||
const (
|
||||
deleteTool = "liveChatMessage-delete"
|
||||
deleteConfirm = "Delete live chat message(s): %s"
|
||||
deleteIdsUsage = "IDs of the live chat messages to delete"
|
||||
deleteShort = "Delete live chat messages"
|
||||
deleteLong = "Delete live chat messages. Use this tool to remove messages from a live chat by their IDs."
|
||||
@@ -37,7 +38,6 @@ var deleteInSchema = &jsonschema.Schema{
|
||||
Type: "array", Description: deleteIdsUsage,
|
||||
Items: &jsonschema.Schema{Type: "string"},
|
||||
},
|
||||
"confirmed": {Type: "boolean", Description: pkg.ConfirmedUsage},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -51,14 +51,15 @@ func init() {
|
||||
OpenWorldHint: new(true),
|
||||
ReadOnlyHint: false,
|
||||
},
|
||||
}, cobramcp.GenToolHandler(
|
||||
deleteTool,
|
||||
func(input liveChatMessage.LiveChatMessage, writer io.Writer) error {
|
||||
if !input.Confirmed {
|
||||
return utils.ErrNotConfirmed
|
||||
}
|
||||
return input.Delete(writer)
|
||||
},
|
||||
}, cobramcp.GenToolHandlerWithMRTR(
|
||||
deleteTool, cobramcp.ConfirmThen(
|
||||
func(input liveChatMessage.LiveChatMessage) string {
|
||||
return fmt.Sprintf(deleteConfirm, strings.Join(input.Ids, ", "))
|
||||
},
|
||||
func(input liveChatMessage.LiveChatMessage, w io.Writer) error {
|
||||
return input.Delete(w)
|
||||
},
|
||||
),
|
||||
),
|
||||
)
|
||||
liveChatMessageCmd.AddCommand(deleteCmd)
|
||||
@@ -74,10 +75,9 @@ var deleteCmd = &cobra.Command{
|
||||
Long: deleteLong,
|
||||
Example: deleteExample,
|
||||
PreRunE: func(c *cobra.Command, _ []string) error {
|
||||
msg := fmt.Sprintf(
|
||||
"Would delete live chat message(s): %s", strings.Join(ids, ", "),
|
||||
return utils.ConfirmPreRun(
|
||||
c, fmt.Sprintf(deleteConfirm, strings.Join(ids, ", ")),
|
||||
)
|
||||
return utils.ConfirmPreRun(c, msg)
|
||||
},
|
||||
Run: func(c *cobra.Command, _ []string) {
|
||||
input := liveChatMessage.NewLiveChatMessage(
|
||||
|
||||
@@ -20,6 +20,7 @@ import (
|
||||
|
||||
const (
|
||||
insertTool = "liveChatMessage-insert"
|
||||
insertConfirm = "Send message to live chat %s"
|
||||
insertShort = "Send a live chat message"
|
||||
insertLong = "Send a live chat message. Use this tool to post a text message to a live chat."
|
||||
insertExample = `# Send a message to a live chat
|
||||
@@ -40,7 +41,6 @@ var insertInSchema = &jsonschema.Schema{
|
||||
Type: "string", Enum: []any{"json", "yaml", "silent"},
|
||||
Description: pkg.SilentUsage, Default: jsontext.Value(`"yaml"`),
|
||||
},
|
||||
"confirmed": {Type: "boolean", Description: pkg.ConfirmedUsage},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -54,14 +54,15 @@ func init() {
|
||||
OpenWorldHint: new(true),
|
||||
ReadOnlyHint: false,
|
||||
},
|
||||
}, cobramcp.GenToolHandler(
|
||||
insertTool,
|
||||
func(input liveChatMessage.LiveChatMessage, writer io.Writer) error {
|
||||
if !input.Confirmed {
|
||||
return utils.ErrNotConfirmed
|
||||
}
|
||||
return input.Insert(writer)
|
||||
},
|
||||
}, cobramcp.GenToolHandlerWithMRTR(
|
||||
insertTool, cobramcp.ConfirmThen(
|
||||
func(input liveChatMessage.LiveChatMessage) string {
|
||||
return fmt.Sprintf(insertConfirm, input.LiveChatId)
|
||||
},
|
||||
func(input liveChatMessage.LiveChatMessage, w io.Writer) error {
|
||||
return input.Insert(w)
|
||||
},
|
||||
),
|
||||
),
|
||||
)
|
||||
liveChatMessageCmd.AddCommand(insertCmd)
|
||||
@@ -83,8 +84,7 @@ var insertCmd = &cobra.Command{
|
||||
Long: insertLong,
|
||||
Example: insertExample,
|
||||
PreRunE: func(c *cobra.Command, _ []string) error {
|
||||
msg := fmt.Sprintf("Would send message to live chat %s", liveChatId)
|
||||
return utils.ConfirmPreRun(c, msg)
|
||||
return utils.ConfirmPreRun(c, fmt.Sprintf(insertConfirm, liveChatId))
|
||||
},
|
||||
Run: func(c *cobra.Command, _ []string) {
|
||||
output, _ := c.Flags().GetString("output")
|
||||
|
||||
@@ -21,6 +21,7 @@ import (
|
||||
|
||||
const (
|
||||
transitionTool = "liveChatMessage-transition"
|
||||
transitionConfirm = "Transition live chat message(s) %s to %s"
|
||||
transitionShort = "Transition a live chat message"
|
||||
transitionLong = "Transition a durable live chat event. Use this tool to change the status of a live chat message (e.g., close a poll)."
|
||||
transitionExample = `# Transition a live chat message to closed
|
||||
@@ -43,7 +44,6 @@ var transitionInSchema = &jsonschema.Schema{
|
||||
Type: "string", Enum: []any{"json", "yaml", "silent"},
|
||||
Description: pkg.SilentUsage, Default: jsontext.Value(`"yaml"`),
|
||||
},
|
||||
"confirmed": {Type: "boolean", Description: pkg.ConfirmedUsage},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -57,14 +57,17 @@ func init() {
|
||||
OpenWorldHint: new(true),
|
||||
ReadOnlyHint: false,
|
||||
},
|
||||
}, cobramcp.GenToolHandler(
|
||||
transitionTool,
|
||||
func(input liveChatMessage.LiveChatMessage, writer io.Writer) error {
|
||||
if !input.Confirmed {
|
||||
return utils.ErrNotConfirmed
|
||||
}
|
||||
return input.Transition(writer)
|
||||
},
|
||||
}, cobramcp.GenToolHandlerWithMRTR(
|
||||
transitionTool, cobramcp.ConfirmThen(
|
||||
func(input liveChatMessage.LiveChatMessage) string {
|
||||
return fmt.Sprintf(
|
||||
transitionConfirm, strings.Join(input.Ids, ", "), input.Status,
|
||||
)
|
||||
},
|
||||
func(input liveChatMessage.LiveChatMessage, w io.Writer) error {
|
||||
return input.Transition(w)
|
||||
},
|
||||
),
|
||||
),
|
||||
)
|
||||
liveChatMessageCmd.AddCommand(transitionCmd)
|
||||
@@ -85,11 +88,9 @@ var transitionCmd = &cobra.Command{
|
||||
Long: transitionLong,
|
||||
Example: transitionExample,
|
||||
PreRunE: func(c *cobra.Command, _ []string) error {
|
||||
msg := fmt.Sprintf(
|
||||
"Would transition live chat message(s) %s to status %s",
|
||||
strings.Join(ids, ", "), status,
|
||||
return utils.ConfirmPreRun(
|
||||
c, fmt.Sprintf(transitionConfirm, strings.Join(ids, ", "), status),
|
||||
)
|
||||
return utils.ConfirmPreRun(c, msg)
|
||||
},
|
||||
Run: func(c *cobra.Command, _ []string) {
|
||||
output, _ := c.Flags().GetString("output")
|
||||
|
||||
@@ -20,6 +20,7 @@ import (
|
||||
|
||||
const (
|
||||
deleteTool = "liveChatModerator-delete"
|
||||
deleteConfirm = "Delete live chat moderator(s): %s"
|
||||
deleteIdsUsage = "IDs of the live chat moderators to delete"
|
||||
deleteShort = "Delete live chat moderators"
|
||||
deleteLong = "Delete live chat moderators. Use this tool to remove moderators from a live chat by their IDs."
|
||||
@@ -37,7 +38,6 @@ var deleteInSchema = &jsonschema.Schema{
|
||||
Type: "array", Description: deleteIdsUsage,
|
||||
Items: &jsonschema.Schema{Type: "string"},
|
||||
},
|
||||
"confirmed": {Type: "boolean", Description: pkg.ConfirmedUsage},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -51,14 +51,15 @@ func init() {
|
||||
OpenWorldHint: new(true),
|
||||
ReadOnlyHint: false,
|
||||
},
|
||||
}, cobramcp.GenToolHandler(
|
||||
deleteTool,
|
||||
func(input liveChatModerator.LiveChatModerator, writer io.Writer) error {
|
||||
if !input.Confirmed {
|
||||
return utils.ErrNotConfirmed
|
||||
}
|
||||
return input.Delete(writer)
|
||||
},
|
||||
}, cobramcp.GenToolHandlerWithMRTR(
|
||||
deleteTool, cobramcp.ConfirmThen(
|
||||
func(input liveChatModerator.LiveChatModerator) string {
|
||||
return fmt.Sprintf(deleteConfirm, strings.Join(input.Ids, ", "))
|
||||
},
|
||||
func(input liveChatModerator.LiveChatModerator, w io.Writer) error {
|
||||
return input.Delete(w)
|
||||
},
|
||||
),
|
||||
),
|
||||
)
|
||||
liveChatModeratorCmd.AddCommand(deleteCmd)
|
||||
@@ -74,10 +75,9 @@ var deleteCmd = &cobra.Command{
|
||||
Long: deleteLong,
|
||||
Example: deleteExample,
|
||||
PreRunE: func(c *cobra.Command, _ []string) error {
|
||||
msg := fmt.Sprintf(
|
||||
"Would delete live chat moderator(s): %s", strings.Join(ids, ", "),
|
||||
return utils.ConfirmPreRun(
|
||||
c, fmt.Sprintf(deleteConfirm, strings.Join(ids, ", ")),
|
||||
)
|
||||
return utils.ConfirmPreRun(c, msg)
|
||||
},
|
||||
Run: func(c *cobra.Command, _ []string) {
|
||||
input := liveChatModerator.NewLiveChatModerator(
|
||||
|
||||
@@ -20,6 +20,7 @@ import (
|
||||
|
||||
const (
|
||||
insertTool = "liveChatModerator-insert"
|
||||
insertConfirm = "Add moderator %s to live chat %s"
|
||||
insertShort = "Insert a live chat moderator"
|
||||
insertLong = "Insert a live chat moderator. Use this tool to add a moderator to a live chat."
|
||||
insertExample = `# Add a moderator to a live chat
|
||||
@@ -40,7 +41,6 @@ var insertInSchema = &jsonschema.Schema{
|
||||
Type: "string", Enum: []any{"json", "yaml", "silent"},
|
||||
Description: pkg.SilentUsage, Default: jsontext.Value(`"yaml"`),
|
||||
},
|
||||
"confirmed": {Type: "boolean", Description: pkg.ConfirmedUsage},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -54,14 +54,17 @@ func init() {
|
||||
OpenWorldHint: new(true),
|
||||
ReadOnlyHint: false,
|
||||
},
|
||||
}, cobramcp.GenToolHandler(
|
||||
insertTool,
|
||||
func(input liveChatModerator.LiveChatModerator, writer io.Writer) error {
|
||||
if !input.Confirmed {
|
||||
return utils.ErrNotConfirmed
|
||||
}
|
||||
return input.Insert(writer)
|
||||
},
|
||||
}, cobramcp.GenToolHandlerWithMRTR(
|
||||
insertTool, cobramcp.ConfirmThen(
|
||||
func(input liveChatModerator.LiveChatModerator) string {
|
||||
return fmt.Sprintf(
|
||||
insertConfirm, input.ModeratorChannelId, input.LiveChatId,
|
||||
)
|
||||
},
|
||||
func(input liveChatModerator.LiveChatModerator, w io.Writer) error {
|
||||
return input.Insert(w)
|
||||
},
|
||||
),
|
||||
),
|
||||
)
|
||||
liveChatModeratorCmd.AddCommand(insertCmd)
|
||||
@@ -85,10 +88,9 @@ var insertCmd = &cobra.Command{
|
||||
Long: insertLong,
|
||||
Example: insertExample,
|
||||
PreRunE: func(c *cobra.Command, _ []string) error {
|
||||
msg := fmt.Sprintf(
|
||||
"Would add moderator %s to live chat %s", moderatorChannelId, liveChatId,
|
||||
return utils.ConfirmPreRun(
|
||||
c, fmt.Sprintf(insertConfirm, moderatorChannelId, liveChatId),
|
||||
)
|
||||
return utils.ConfirmPreRun(c, msg)
|
||||
},
|
||||
Run: func(c *cobra.Command, _ []string) {
|
||||
output, _ := c.Flags().GetString("output")
|
||||
|
||||
+12
-11
@@ -20,6 +20,7 @@ import (
|
||||
|
||||
const (
|
||||
deleteTool = "liveStream-delete"
|
||||
deleteConfirm = "Delete live stream(s): %s"
|
||||
deleteIdsUsage = "IDs of the live streams to delete"
|
||||
deleteShort = "Delete live streams"
|
||||
deleteLong = "Delete live streams. Use this tool to delete live streams by their IDs."
|
||||
@@ -41,7 +42,6 @@ var deleteInSchema = &jsonschema.Schema{
|
||||
"on_behalf_of_content_owner_channel": {
|
||||
Type: "string", Description: obococUsage,
|
||||
},
|
||||
"confirmed": {Type: "boolean", Description: pkg.ConfirmedUsage},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -55,13 +55,15 @@ func init() {
|
||||
OpenWorldHint: new(true),
|
||||
ReadOnlyHint: false,
|
||||
},
|
||||
}, cobramcp.GenToolHandler(
|
||||
deleteTool, func(input liveStream.LiveStream, writer io.Writer) error {
|
||||
if !input.Confirmed {
|
||||
return utils.ErrNotConfirmed
|
||||
}
|
||||
return input.Delete(writer)
|
||||
},
|
||||
}, cobramcp.GenToolHandlerWithMRTR(
|
||||
deleteTool, cobramcp.ConfirmThen(
|
||||
func(input liveStream.LiveStream) string {
|
||||
return fmt.Sprintf(deleteConfirm, strings.Join(input.Ids, ", "))
|
||||
},
|
||||
func(input liveStream.LiveStream, w io.Writer) error {
|
||||
return input.Delete(w)
|
||||
},
|
||||
),
|
||||
),
|
||||
)
|
||||
liveStreamCmd.AddCommand(deleteCmd)
|
||||
@@ -84,10 +86,9 @@ var deleteCmd = &cobra.Command{
|
||||
Long: deleteLong,
|
||||
Example: deleteExample,
|
||||
PreRunE: func(c *cobra.Command, _ []string) error {
|
||||
msg := fmt.Sprintf(
|
||||
"Would delete live stream(s): %s", strings.Join(ids, ", "),
|
||||
return utils.ConfirmPreRun(
|
||||
c, fmt.Sprintf(deleteConfirm, strings.Join(ids, ", ")),
|
||||
)
|
||||
return utils.ConfirmPreRun(c, msg)
|
||||
},
|
||||
Run: func(c *cobra.Command, _ []string) {
|
||||
input := liveStream.NewLiveStream(
|
||||
|
||||
+11
-10
@@ -20,6 +20,7 @@ import (
|
||||
|
||||
const (
|
||||
insertTool = "liveStream-insert"
|
||||
insertConfirm = "Create live stream: %s"
|
||||
insertShort = "Insert a live stream"
|
||||
insertLong = "Insert a live stream. Use this tool to create a new live stream for the authenticated user."
|
||||
insertExample = `# Create a live stream with RTMP at 1080p
|
||||
@@ -59,7 +60,6 @@ var insertInSchema = &jsonschema.Schema{
|
||||
Type: "string", Enum: []any{"json", "yaml", "silent"},
|
||||
Description: pkg.SilentUsage, Default: jsontext.Value(`"yaml"`),
|
||||
},
|
||||
"confirmed": {Type: "boolean", Description: pkg.ConfirmedUsage},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -73,13 +73,15 @@ func init() {
|
||||
OpenWorldHint: new(true),
|
||||
ReadOnlyHint: false,
|
||||
},
|
||||
}, cobramcp.GenToolHandler(
|
||||
insertTool, func(input liveStream.LiveStream, writer io.Writer) error {
|
||||
if !input.Confirmed {
|
||||
return utils.ErrNotConfirmed
|
||||
}
|
||||
return input.Insert(writer)
|
||||
},
|
||||
}, cobramcp.GenToolHandlerWithMRTR(
|
||||
insertTool, cobramcp.ConfirmThen(
|
||||
func(input liveStream.LiveStream) string {
|
||||
return fmt.Sprintf(insertConfirm, input.Title)
|
||||
},
|
||||
func(input liveStream.LiveStream, w io.Writer) error {
|
||||
return input.Insert(w)
|
||||
},
|
||||
),
|
||||
),
|
||||
)
|
||||
liveStreamCmd.AddCommand(insertCmd)
|
||||
@@ -112,8 +114,7 @@ var insertCmd = &cobra.Command{
|
||||
Long: insertLong,
|
||||
Example: insertExample,
|
||||
PreRunE: func(c *cobra.Command, _ []string) error {
|
||||
msg := fmt.Sprintf("Would create live stream: %s", title)
|
||||
return utils.ConfirmPreRun(c, msg)
|
||||
return utils.ConfirmPreRun(c, fmt.Sprintf(insertConfirm, title))
|
||||
},
|
||||
Run: func(c *cobra.Command, _ []string) {
|
||||
output, _ := c.Flags().GetString("output")
|
||||
|
||||
+14
-11
@@ -21,6 +21,7 @@ import (
|
||||
|
||||
const (
|
||||
updateTool = "liveStream-update"
|
||||
updateConfirm = "Update live stream: %s"
|
||||
updateIdUsage = "ID of the live stream to update"
|
||||
updateShort = "Update a live stream"
|
||||
updateLong = "Update a live stream. Use this tool to update an existing live stream's settings."
|
||||
@@ -60,7 +61,6 @@ var updateInSchema = &jsonschema.Schema{
|
||||
Type: "string", Enum: []any{"json", "yaml", "silent"},
|
||||
Description: pkg.SilentUsage, Default: jsontext.Value(`"yaml"`),
|
||||
},
|
||||
"confirmed": {Type: "boolean", Description: pkg.ConfirmedUsage},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -74,14 +74,16 @@ func init() {
|
||||
OpenWorldHint: new(true),
|
||||
ReadOnlyHint: false,
|
||||
},
|
||||
}, cobramcp.GenToolHandler(
|
||||
updateTool, func(input liveStream.LiveStream, writer io.Writer) error {
|
||||
if !input.Confirmed {
|
||||
return utils.ErrNotConfirmed
|
||||
}
|
||||
input.MaxResults = 1
|
||||
return input.Update(writer)
|
||||
},
|
||||
}, cobramcp.GenToolHandlerWithMRTR(
|
||||
updateTool, cobramcp.ConfirmThen(
|
||||
func(input liveStream.LiveStream) string {
|
||||
return fmt.Sprintf(updateConfirm, strings.Join(input.Ids, ", "))
|
||||
},
|
||||
func(input liveStream.LiveStream, w io.Writer) error {
|
||||
input.MaxResults = 1
|
||||
return input.Update(w)
|
||||
},
|
||||
),
|
||||
),
|
||||
)
|
||||
liveStreamCmd.AddCommand(updateCmd)
|
||||
@@ -110,8 +112,9 @@ var updateCmd = &cobra.Command{
|
||||
Long: updateLong,
|
||||
Example: updateExample,
|
||||
PreRunE: func(c *cobra.Command, _ []string) error {
|
||||
msg := fmt.Sprintf("Would update live stream: %s", strings.Join(ids, ", "))
|
||||
return utils.ConfirmPreRun(c, msg)
|
||||
return utils.ConfirmPreRun(
|
||||
c, fmt.Sprintf(updateConfirm, strings.Join(ids, ", ")),
|
||||
)
|
||||
},
|
||||
Run: func(c *cobra.Command, _ []string) {
|
||||
output, _ := c.Flags().GetString("output")
|
||||
|
||||
+13
-10
@@ -21,6 +21,7 @@ import (
|
||||
const (
|
||||
deleteTool = "playlist-delete"
|
||||
deleteIdsUsage = "IDs of the playlists to delete"
|
||||
deleteConfirm = "Delete playlist(s): %s"
|
||||
deleteShort = "Delete playlists"
|
||||
deleteLong = "Delete playlists. Use this tool to delete playlists by IDs."
|
||||
deleteExample = `# Delete a playlist by ID
|
||||
@@ -38,7 +39,6 @@ var deleteInSchema = &jsonschema.Schema{
|
||||
Items: &jsonschema.Schema{Type: "string"},
|
||||
},
|
||||
"on_behalf_of_content_owner": {Type: "string", Description: pkg.OBOCOUsage},
|
||||
"confirmed": {Type: "boolean", Description: pkg.ConfirmedUsage},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -52,13 +52,15 @@ func init() {
|
||||
OpenWorldHint: new(true),
|
||||
ReadOnlyHint: false,
|
||||
},
|
||||
}, cobramcp.GenToolHandler(
|
||||
deleteTool, func(input playlist.Playlist, writer io.Writer) error {
|
||||
if !input.Confirmed {
|
||||
return utils.ErrNotConfirmed
|
||||
}
|
||||
return input.Delete(writer)
|
||||
},
|
||||
}, cobramcp.GenToolHandlerWithMRTR(
|
||||
deleteTool, cobramcp.ConfirmThen(
|
||||
func(input playlist.Playlist) string {
|
||||
return fmt.Sprintf(deleteConfirm, strings.Join(input.Ids, ", "))
|
||||
},
|
||||
func(input playlist.Playlist, w io.Writer) error {
|
||||
return input.Delete(w)
|
||||
},
|
||||
),
|
||||
),
|
||||
)
|
||||
playlistCmd.AddCommand(deleteCmd)
|
||||
@@ -77,8 +79,9 @@ var deleteCmd = &cobra.Command{
|
||||
Long: deleteLong,
|
||||
Example: deleteExample,
|
||||
PreRunE: func(c *cobra.Command, _ []string) error {
|
||||
msg := fmt.Sprintf("Would delete playlist(s): %s", strings.Join(ids, ", "))
|
||||
return utils.ConfirmPreRun(c, msg)
|
||||
return utils.ConfirmPreRun(
|
||||
c, fmt.Sprintf(deleteConfirm, strings.Join(ids, ", ")),
|
||||
)
|
||||
},
|
||||
Run: func(c *cobra.Command, _ []string) {
|
||||
input := playlist.NewPlaylist(
|
||||
|
||||
+11
-10
@@ -21,6 +21,7 @@ import (
|
||||
const (
|
||||
insertTool = "playlist-insert"
|
||||
insertCidUsage = "Channel id of the playlist"
|
||||
insertConfirm = "Insert playlist: %s"
|
||||
insertShort = "Create a new playlist"
|
||||
insertLong = "Create a new playlist. Use this tool to create a new playlist."
|
||||
insertExample = `# Create a public playlist
|
||||
@@ -51,7 +52,6 @@ var insertInSchema = &jsonschema.Schema{
|
||||
Type: "string", Enum: []any{"json", "yaml", "silent"},
|
||||
Description: pkg.SilentUsage, Default: jsontext.Value(`"yaml"`),
|
||||
},
|
||||
"confirmed": {Type: "boolean", Description: pkg.ConfirmedUsage},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -65,13 +65,15 @@ func init() {
|
||||
OpenWorldHint: new(true),
|
||||
ReadOnlyHint: false,
|
||||
},
|
||||
}, cobramcp.GenToolHandler(
|
||||
insertTool, func(input playlist.Playlist, writer io.Writer) error {
|
||||
if !input.Confirmed {
|
||||
return utils.ErrNotConfirmed
|
||||
}
|
||||
return input.Insert(writer)
|
||||
},
|
||||
}, cobramcp.GenToolHandlerWithMRTR(
|
||||
insertTool, cobramcp.ConfirmThen(
|
||||
func(input playlist.Playlist) string {
|
||||
return fmt.Sprintf(insertConfirm, input.Title)
|
||||
},
|
||||
func(input playlist.Playlist, w io.Writer) error {
|
||||
return input.Insert(w)
|
||||
},
|
||||
),
|
||||
),
|
||||
)
|
||||
playlistCmd.AddCommand(insertCmd)
|
||||
@@ -95,8 +97,7 @@ var insertCmd = &cobra.Command{
|
||||
Long: insertLong,
|
||||
Example: insertExample,
|
||||
PreRunE: func(c *cobra.Command, _ []string) error {
|
||||
msg := fmt.Sprintf("Would insert playlist: %s", title)
|
||||
return utils.ConfirmPreRun(c, msg)
|
||||
return utils.ConfirmPreRun(c, fmt.Sprintf(insertConfirm, title))
|
||||
},
|
||||
Run: func(c *cobra.Command, _ []string) {
|
||||
output, _ := c.Flags().GetString("output")
|
||||
|
||||
+13
-10
@@ -22,6 +22,7 @@ import (
|
||||
const (
|
||||
updateTool = "playlist-update"
|
||||
updateIdUsage = "ID of the playlist to update"
|
||||
updateConfirm = "Update playlist: %s"
|
||||
updateShort = "Update a playlist"
|
||||
updateLong = "Update a playlist. Use this tool to update a playlist."
|
||||
updateExample = `# Update playlist title
|
||||
@@ -57,7 +58,6 @@ var updateInSchema = &jsonschema.Schema{
|
||||
Type: "string", Enum: []any{"json", "yaml", "silent"},
|
||||
Description: pkg.SilentUsage, Default: jsontext.Value(`"yaml"`),
|
||||
},
|
||||
"confirmed": {Type: "boolean", Description: pkg.ConfirmedUsage},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -71,13 +71,15 @@ func init() {
|
||||
OpenWorldHint: new(true),
|
||||
ReadOnlyHint: false,
|
||||
},
|
||||
}, cobramcp.GenToolHandler(
|
||||
updateTool, func(input playlist.Playlist, writer io.Writer) error {
|
||||
if !input.Confirmed {
|
||||
return utils.ErrNotConfirmed
|
||||
}
|
||||
return input.Update(writer)
|
||||
},
|
||||
}, cobramcp.GenToolHandlerWithMRTR(
|
||||
updateTool, cobramcp.ConfirmThen(
|
||||
func(input playlist.Playlist) string {
|
||||
return fmt.Sprintf(updateConfirm, strings.Join(input.Ids, ", "))
|
||||
},
|
||||
func(input playlist.Playlist, w io.Writer) error {
|
||||
return input.Update(w)
|
||||
},
|
||||
),
|
||||
),
|
||||
)
|
||||
playlistCmd.AddCommand(updateCmd)
|
||||
@@ -99,8 +101,9 @@ var updateCmd = &cobra.Command{
|
||||
Long: updateLong,
|
||||
Example: updateExample,
|
||||
PreRunE: func(c *cobra.Command, _ []string) error {
|
||||
msg := fmt.Sprintf("Would update playlist: %s", strings.Join(ids, ", "))
|
||||
return utils.ConfirmPreRun(c, msg)
|
||||
return utils.ConfirmPreRun(
|
||||
c, fmt.Sprintf(updateConfirm, strings.Join(ids, ", ")),
|
||||
)
|
||||
},
|
||||
Run: func(c *cobra.Command, _ []string) {
|
||||
output, _ := c.Flags().GetString("output")
|
||||
|
||||
+12
-12
@@ -20,6 +20,7 @@ import (
|
||||
|
||||
const (
|
||||
deleteTool = "playlistImage-delete"
|
||||
deleteConfirm = "Delete playlist image(s): %s"
|
||||
deleteShort = "Delete playlist images"
|
||||
deleteLong = "Delete playlist images. Use this tool to delete playlist images by IDs."
|
||||
deleteExample = `# Delete a playlist image by ID
|
||||
@@ -37,7 +38,6 @@ var deleteInSchema = &jsonschema.Schema{
|
||||
Items: &jsonschema.Schema{Type: "string"},
|
||||
},
|
||||
"on_behalf_of_content_owner": {Type: "string", Description: pkg.OBOCOUsage},
|
||||
"confirmed": {Type: "boolean", Description: pkg.ConfirmedUsage},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -51,14 +51,15 @@ func init() {
|
||||
OpenWorldHint: new(true),
|
||||
ReadOnlyHint: false,
|
||||
},
|
||||
}, cobramcp.GenToolHandler(
|
||||
deleteTool,
|
||||
func(input playlistImage.PlaylistImage, writer io.Writer) error {
|
||||
if !input.Confirmed {
|
||||
return utils.ErrNotConfirmed
|
||||
}
|
||||
return input.Delete(writer)
|
||||
},
|
||||
}, cobramcp.GenToolHandlerWithMRTR(
|
||||
deleteTool, cobramcp.ConfirmThen(
|
||||
func(input playlistImage.PlaylistImage) string {
|
||||
return fmt.Sprintf(deleteConfirm, strings.Join(input.Ids, ", "))
|
||||
},
|
||||
func(input playlistImage.PlaylistImage, w io.Writer) error {
|
||||
return input.Delete(w)
|
||||
},
|
||||
),
|
||||
),
|
||||
)
|
||||
playlistImageCmd.AddCommand(deleteCmd)
|
||||
@@ -77,10 +78,9 @@ var deleteCmd = &cobra.Command{
|
||||
Long: deleteLong,
|
||||
Example: deleteExample,
|
||||
PreRunE: func(c *cobra.Command, _ []string) error {
|
||||
msg := fmt.Sprintf(
|
||||
"Would delete playlist image(s): %s", strings.Join(ids, ", "),
|
||||
return utils.ConfirmPreRun(
|
||||
c, fmt.Sprintf(deleteConfirm, strings.Join(ids, ", ")),
|
||||
)
|
||||
return utils.ConfirmPreRun(c, msg)
|
||||
},
|
||||
Run: func(c *cobra.Command, _ []string) {
|
||||
input := playlistImage.NewPlaylistImage(
|
||||
|
||||
+11
-11
@@ -20,6 +20,7 @@ import (
|
||||
|
||||
const (
|
||||
insertTool = "playlistImage-insert"
|
||||
insertConfirm = "Insert playlist image: %s"
|
||||
insertShort = "Insert a playlist image"
|
||||
insertLong = "Insert a playlist image. Use this tool to insert a YouTube playlist image for a given playlist ID."
|
||||
insertExample = `# Insert a playlist cover image
|
||||
@@ -57,7 +58,6 @@ var insertInSchema = &jsonschema.Schema{
|
||||
Type: "string", Enum: []any{"json", "yaml", "silent"},
|
||||
Description: pkg.SilentUsage, Default: jsontext.Value(`"yaml"`),
|
||||
},
|
||||
"confirmed": {Type: "boolean", Description: pkg.ConfirmedUsage},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -71,14 +71,15 @@ func init() {
|
||||
OpenWorldHint: new(true),
|
||||
ReadOnlyHint: false,
|
||||
},
|
||||
}, cobramcp.GenToolHandler(
|
||||
insertTool,
|
||||
func(input playlistImage.PlaylistImage, writer io.Writer) error {
|
||||
if !input.Confirmed {
|
||||
return utils.ErrNotConfirmed
|
||||
}
|
||||
return input.Insert(writer)
|
||||
},
|
||||
}, cobramcp.GenToolHandlerWithMRTR(
|
||||
insertTool, cobramcp.ConfirmThen(
|
||||
func(input playlistImage.PlaylistImage) string {
|
||||
return fmt.Sprintf(insertConfirm, input.File)
|
||||
},
|
||||
func(input playlistImage.PlaylistImage, w io.Writer) error {
|
||||
return input.Insert(w)
|
||||
},
|
||||
),
|
||||
),
|
||||
)
|
||||
playlistImageCmd.AddCommand(insertCmd)
|
||||
@@ -107,8 +108,7 @@ var insertCmd = &cobra.Command{
|
||||
Long: insertLong,
|
||||
Example: insertExample,
|
||||
PreRunE: func(c *cobra.Command, _ []string) error {
|
||||
msg := fmt.Sprintf("Would insert playlist image: %s", file)
|
||||
return utils.ConfirmPreRun(c, msg)
|
||||
return utils.ConfirmPreRun(c, fmt.Sprintf(insertConfirm, file))
|
||||
},
|
||||
Run: func(c *cobra.Command, _ []string) {
|
||||
output, _ := c.Flags().GetString("output")
|
||||
|
||||
+11
-13
@@ -20,6 +20,7 @@ import (
|
||||
|
||||
const (
|
||||
updateTool = "playlistImage-update"
|
||||
updateConfirm = "Update playlist image for playlist: %s"
|
||||
updateShort = "Update a playlist image"
|
||||
updateLong = "Update a playlist image. Use this tool to update a playlist image."
|
||||
updateExample = `# Update a playlist image
|
||||
@@ -52,7 +53,6 @@ var updateInSchema = &jsonschema.Schema{
|
||||
Type: "string", Enum: []any{"json", "yaml", "silent"},
|
||||
Description: pkg.SilentUsage, Default: jsontext.Value(`"yaml"`),
|
||||
},
|
||||
"confirmed": {Type: "boolean", Description: pkg.ConfirmedUsage},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -66,14 +66,15 @@ func init() {
|
||||
OpenWorldHint: new(true),
|
||||
ReadOnlyHint: false,
|
||||
},
|
||||
}, cobramcp.GenToolHandler(
|
||||
updateTool,
|
||||
func(input playlistImage.PlaylistImage, writer io.Writer) error {
|
||||
if !input.Confirmed {
|
||||
return utils.ErrNotConfirmed
|
||||
}
|
||||
return input.Update(writer)
|
||||
},
|
||||
}, cobramcp.GenToolHandlerWithMRTR(
|
||||
updateTool, cobramcp.ConfirmThen(
|
||||
func(input playlistImage.PlaylistImage) string {
|
||||
return fmt.Sprintf(updateConfirm, input.PlaylistId)
|
||||
},
|
||||
func(input playlistImage.PlaylistImage, w io.Writer) error {
|
||||
return input.Update(w)
|
||||
},
|
||||
),
|
||||
),
|
||||
)
|
||||
playlistImageCmd.AddCommand(updateCmd)
|
||||
@@ -100,10 +101,7 @@ var updateCmd = &cobra.Command{
|
||||
Long: updateLong,
|
||||
Example: updateExample,
|
||||
PreRunE: func(c *cobra.Command, _ []string) error {
|
||||
msg := fmt.Sprintf(
|
||||
"Would update playlist image for playlist: %s", playlistId,
|
||||
)
|
||||
return utils.ConfirmPreRun(c, msg)
|
||||
return utils.ConfirmPreRun(c, fmt.Sprintf(updateConfirm, playlistId))
|
||||
},
|
||||
Run: func(c *cobra.Command, _ []string) {
|
||||
output, _ := c.Flags().GetString("output")
|
||||
|
||||
+12
-11
@@ -21,6 +21,7 @@ import (
|
||||
const (
|
||||
deleteTool = "playlistItem-delete"
|
||||
deleteIdsUsage = "IDs of the playlist items to delete"
|
||||
deleteConfirm = "Delete playlist item(s): %s"
|
||||
deleteShort = "Delete items from a playlist"
|
||||
deleteLong = "Delete items from a playlist. Use this tool to delete items from a playlist by IDs."
|
||||
deleteExample = `# Delete a playlist item by ID
|
||||
@@ -38,7 +39,6 @@ var deleteInSchema = &jsonschema.Schema{
|
||||
Items: &jsonschema.Schema{Type: "string"},
|
||||
},
|
||||
"on_behalf_of_content_owner": {Type: "string", Description: pkg.OBOCOUsage},
|
||||
"confirmed": {Type: "boolean", Description: pkg.ConfirmedUsage},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -52,13 +52,15 @@ func init() {
|
||||
OpenWorldHint: new(true),
|
||||
ReadOnlyHint: false,
|
||||
},
|
||||
}, cobramcp.GenToolHandler(
|
||||
deleteTool, func(input playlistItem.PlaylistItem, writer io.Writer) error {
|
||||
if !input.Confirmed {
|
||||
return utils.ErrNotConfirmed
|
||||
}
|
||||
return input.Delete(writer)
|
||||
},
|
||||
}, cobramcp.GenToolHandlerWithMRTR(
|
||||
deleteTool, cobramcp.ConfirmThen(
|
||||
func(input playlistItem.PlaylistItem) string {
|
||||
return fmt.Sprintf(deleteConfirm, strings.Join(input.Ids, ", "))
|
||||
},
|
||||
func(input playlistItem.PlaylistItem, w io.Writer) error {
|
||||
return input.Delete(w)
|
||||
},
|
||||
),
|
||||
),
|
||||
)
|
||||
playlistItemCmd.AddCommand(deleteCmd)
|
||||
@@ -77,10 +79,9 @@ var deleteCmd = &cobra.Command{
|
||||
Long: deleteLong,
|
||||
Example: deleteExample,
|
||||
PreRunE: func(c *cobra.Command, _ []string) error {
|
||||
msg := fmt.Sprintf(
|
||||
"Would delete playlist item(s): %s", strings.Join(ids, ", "),
|
||||
return utils.ConfirmPreRun(
|
||||
c, fmt.Sprintf(deleteConfirm, strings.Join(ids, ", ")),
|
||||
)
|
||||
return utils.ConfirmPreRun(c, msg)
|
||||
},
|
||||
Run: func(c *cobra.Command, _ []string) {
|
||||
input := playlistItem.NewPlaylistItem(
|
||||
|
||||
+11
-10
@@ -21,6 +21,7 @@ import (
|
||||
const (
|
||||
insertTool = "playlistItem-insert"
|
||||
insertPidUsage = "The id that YouTube uses to uniquely identify the playlist that the item is in"
|
||||
insertConfirm = "Insert playlist item to playlist: %s"
|
||||
insertShort = "Insert a playlist item into a playlist"
|
||||
insertLong = "Insert a playlist item into a playlist. Use this tool to insert a playlist item into a playlist."
|
||||
insertExample = `# Add a video to a playlist
|
||||
@@ -53,7 +54,6 @@ var insertInSchema = &jsonschema.Schema{
|
||||
Type: "string", Enum: []any{"json", "yaml", "silent"},
|
||||
Description: pkg.SilentUsage, Default: jsontext.Value(`"yaml"`),
|
||||
},
|
||||
"confirmed": {Type: "boolean", Description: pkg.ConfirmedUsage},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -67,13 +67,15 @@ func init() {
|
||||
OpenWorldHint: new(true),
|
||||
ReadOnlyHint: false,
|
||||
},
|
||||
}, cobramcp.GenToolHandler(
|
||||
insertTool, func(input playlistItem.PlaylistItem, writer io.Writer) error {
|
||||
if !input.Confirmed {
|
||||
return utils.ErrNotConfirmed
|
||||
}
|
||||
return input.Insert(writer)
|
||||
},
|
||||
}, cobramcp.GenToolHandlerWithMRTR(
|
||||
insertTool, cobramcp.ConfirmThen(
|
||||
func(input playlistItem.PlaylistItem) string {
|
||||
return fmt.Sprintf(insertConfirm, input.PlaylistId)
|
||||
},
|
||||
func(input playlistItem.PlaylistItem, w io.Writer) error {
|
||||
return input.Insert(w)
|
||||
},
|
||||
),
|
||||
),
|
||||
)
|
||||
playlistItemCmd.AddCommand(insertCmd)
|
||||
@@ -105,8 +107,7 @@ var insertCmd = &cobra.Command{
|
||||
Long: insertLong,
|
||||
Example: insertExample,
|
||||
PreRunE: func(c *cobra.Command, _ []string) error {
|
||||
msg := fmt.Sprintf("Would insert playlist item to playlist: %s", playlistId)
|
||||
return utils.ConfirmPreRun(c, msg)
|
||||
return utils.ConfirmPreRun(c, fmt.Sprintf(insertConfirm, playlistId))
|
||||
},
|
||||
Run: func(c *cobra.Command, _ []string) {
|
||||
output, _ := c.Flags().GetString("output")
|
||||
|
||||
+13
-10
@@ -22,6 +22,7 @@ import (
|
||||
const (
|
||||
updateTool = "playlistItem-update"
|
||||
updateIdUsage = "ID of the playlist item to update"
|
||||
updateConfirm = "Update playlist item: %s"
|
||||
updateShort = "Update a playlist item"
|
||||
updateLong = "Update a playlist item. Use this tool to update a playlist item."
|
||||
updateExample = `# Update playlist item title
|
||||
@@ -51,7 +52,6 @@ var updateInSchema = &jsonschema.Schema{
|
||||
Type: "string", Enum: []any{"json", "yaml", "silent"},
|
||||
Description: pkg.SilentUsage, Default: jsontext.Value(`"yaml"`),
|
||||
},
|
||||
"confirmed": {Type: "boolean", Description: pkg.ConfirmedUsage},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -65,13 +65,15 @@ func init() {
|
||||
OpenWorldHint: new(true),
|
||||
ReadOnlyHint: false,
|
||||
},
|
||||
}, cobramcp.GenToolHandler(
|
||||
updateTool, func(input playlistItem.PlaylistItem, writer io.Writer) error {
|
||||
if !input.Confirmed {
|
||||
return utils.ErrNotConfirmed
|
||||
}
|
||||
return input.Update(writer)
|
||||
},
|
||||
}, cobramcp.GenToolHandlerWithMRTR(
|
||||
updateTool, cobramcp.ConfirmThen(
|
||||
func(input playlistItem.PlaylistItem) string {
|
||||
return fmt.Sprintf(updateConfirm, strings.Join(input.Ids, ", "))
|
||||
},
|
||||
func(input playlistItem.PlaylistItem, w io.Writer) error {
|
||||
return input.Update(w)
|
||||
},
|
||||
),
|
||||
),
|
||||
)
|
||||
playlistItemCmd.AddCommand(updateCmd)
|
||||
@@ -94,8 +96,9 @@ var updateCmd = &cobra.Command{
|
||||
Long: updateLong,
|
||||
Example: updateExample,
|
||||
PreRunE: func(c *cobra.Command, _ []string) error {
|
||||
msg := fmt.Sprintf("Would update playlist item: %s", strings.Join(ids, ", "))
|
||||
return utils.ConfirmPreRun(c, msg)
|
||||
return utils.ConfirmPreRun(
|
||||
c, fmt.Sprintf(updateConfirm, strings.Join(ids, ", ")),
|
||||
)
|
||||
},
|
||||
Run: func(c *cobra.Command, _ []string) {
|
||||
output, _ := c.Flags().GetString("output")
|
||||
|
||||
+12
-11
@@ -21,6 +21,7 @@ import (
|
||||
const (
|
||||
deleteTool = "subscription-delete"
|
||||
deleteIdsUsage = "IDs of the subscriptions to delete"
|
||||
deleteConfirm = "Delete subscription(s): %s"
|
||||
deleteShort = "Delete subscriptions"
|
||||
deleteLong = "Delete subscriptions. Use this tool to delete subscriptions by IDs."
|
||||
deleteExample = `# Delete a subscription by ID
|
||||
@@ -37,7 +38,6 @@ var deleteInSchema = &jsonschema.Schema{
|
||||
Type: "array", Description: deleteIdsUsage,
|
||||
Items: &jsonschema.Schema{Type: "string"},
|
||||
},
|
||||
"confirmed": {Type: "boolean", Description: pkg.ConfirmedUsage},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -51,13 +51,15 @@ func init() {
|
||||
OpenWorldHint: new(true),
|
||||
ReadOnlyHint: false,
|
||||
},
|
||||
}, cobramcp.GenToolHandler(
|
||||
deleteTool, func(input subscription.Subscription, writer io.Writer) error {
|
||||
if !input.Confirmed {
|
||||
return utils.ErrNotConfirmed
|
||||
}
|
||||
return input.Delete(writer)
|
||||
},
|
||||
}, cobramcp.GenToolHandlerWithMRTR(
|
||||
deleteTool, cobramcp.ConfirmThen(
|
||||
func(input subscription.Subscription) string {
|
||||
return fmt.Sprintf(deleteConfirm, strings.Join(input.Ids, ", "))
|
||||
},
|
||||
func(input subscription.Subscription, w io.Writer) error {
|
||||
return input.Delete(w)
|
||||
},
|
||||
),
|
||||
),
|
||||
)
|
||||
subscriptionCmd.AddCommand(deleteCmd)
|
||||
@@ -73,10 +75,9 @@ var deleteCmd = &cobra.Command{
|
||||
Long: deleteLong,
|
||||
Example: deleteExample,
|
||||
PreRunE: func(c *cobra.Command, _ []string) error {
|
||||
msg := fmt.Sprintf(
|
||||
"Would delete subscription(s): %s", strings.Join(ids, ", "),
|
||||
return utils.ConfirmPreRun(
|
||||
c, fmt.Sprintf(deleteConfirm, strings.Join(ids, ", ")),
|
||||
)
|
||||
return utils.ConfirmPreRun(c, msg)
|
||||
},
|
||||
Run: func(c *cobra.Command, _ []string) {
|
||||
input := subscription.NewSubscription(
|
||||
|
||||
+11
-10
@@ -21,6 +21,7 @@ import (
|
||||
const (
|
||||
insertTool = "subscription-insert"
|
||||
insertCidUsage = "ID of the channel to be subscribed"
|
||||
insertConfirm = "Insert subscription to channel: %s"
|
||||
insertShort = "Insert a new subscription"
|
||||
insertLong = "Insert a new subscription. Use this tool to insert a new subscription."
|
||||
insertExample = `# Subscribe to a channel
|
||||
@@ -41,7 +42,6 @@ var insertInSchema = &jsonschema.Schema{
|
||||
Type: "string", Enum: []any{"json", "yaml", "silent"},
|
||||
Description: pkg.SilentUsage, Default: jsontext.Value(`"yaml"`),
|
||||
},
|
||||
"confirmed": {Type: "boolean", Description: pkg.ConfirmedUsage},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -55,13 +55,15 @@ func init() {
|
||||
OpenWorldHint: new(true),
|
||||
ReadOnlyHint: false,
|
||||
},
|
||||
}, cobramcp.GenToolHandler(
|
||||
insertTool, func(input subscription.Subscription, writer io.Writer) error {
|
||||
if !input.Confirmed {
|
||||
return utils.ErrNotConfirmed
|
||||
}
|
||||
return input.Insert(writer)
|
||||
},
|
||||
}, cobramcp.GenToolHandlerWithMRTR(
|
||||
insertTool, cobramcp.ConfirmThen(
|
||||
func(input subscription.Subscription) string {
|
||||
return fmt.Sprintf(insertConfirm, input.ChannelId)
|
||||
},
|
||||
func(input subscription.Subscription, w io.Writer) error {
|
||||
return input.Insert(w)
|
||||
},
|
||||
),
|
||||
),
|
||||
)
|
||||
subscriptionCmd.AddCommand(insertCmd)
|
||||
@@ -84,8 +86,7 @@ var insertCmd = &cobra.Command{
|
||||
Long: insertLong,
|
||||
Example: insertExample,
|
||||
PreRunE: func(c *cobra.Command, _ []string) error {
|
||||
msg := fmt.Sprintf("Would insert subscription to channel: %s", channelId)
|
||||
return utils.ConfirmPreRun(c, msg)
|
||||
return utils.ConfirmPreRun(c, fmt.Sprintf(insertConfirm, channelId))
|
||||
},
|
||||
Run: func(c *cobra.Command, _ []string) {
|
||||
output, _ := c.Flags().GetString("output")
|
||||
|
||||
@@ -19,6 +19,7 @@ import (
|
||||
|
||||
const (
|
||||
deleteTool = "thirdPartyLink-delete"
|
||||
deleteConfirm = "Delete third-party link: %s"
|
||||
deleteShort = "Delete a third-party link"
|
||||
deleteLong = "Delete a third-party link. Use this tool to delete a link between a YouTube channel and a third-party service."
|
||||
deleteExample = `# Delete a third-party link
|
||||
@@ -35,7 +36,6 @@ var deleteInSchema = &jsonschema.Schema{
|
||||
Enum: []any{"linkUnspecified", "channelToStoreLink"},
|
||||
},
|
||||
"external_channel_id": {Type: "string", Description: extCidUsage},
|
||||
"confirmed": {Type: "boolean", Description: pkg.ConfirmedUsage},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -49,14 +49,15 @@ func init() {
|
||||
OpenWorldHint: new(true),
|
||||
ReadOnlyHint: false,
|
||||
},
|
||||
}, cobramcp.GenToolHandler(
|
||||
deleteTool,
|
||||
func(input thirdPartyLink.ThirdPartyLink, writer io.Writer) error {
|
||||
if !input.Confirmed {
|
||||
return utils.ErrNotConfirmed
|
||||
}
|
||||
return input.Delete(writer)
|
||||
},
|
||||
}, cobramcp.GenToolHandlerWithMRTR(
|
||||
deleteTool, cobramcp.ConfirmThen(
|
||||
func(input thirdPartyLink.ThirdPartyLink) string {
|
||||
return fmt.Sprintf(deleteConfirm, input.LinkingToken)
|
||||
},
|
||||
func(input thirdPartyLink.ThirdPartyLink, w io.Writer) error {
|
||||
return input.Delete(w)
|
||||
},
|
||||
),
|
||||
),
|
||||
)
|
||||
thirdPartyLinkCmd.AddCommand(deleteCmd)
|
||||
@@ -77,8 +78,7 @@ var deleteCmd = &cobra.Command{
|
||||
Long: deleteLong,
|
||||
Example: deleteExample,
|
||||
PreRunE: func(c *cobra.Command, _ []string) error {
|
||||
msg := fmt.Sprintf("Would delete third-party link: %s", linkingToken)
|
||||
return utils.ConfirmPreRun(c, msg)
|
||||
return utils.ConfirmPreRun(c, fmt.Sprintf(deleteConfirm, linkingToken))
|
||||
},
|
||||
Run: func(c *cobra.Command, _ []string) {
|
||||
input := thirdPartyLink.NewThirdPartyLink(
|
||||
|
||||
@@ -20,6 +20,7 @@ import (
|
||||
|
||||
const (
|
||||
insertTool = "thirdPartyLink-insert"
|
||||
insertConfirm = "Insert third-party link: %s"
|
||||
insertShort = "Insert a new third-party link"
|
||||
insertLong = "Insert a new third-party link. Use this tool to create a link between a YouTube channel and a third-party service."
|
||||
insertExample = `# Insert a new third-party link
|
||||
@@ -43,7 +44,6 @@ var insertInSchema = &jsonschema.Schema{
|
||||
Type: "string", Enum: []any{"json", "yaml", "silent"},
|
||||
Description: pkg.SilentUsage, Default: jsontext.Value(`"yaml"`),
|
||||
},
|
||||
"confirmed": {Type: "boolean", Description: pkg.ConfirmedUsage},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -57,14 +57,15 @@ func init() {
|
||||
OpenWorldHint: new(true),
|
||||
ReadOnlyHint: false,
|
||||
},
|
||||
}, cobramcp.GenToolHandler(
|
||||
insertTool,
|
||||
func(input thirdPartyLink.ThirdPartyLink, writer io.Writer) error {
|
||||
if !input.Confirmed {
|
||||
return utils.ErrNotConfirmed
|
||||
}
|
||||
return input.Insert(writer)
|
||||
},
|
||||
}, cobramcp.GenToolHandlerWithMRTR(
|
||||
insertTool, cobramcp.ConfirmThen(
|
||||
func(input thirdPartyLink.ThirdPartyLink) string {
|
||||
return fmt.Sprintf(insertConfirm, input.LinkingToken)
|
||||
},
|
||||
func(input thirdPartyLink.ThirdPartyLink, w io.Writer) error {
|
||||
return input.Insert(w)
|
||||
},
|
||||
),
|
||||
),
|
||||
)
|
||||
thirdPartyLinkCmd.AddCommand(insertCmd)
|
||||
@@ -90,8 +91,7 @@ var insertCmd = &cobra.Command{
|
||||
Long: insertLong,
|
||||
Example: insertExample,
|
||||
PreRunE: func(c *cobra.Command, _ []string) error {
|
||||
msg := fmt.Sprintf("Would insert third-party link: %s", linkingToken)
|
||||
return utils.ConfirmPreRun(c, msg)
|
||||
return utils.ConfirmPreRun(c, fmt.Sprintf(insertConfirm, linkingToken))
|
||||
},
|
||||
Run: func(c *cobra.Command, _ []string) {
|
||||
output, _ := c.Flags().GetString("output")
|
||||
|
||||
@@ -20,6 +20,7 @@ import (
|
||||
|
||||
const (
|
||||
updateTool = "thirdPartyLink-update"
|
||||
updateConfirm = "Update third-party link: %s"
|
||||
updateShort = "Update a third-party link"
|
||||
updateLong = "Update a third-party link. Use this tool to update the status or type of a link between a YouTube channel and a third-party service."
|
||||
updateExample = `# Update a third-party link status
|
||||
@@ -45,7 +46,6 @@ var updateInSchema = &jsonschema.Schema{
|
||||
Type: "string", Enum: []any{"json", "yaml", "silent"},
|
||||
Description: pkg.SilentUsage, Default: jsontext.Value(`"yaml"`),
|
||||
},
|
||||
"confirmed": {Type: "boolean", Description: pkg.ConfirmedUsage},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -59,14 +59,15 @@ func init() {
|
||||
OpenWorldHint: new(true),
|
||||
ReadOnlyHint: false,
|
||||
},
|
||||
}, cobramcp.GenToolHandler(
|
||||
updateTool,
|
||||
func(input thirdPartyLink.ThirdPartyLink, writer io.Writer) error {
|
||||
if !input.Confirmed {
|
||||
return utils.ErrNotConfirmed
|
||||
}
|
||||
return input.Update(writer)
|
||||
},
|
||||
}, cobramcp.GenToolHandlerWithMRTR(
|
||||
updateTool, cobramcp.ConfirmThen(
|
||||
func(input thirdPartyLink.ThirdPartyLink) string {
|
||||
return fmt.Sprintf(updateConfirm, input.LinkingToken)
|
||||
},
|
||||
func(input thirdPartyLink.ThirdPartyLink, w io.Writer) error {
|
||||
return input.Update(w)
|
||||
},
|
||||
),
|
||||
),
|
||||
)
|
||||
thirdPartyLinkCmd.AddCommand(updateCmd)
|
||||
@@ -91,8 +92,7 @@ var updateCmd = &cobra.Command{
|
||||
Long: updateLong,
|
||||
Example: updateExample,
|
||||
PreRunE: func(c *cobra.Command, _ []string) error {
|
||||
msg := fmt.Sprintf("Would update third-party link: %s", linkingToken)
|
||||
return utils.ConfirmPreRun(c, msg)
|
||||
return utils.ConfirmPreRun(c, fmt.Sprintf(updateConfirm, linkingToken))
|
||||
},
|
||||
Run: func(c *cobra.Command, _ []string) {
|
||||
output, _ := c.Flags().GetString("output")
|
||||
|
||||
+11
-10
@@ -20,6 +20,7 @@ import (
|
||||
|
||||
const (
|
||||
setTool = "thumbnail-set"
|
||||
setConfirm = "Set thumbnail for video: %s"
|
||||
setShort = "Set a thumbnail for a video"
|
||||
setLong = "Set a thumbnail for a video. Use this tool to set a thumbnail for a video."
|
||||
setExample = `# Set a thumbnail for a video
|
||||
@@ -38,7 +39,6 @@ var setInSchema = &jsonschema.Schema{
|
||||
Type: "string", Enum: []any{"json", "yaml", "silent"},
|
||||
Description: pkg.SilentUsage, Default: jsontext.Value(`"yaml"`),
|
||||
},
|
||||
"confirmed": {Type: "boolean", Description: pkg.ConfirmedUsage},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -52,13 +52,15 @@ func init() {
|
||||
OpenWorldHint: new(true),
|
||||
ReadOnlyHint: false,
|
||||
},
|
||||
}, cobramcp.GenToolHandler(
|
||||
setTool, func(input thumbnail.Thumbnail, writer io.Writer) error {
|
||||
if !input.Confirmed {
|
||||
return utils.ErrNotConfirmed
|
||||
}
|
||||
return input.Set(writer)
|
||||
},
|
||||
}, cobramcp.GenToolHandlerWithMRTR(
|
||||
setTool, cobramcp.ConfirmThen(
|
||||
func(input thumbnail.Thumbnail) string {
|
||||
return fmt.Sprintf(setConfirm, input.VideoId)
|
||||
},
|
||||
func(input thumbnail.Thumbnail, w io.Writer) error {
|
||||
return input.Set(w)
|
||||
},
|
||||
),
|
||||
),
|
||||
)
|
||||
thumbnailCmd.AddCommand(setCmd)
|
||||
@@ -77,8 +79,7 @@ var setCmd = &cobra.Command{
|
||||
Long: setLong,
|
||||
Example: setExample,
|
||||
PreRunE: func(c *cobra.Command, _ []string) error {
|
||||
msg := fmt.Sprintf("Would set thumbnail for video: %s", videoId)
|
||||
return utils.ConfirmPreRun(c, msg)
|
||||
return utils.ConfirmPreRun(c, fmt.Sprintf(setConfirm, videoId))
|
||||
},
|
||||
Run: func(c *cobra.Command, _ []string) {
|
||||
output, _ := c.Flags().GetString("output")
|
||||
|
||||
+13
-10
@@ -21,6 +21,7 @@ import (
|
||||
const (
|
||||
deleteTool = "video-delete"
|
||||
deleteIdsUsage = "IDs of the videos to delete"
|
||||
deleteConfirm = "Delete video(s): %s"
|
||||
deleteShort = "Delete videos"
|
||||
deleteLong = "Delete videos. Use this tool to delete videos by IDs."
|
||||
deleteExample = `# Delete a video by ID
|
||||
@@ -37,7 +38,6 @@ var deleteInSchema = &jsonschema.Schema{
|
||||
Type: "array", Description: deleteIdsUsage,
|
||||
Items: &jsonschema.Schema{Type: "string"},
|
||||
},
|
||||
"confirmed": {Type: "boolean", Description: pkg.ConfirmedUsage},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -51,13 +51,15 @@ func init() {
|
||||
OpenWorldHint: new(true),
|
||||
ReadOnlyHint: false,
|
||||
},
|
||||
}, cobramcp.GenToolHandler(
|
||||
deleteTool, func(input video.Video, writer io.Writer) error {
|
||||
if !input.Confirmed {
|
||||
return utils.ErrNotConfirmed
|
||||
}
|
||||
return input.Delete(writer)
|
||||
},
|
||||
}, cobramcp.GenToolHandlerWithMRTR(
|
||||
deleteTool, cobramcp.ConfirmThen(
|
||||
func(input video.Video) string {
|
||||
return fmt.Sprintf(deleteConfirm, strings.Join(input.Ids, ", "))
|
||||
},
|
||||
func(input video.Video, w io.Writer) error {
|
||||
return input.Delete(w)
|
||||
},
|
||||
),
|
||||
),
|
||||
)
|
||||
videoCmd.AddCommand(deleteCmd)
|
||||
@@ -73,8 +75,9 @@ var deleteCmd = &cobra.Command{
|
||||
Long: deleteLong,
|
||||
Example: deleteExample,
|
||||
PreRunE: func(c *cobra.Command, _ []string) error {
|
||||
msg := fmt.Sprintf("Would delete video(s): %s", strings.Join(ids, ", "))
|
||||
return utils.ConfirmPreRun(c, msg)
|
||||
return utils.ConfirmPreRun(
|
||||
c, fmt.Sprintf(deleteConfirm, strings.Join(ids, ", ")),
|
||||
)
|
||||
},
|
||||
Run: func(c *cobra.Command, _ []string) {
|
||||
input := video.NewVideo(video.WithIds(ids))
|
||||
|
||||
+11
-11
@@ -21,6 +21,7 @@ import (
|
||||
const (
|
||||
insertTool = "video-insert"
|
||||
insertLangUsage = "Language of the video"
|
||||
insertConfirm = "Insert video: %s"
|
||||
insertShort = "Upload a video"
|
||||
insertLong = "Upload a video. Use this tool to upload a video."
|
||||
insertExample = `# Upload a public video
|
||||
@@ -64,8 +65,6 @@ var insertInSchema = &jsonschema.Schema{
|
||||
"stabilize": {Type: "boolean", Description: stabilizeUsage},
|
||||
"notify_subscribers": {Type: "boolean", Description: nsUsage},
|
||||
"public_stats_viewable": {Type: "boolean", Description: psvUsage},
|
||||
"confirmed": {Type: "boolean", Description: pkg.ConfirmedUsage},
|
||||
|
||||
"on_behalf_of_content_owner": {
|
||||
Type: "string",
|
||||
Description: pkg.OBOCOUsage,
|
||||
@@ -91,13 +90,15 @@ func init() {
|
||||
OpenWorldHint: new(true),
|
||||
ReadOnlyHint: false,
|
||||
},
|
||||
}, cobramcp.GenToolHandler(
|
||||
insertTool, func(input video.Video, writer io.Writer) error {
|
||||
if !input.Confirmed {
|
||||
return utils.ErrNotConfirmed
|
||||
}
|
||||
return input.Insert(writer)
|
||||
},
|
||||
}, cobramcp.GenToolHandlerWithMRTR(
|
||||
insertTool, cobramcp.ConfirmThen(
|
||||
func(input video.Video) string {
|
||||
return fmt.Sprintf(insertConfirm, input.File)
|
||||
},
|
||||
func(input video.Video, w io.Writer) error {
|
||||
return input.Insert(w)
|
||||
},
|
||||
),
|
||||
),
|
||||
)
|
||||
videoCmd.AddCommand(insertCmd)
|
||||
@@ -152,8 +153,7 @@ var insertCmd = &cobra.Command{
|
||||
Long: insertLong,
|
||||
Example: insertExample,
|
||||
PreRunE: func(c *cobra.Command, _ []string) error {
|
||||
msg := fmt.Sprintf("Would insert video: %s", file)
|
||||
return utils.ConfirmPreRun(c, msg)
|
||||
return utils.ConfirmPreRun(c, fmt.Sprintf(insertConfirm, file))
|
||||
},
|
||||
Run: func(c *cobra.Command, _ []string) {
|
||||
output, _ := c.Flags().GetString("output")
|
||||
|
||||
+14
-11
@@ -22,6 +22,7 @@ const (
|
||||
rateTool = "video-rate"
|
||||
rateIdsUsage = "IDs of the videos to rate"
|
||||
rateRUsage = "like|dislike|none"
|
||||
rateConfirm = "Rate video(s) %s as %s"
|
||||
rateShort = "Rate a video"
|
||||
rateLong = "Rate a video. Use this tool to rate a video."
|
||||
rateExample = `# Like a video
|
||||
@@ -44,7 +45,6 @@ var rateInSchema = &jsonschema.Schema{
|
||||
Type: "string", Description: rateRUsage,
|
||||
Enum: []any{"like", "dislike", "none"},
|
||||
},
|
||||
"confirmed": {Type: "boolean", Description: pkg.ConfirmedUsage},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -58,13 +58,17 @@ func init() {
|
||||
OpenWorldHint: new(true),
|
||||
ReadOnlyHint: false,
|
||||
},
|
||||
}, cobramcp.GenToolHandler(
|
||||
rateTool, func(input video.Video, writer io.Writer) error {
|
||||
if !input.Confirmed {
|
||||
return utils.ErrNotConfirmed
|
||||
}
|
||||
return input.Rate(writer)
|
||||
},
|
||||
}, cobramcp.GenToolHandlerWithMRTR(
|
||||
rateTool, cobramcp.ConfirmThen(
|
||||
func(input video.Video) string {
|
||||
return fmt.Sprintf(
|
||||
rateConfirm, strings.Join(input.Ids, ", "), input.Rating,
|
||||
)
|
||||
},
|
||||
func(input video.Video, w io.Writer) error {
|
||||
return input.Rate(w)
|
||||
},
|
||||
),
|
||||
),
|
||||
)
|
||||
videoCmd.AddCommand(rateCmd)
|
||||
@@ -82,10 +86,9 @@ var rateCmd = &cobra.Command{
|
||||
Long: rateLong,
|
||||
Example: rateExample,
|
||||
PreRunE: func(c *cobra.Command, _ []string) error {
|
||||
msg := fmt.Sprintf(
|
||||
"Would rate video(s): %s as %s", strings.Join(ids, ", "), rating,
|
||||
return utils.ConfirmPreRun(
|
||||
c, fmt.Sprintf(rateConfirm, strings.Join(ids, ", "), rating),
|
||||
)
|
||||
return utils.ConfirmPreRun(c, msg)
|
||||
},
|
||||
Run: func(c *cobra.Command, _ []string) {
|
||||
input := video.NewVideo(
|
||||
|
||||
+12
-11
@@ -22,6 +22,7 @@ const (
|
||||
reportAbuseTool = "video-reportAbuse"
|
||||
raIdsUsage = "IDs of the videos to report abuse on"
|
||||
raLangUsage = "Language that the content was viewed in"
|
||||
reportAbuseConfirm = "Report abuse on video(s): %s"
|
||||
reportAbuseShort = "Report abuse on a video"
|
||||
reportAbuseLong = "Report abuse on a video. Use this tool to report abuse on a video."
|
||||
reportAbuseExample = `# Report abuse on a video
|
||||
@@ -45,7 +46,6 @@ var reportAbuseInSchema = &jsonschema.Schema{
|
||||
"comments": {Type: "string", Description: commentsUsage},
|
||||
"language": {Type: "string", Description: raLangUsage},
|
||||
"on_behalf_of_content_owner": {Type: "string", Description: pkg.OBOCOUsage},
|
||||
"confirmed": {Type: "boolean", Description: pkg.ConfirmedUsage},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -60,13 +60,15 @@ func init() {
|
||||
OpenWorldHint: new(true),
|
||||
ReadOnlyHint: false,
|
||||
},
|
||||
}, cobramcp.GenToolHandler(
|
||||
reportAbuseTool, func(input video.Video, writer io.Writer) error {
|
||||
if !input.Confirmed {
|
||||
return utils.ErrNotConfirmed
|
||||
}
|
||||
return input.ReportAbuse(writer)
|
||||
},
|
||||
}, cobramcp.GenToolHandlerWithMRTR(
|
||||
reportAbuseTool, cobramcp.ConfirmThen(
|
||||
func(input video.Video) string {
|
||||
return fmt.Sprintf(reportAbuseConfirm, strings.Join(input.Ids, ", "))
|
||||
},
|
||||
func(input video.Video, w io.Writer) error {
|
||||
return input.ReportAbuse(w)
|
||||
},
|
||||
),
|
||||
),
|
||||
)
|
||||
videoCmd.AddCommand(reportAbuseCmd)
|
||||
@@ -96,10 +98,9 @@ var reportAbuseCmd = &cobra.Command{
|
||||
Long: reportAbuseLong,
|
||||
Example: reportAbuseExample,
|
||||
PreRunE: func(c *cobra.Command, _ []string) error {
|
||||
msg := fmt.Sprintf(
|
||||
"Would report abuse on video(s): %s", strings.Join(ids, ", "),
|
||||
return utils.ConfirmPreRun(
|
||||
c, fmt.Sprintf(reportAbuseConfirm, strings.Join(ids, ", ")),
|
||||
)
|
||||
return utils.ConfirmPreRun(c, msg)
|
||||
},
|
||||
Run: func(c *cobra.Command, _ []string) {
|
||||
input := video.NewVideo(
|
||||
|
||||
+14
-11
@@ -23,6 +23,7 @@ const (
|
||||
updateTool = "video-update"
|
||||
updateIdUsage = "ID of the video to update"
|
||||
updateLangUsage = "Language of the video"
|
||||
updateConfirm = "Update video: %s"
|
||||
updateShort = "Update a video"
|
||||
updateLong = "Update a video. Use this tool to update a video."
|
||||
updateExample = `# Update video title
|
||||
@@ -65,7 +66,6 @@ var updateInSchema = &jsonschema.Schema{
|
||||
"embeddable": {Type: "boolean", Description: embeddableUsage},
|
||||
"contains_synthetic_media": {Type: "boolean", Description: csmUsage},
|
||||
"recording_date": {Type: "string", Description: rdUsage},
|
||||
"confirmed": {Type: "boolean", Description: pkg.ConfirmedUsage},
|
||||
"output": {
|
||||
Type: "string", Enum: []any{"json", "yaml", "silent"},
|
||||
Description: pkg.SilentUsage, Default: jsontext.Value(`"yaml"`),
|
||||
@@ -83,14 +83,16 @@ func init() {
|
||||
OpenWorldHint: new(true),
|
||||
ReadOnlyHint: false,
|
||||
},
|
||||
}, cobramcp.GenToolHandler(
|
||||
updateTool, func(input video.Video, writer io.Writer) error {
|
||||
if !input.Confirmed {
|
||||
return utils.ErrNotConfirmed
|
||||
}
|
||||
input.MaxResults = 1
|
||||
return input.Update(writer)
|
||||
},
|
||||
}, cobramcp.GenToolHandlerWithMRTR(
|
||||
updateTool, cobramcp.ConfirmThen(
|
||||
func(input video.Video) string {
|
||||
return fmt.Sprintf(updateConfirm, strings.Join(input.Ids, ", "))
|
||||
},
|
||||
func(input video.Video, w io.Writer) error {
|
||||
input.MaxResults = 1
|
||||
return input.Update(w)
|
||||
},
|
||||
),
|
||||
),
|
||||
)
|
||||
videoCmd.AddCommand(updateCmd)
|
||||
@@ -124,8 +126,9 @@ var updateCmd = &cobra.Command{
|
||||
Long: updateLong,
|
||||
Example: updateExample,
|
||||
PreRunE: func(c *cobra.Command, _ []string) error {
|
||||
msg := fmt.Sprintf("Would update video: %s", strings.Join(ids, ", "))
|
||||
return utils.ConfirmPreRun(c, msg)
|
||||
return utils.ConfirmPreRun(
|
||||
c, fmt.Sprintf(updateConfirm, strings.Join(ids, ", ")),
|
||||
)
|
||||
},
|
||||
Run: func(c *cobra.Command, _ []string) {
|
||||
output, _ := c.Flags().GetString("output")
|
||||
|
||||
+11
-10
@@ -19,6 +19,7 @@ import (
|
||||
|
||||
const (
|
||||
setTool = "watermark-set"
|
||||
setConfirm = "Set watermark for channel: %s"
|
||||
setShort = "Set a watermark for channel's videos"
|
||||
setLong = "Set a watermark for channel's videos. Use this tool to set a watermark for channel's videos."
|
||||
setExample = `# Set a watermark for a channel
|
||||
@@ -41,7 +42,6 @@ var setInSchema = &jsonschema.Schema{
|
||||
},
|
||||
"duration_ms": {Type: "number", Description: dmUsage},
|
||||
"offset_ms": {Type: "number", Description: omUsage},
|
||||
"confirmed": {Type: "boolean", Description: pkg.ConfirmedUsage},
|
||||
"offset_type": {
|
||||
Type: "string", Description: otUsage,
|
||||
Enum: []any{"offsetFromStart", "offsetFromEnd"},
|
||||
@@ -60,13 +60,15 @@ func init() {
|
||||
OpenWorldHint: new(true),
|
||||
ReadOnlyHint: false,
|
||||
},
|
||||
}, cobramcp.GenToolHandler(
|
||||
setTool, func(input watermark.Watermark, writer io.Writer) error {
|
||||
if !input.Confirmed {
|
||||
return utils.ErrNotConfirmed
|
||||
}
|
||||
return input.Set(writer)
|
||||
},
|
||||
}, cobramcp.GenToolHandlerWithMRTR(
|
||||
setTool, cobramcp.ConfirmThen(
|
||||
func(input watermark.Watermark) string {
|
||||
return fmt.Sprintf(setConfirm, input.ChannelId)
|
||||
},
|
||||
func(input watermark.Watermark, w io.Writer) error {
|
||||
return input.Set(w)
|
||||
},
|
||||
),
|
||||
),
|
||||
)
|
||||
watermarkCmd.AddCommand(setCmd)
|
||||
@@ -93,8 +95,7 @@ var setCmd = &cobra.Command{
|
||||
Long: setLong,
|
||||
Example: setExample,
|
||||
PreRunE: func(c *cobra.Command, _ []string) error {
|
||||
msg := fmt.Sprintf("Would set watermark for channel: %s", channelId)
|
||||
return utils.ConfirmPreRun(c, msg)
|
||||
return utils.ConfirmPreRun(c, fmt.Sprintf(setConfirm, channelId))
|
||||
},
|
||||
Run: func(c *cobra.Command, _ []string) {
|
||||
input := watermark.NewWatermark(
|
||||
|
||||
+11
-10
@@ -19,6 +19,7 @@ import (
|
||||
|
||||
const (
|
||||
unsetTool = "watermark-unset"
|
||||
unsetConfirm = "Unset watermark for channel: %s"
|
||||
unsetShort = "Unset a watermark for channel's videos"
|
||||
unsetLong = "Unset a watermark for channel's videos. Use this tool to unset a watermark for a channel's videos."
|
||||
unsetExample = `# Unset watermark for a channel
|
||||
@@ -30,7 +31,6 @@ var unsetInSchema = &jsonschema.Schema{
|
||||
Required: []string{"channel_id"},
|
||||
Properties: map[string]*jsonschema.Schema{
|
||||
"channel_id": {Type: "string", Description: cidUsage},
|
||||
"confirmed": {Type: "boolean", Description: pkg.ConfirmedUsage},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -44,13 +44,15 @@ func init() {
|
||||
OpenWorldHint: new(true),
|
||||
ReadOnlyHint: false,
|
||||
},
|
||||
}, cobramcp.GenToolHandler(
|
||||
unsetTool, func(input watermark.Watermark, writer io.Writer) error {
|
||||
if !input.Confirmed {
|
||||
return utils.ErrNotConfirmed
|
||||
}
|
||||
return input.Unset(writer)
|
||||
},
|
||||
}, cobramcp.GenToolHandlerWithMRTR(
|
||||
unsetTool, cobramcp.ConfirmThen(
|
||||
func(input watermark.Watermark) string {
|
||||
return fmt.Sprintf(unsetConfirm, input.ChannelId)
|
||||
},
|
||||
func(input watermark.Watermark, w io.Writer) error {
|
||||
return input.Unset(w)
|
||||
},
|
||||
),
|
||||
),
|
||||
)
|
||||
watermarkCmd.AddCommand(unsetCmd)
|
||||
@@ -66,8 +68,7 @@ var unsetCmd = &cobra.Command{
|
||||
Long: unsetLong,
|
||||
Example: unsetExample,
|
||||
PreRunE: func(c *cobra.Command, _ []string) error {
|
||||
msg := fmt.Sprintf("Would unset watermark for channel: %s", channelId)
|
||||
return utils.ConfirmPreRun(c, msg)
|
||||
return utils.ConfirmPreRun(c, fmt.Sprintf(unsetConfirm, channelId))
|
||||
},
|
||||
Run: func(c *cobra.Command, _ []string) {
|
||||
input := watermark.NewWatermark(watermark.WithChannelId(channelId))
|
||||
|
||||
@@ -3,7 +3,7 @@ module github.com/eat-pray-ai/yutu
|
||||
go 1.27.0
|
||||
|
||||
require (
|
||||
github.com/eat-pray-ai/cobra-mcp v0.4.1
|
||||
github.com/eat-pray-ai/cobra-mcp v0.4.5
|
||||
github.com/google/jsonschema-go v0.4.3
|
||||
github.com/jedib0t/go-pretty/v6 v6.8.3
|
||||
github.com/modelcontextprotocol/go-sdk v1.7.0
|
||||
|
||||
@@ -26,6 +26,8 @@ github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1
|
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/eat-pray-ai/cobra-mcp v0.4.1 h1:z21A/tnsNiTjyuAPIcrgjNVT37TJ7jH9PbCj+4fPQNc=
|
||||
github.com/eat-pray-ai/cobra-mcp v0.4.1/go.mod h1:YfRGGxp7LXAowS408XJ8SzCn74oaXGmjbcbjyYyPYqQ=
|
||||
github.com/eat-pray-ai/cobra-mcp v0.4.5 h1:HXYaxvXF0PoYjlF+B0myikx4w/X+H/LFjgmYw89BB70=
|
||||
github.com/eat-pray-ai/cobra-mcp v0.4.5/go.mod h1:ikePQIGp+iDcFTk6WkhYY8clOzn0cl2+sr8JupthOmQ=
|
||||
github.com/felixge/httpsnoop v1.1.0 h1:3YtUj32ZZkqZtt3sZZsClsymw/QDuVfpNhoA31zeORc=
|
||||
github.com/felixge/httpsnoop v1.1.0/go.mod h1:Zqxgdd+1Rkcz8euOqdr7lqgCRJztwr5hp9vDSi5UZCE=
|
||||
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
|
||||
|
||||
Reference in new issue
Block a user