@@ -14,39 +14,45 @@ import (
14
14
var defaultParts = []string {"id" , "snippet" , "contentDetails" }
15
15
16
16
var listTool = mcp .NewTool (
17
- "activity. list" ,
17
+ "activity- list" ,
18
18
mcp .WithTitleAnnotation ("List Activities" ),
19
19
mcp .WithOpenWorldHintAnnotation (true ),
20
20
mcp .WithDescription (long ),
21
21
mcp .WithString (
22
- "channelId" , mcp .DefaultString ("" ), mcp .Description (ciUsage ),
22
+ "channelId" , mcp .DefaultString ("" ), mcp .Description (ciUsage ), mcp . Required (),
23
23
),
24
24
mcp .WithString (
25
25
"home" , mcp .Enum ("true" , "false" , "" ),
26
- mcp .DefaultString ("" ), mcp .Description (homeUsage ),
26
+ mcp .DefaultString ("" ), mcp .Description (homeUsage ), mcp . Required (),
27
27
),
28
28
mcp .WithNumber (
29
- "maxResults" , mcp .DefaultNumber (5 ), mcp .Description (mrUsage ),
29
+ "maxResults" , mcp .DefaultNumber (5 ), mcp .Description (mrUsage ), mcp . Required (),
30
30
),
31
31
mcp .WithString (
32
32
"mine" , mcp .Enum ("true" , "false" , "" ),
33
- mcp .DefaultString ("true" ), mcp .Description (mineUsage ),
33
+ mcp .DefaultString ("true" ), mcp .Description (mineUsage ), mcp . Required (),
34
34
),
35
35
mcp .WithString (
36
36
"publishedAfter" , mcp .DefaultString ("" ),
37
- mcp .Description (paUsage ),
37
+ mcp .Description (paUsage ), mcp . Required (),
38
38
),
39
39
mcp .WithString (
40
40
"publishedBefore" , mcp .DefaultString ("" ),
41
- mcp .Description (pbUsage ),
41
+ mcp .Description (pbUsage ), mcp . Required (),
42
42
),
43
43
mcp .WithString (
44
- "regionCode" , mcp .DefaultString ("" ), mcp .Description (rcUsage ),
44
+ "regionCode" , mcp .DefaultString ("" ),
45
+ mcp .Description (rcUsage ), mcp .Required (),
45
46
),
46
47
mcp .WithArray (
47
- "parts" , mcp .DefaultArray (defaultParts ), mcp .Description (partsUsage ),
48
+ "parts" , mcp .DefaultArray (defaultParts ),
49
+ mcp .Items (map [string ]any {"type" : "string" }),
50
+ mcp .Description (partsUsage ), mcp .Required (),
51
+ ),
52
+ mcp .WithString (
53
+ "output" , mcp .DefaultString ("" ), mcp .Description (outputUsage ),
54
+ mcp .Required (),
48
55
),
49
- mcp .WithString ("output" , mcp .DefaultString ("" ), mcp .Description (outputUsage )),
50
56
)
51
57
52
58
func run (writer io.Writer ) error {
@@ -99,18 +105,25 @@ func listHandler(ctx context.Context, request mcp.CallToolRequest) (
99
105
* mcp.CallToolResult , error ,
100
106
) {
101
107
args := request .GetArguments ()
102
- channelId = args ["channelId" ].(string )
103
- home = utils .BoolPtr (args ["home" ].(string ))
104
- maxResults = int64 (args ["maxResults" ].(float64 ))
105
- mine = utils .BoolPtr (args ["mine" ].(string ))
106
- publishedAfter = args ["publishedAfter" ].(string )
107
- publishedBefore = args ["publishedBefore" ].(string )
108
- regionCode = args ["regionCode" ].(string )
109
- parts = make ([]string , len (args ["parts" ].([]interface {})))
110
- for i , part := range args ["parts" ].([]interface {}) {
108
+ channelId , _ = args ["channelId" ].(string )
109
+ homeRaw , _ := args ["home" ].(string )
110
+ home = utils .BoolPtr (homeRaw )
111
+ maxResultsRaw , _ := args ["maxResults" ].(float64 )
112
+ maxResults = int64 (maxResultsRaw )
113
+ mineRaw , ok := args ["mine" ].(string )
114
+ if ! ok {
115
+ mineRaw = "true" // Default to true if not provided
116
+ }
117
+ mine = utils .BoolPtr (mineRaw )
118
+ publishedAfter , _ = args ["publishedAfter" ].(string )
119
+ publishedBefore , _ = args ["publishedBefore" ].(string )
120
+ regionCode , _ = args ["regionCode" ].(string )
121
+ partsRaw , _ := args ["parts" ].([]interface {})
122
+ parts = make ([]string , len (partsRaw ))
123
+ for i , part := range partsRaw {
111
124
parts [i ] = part .(string )
112
125
}
113
- output = args ["output" ].(string )
126
+ output , _ = args ["output" ].(string )
114
127
115
128
var writer bytes.Buffer
116
129
err := run (& writer )
0 commit comments