@@ -59,7 +59,7 @@ func ListDiscussions(getGQLClient GetGQLClientFn, t translations.TranslationHelp
59
59
var params struct {
60
60
Owner string
61
61
Repo string
62
- CategoryId string
62
+ CategoryID string
63
63
Since string
64
64
Sort string
65
65
Direction string
@@ -94,7 +94,7 @@ func ListDiscussions(getGQLClient GetGQLClientFn, t translations.TranslationHelp
94
94
vars := map [string ]interface {}{
95
95
"owner" : githubv4 .String (params .Owner ),
96
96
"repo" : githubv4 .String (params .Repo ),
97
- "categoryId" : githubv4 .ID (params .CategoryId ),
97
+ "categoryId" : githubv4 .ID (params .CategoryID ),
98
98
"sort" : githubv4 .DiscussionOrderField (params .Sort ),
99
99
"direction" : githubv4 .OrderDirection (params .Direction ),
100
100
"first" : githubv4 .Int (params .First ),
@@ -155,25 +155,21 @@ func GetDiscussion(getGQLClient GetGQLClientFn, t translations.TranslationHelper
155
155
mcp .Required (),
156
156
mcp .Description ("Repository name" ),
157
157
),
158
- mcp .WithNumber ("discussion_id " ,
158
+ mcp .WithNumber ("discussionNumber " ,
159
159
mcp .Required (),
160
- mcp .Description ("Discussion ID " ),
160
+ mcp .Description ("Discussion Number " ),
161
161
),
162
162
),
163
163
func (ctx context.Context , request mcp.CallToolRequest ) (* mcp.CallToolResult , error ) {
164
- owner , err := requiredParam [string ](request , "owner" )
165
- if err != nil {
166
- return mcp .NewToolResultError (err .Error ()), nil
167
- }
168
- repo , err := requiredParam [string ](request , "repo" )
169
- if err != nil {
170
- return mcp .NewToolResultError (err .Error ()), nil
164
+ // Decode params
165
+ var params struct {
166
+ Owner string
167
+ Repo string
168
+ DiscussionNumber int32
171
169
}
172
- discussionID , err := RequiredInt (request , "discussion_id" )
173
- if err != nil {
170
+ if err := mapstructure .Decode (request .Params .Arguments , & params ); err != nil {
174
171
return mcp .NewToolResultError (err .Error ()), nil
175
172
}
176
-
177
173
client , err := getGQLClient (ctx )
178
174
if err != nil {
179
175
return mcp .NewToolResultError (fmt .Sprintf ("failed to get GitHub GQL client: %v" , err )), nil
@@ -187,13 +183,13 @@ func GetDiscussion(getGQLClient GetGQLClientFn, t translations.TranslationHelper
187
183
State githubv4.String
188
184
CreatedAt githubv4.DateTime
189
185
URL githubv4.String `graphql:"url"`
190
- } `graphql:"discussion(number: $discussionID )"`
186
+ } `graphql:"discussion(number: $discussionNumber )"`
191
187
} `graphql:"repository(owner: $owner, name: $repo)"`
192
188
}
193
189
vars := map [string ]interface {}{
194
- "owner" : githubv4 .String (owner ),
195
- "repo" : githubv4 .String (repo ),
196
- "discussionID " : githubv4 .Int (discussionID ),
190
+ "owner" : githubv4 .String (params . Owner ),
191
+ "repo" : githubv4 .String (params . Repo ),
192
+ "discussionNumber " : githubv4 .Int (params . DiscussionNumber ),
197
193
}
198
194
if err := client .Query (ctx , & q , vars ); err != nil {
199
195
return mcp .NewToolResultError (err .Error ()), nil
@@ -224,19 +220,16 @@ func GetDiscussionComments(getGQLClient GetGQLClientFn, t translations.Translati
224
220
}),
225
221
mcp .WithString ("owner" , mcp .Required (), mcp .Description ("Repository owner" )),
226
222
mcp .WithString ("repo" , mcp .Required (), mcp .Description ("Repository name" )),
227
- mcp .WithNumber ("discussion_id " , mcp .Required (), mcp .Description ("Discussion ID " )),
223
+ mcp .WithNumber ("discussionNumber " , mcp .Required (), mcp .Description ("Discussion Number " )),
228
224
),
229
225
func (ctx context.Context , request mcp.CallToolRequest ) (* mcp.CallToolResult , error ) {
230
- owner , err := requiredParam [string ](request , "owner" )
231
- if err != nil {
232
- return mcp .NewToolResultError (err .Error ()), nil
233
- }
234
- repo , err := requiredParam [string ](request , "repo" )
235
- if err != nil {
236
- return mcp .NewToolResultError (err .Error ()), nil
226
+ // Decode params
227
+ var params struct {
228
+ Owner string
229
+ Repo string
230
+ DiscussionNumber int32
237
231
}
238
- discussionID , err := RequiredInt (request , "discussion_id" )
239
- if err != nil {
232
+ if err := mapstructure .Decode (request .Params .Arguments , & params ); err != nil {
240
233
return mcp .NewToolResultError (err .Error ()), nil
241
234
}
242
235
@@ -253,13 +246,13 @@ func GetDiscussionComments(getGQLClient GetGQLClientFn, t translations.Translati
253
246
Body githubv4.String
254
247
}
255
248
} `graphql:"comments(first:100)"`
256
- } `graphql:"discussion(number: $discussionID )"`
249
+ } `graphql:"discussion(number: $discussionNumber )"`
257
250
} `graphql:"repository(owner: $owner, name: $repo)"`
258
251
}
259
252
vars := map [string ]interface {}{
260
- "owner" : githubv4 .String (owner ),
261
- "repo" : githubv4 .String (repo ),
262
- "discussionID " : githubv4 .Int (discussionID ),
253
+ "owner" : githubv4 .String (params . Owner ),
254
+ "repo" : githubv4 .String (params . Repo ),
255
+ "discussionNumber " : githubv4 .Int (params . DiscussionNumber ),
263
256
}
264
257
if err := client .Query (ctx , & q , vars ); err != nil {
265
258
return mcp .NewToolResultError (err .Error ()), nil
@@ -280,7 +273,7 @@ func GetDiscussionComments(getGQLClient GetGQLClientFn, t translations.Translati
280
273
281
274
func ListDiscussionCategories (getGQLClient GetGQLClientFn , t translations.TranslationHelperFunc ) (tool mcp.Tool , handler server.ToolHandlerFunc ) {
282
275
return mcp .NewTool ("list_discussion_categories" ,
283
- mcp .WithDescription (t ("TOOL_LIST_DISCUSSION_CATEGORIES_DESCRIPTION" , "List discussion categorie with their id and name, for a repository" )),
276
+ mcp .WithDescription (t ("TOOL_LIST_DISCUSSION_CATEGORIES_DESCRIPTION" , "List discussion categories with their id and name, for a repository" )),
284
277
mcp .WithToolAnnotation (mcp.ToolAnnotation {
285
278
Title : t ("TOOL_LIST_DISCUSSION_CATEGORIES_USER_TITLE" , "List discussion categories" ),
286
279
ReadOnlyHint : toBoolPtr (true ),
0 commit comments