@@ -59,7 +59,7 @@ func ListDiscussions(getGQLClient GetGQLClientFn, t translations.TranslationHelp
5959 var params struct {
6060 Owner string
6161 Repo string
62- CategoryId string
62+ CategoryID string
6363 Since string
6464 Sort string
6565 Direction string
@@ -94,7 +94,7 @@ func ListDiscussions(getGQLClient GetGQLClientFn, t translations.TranslationHelp
9494 vars := map [string ]interface {}{
9595 "owner" : githubv4 .String (params .Owner ),
9696 "repo" : githubv4 .String (params .Repo ),
97- "categoryId" : githubv4 .ID (params .CategoryId ),
97+ "categoryId" : githubv4 .ID (params .CategoryID ),
9898 "sort" : githubv4 .DiscussionOrderField (params .Sort ),
9999 "direction" : githubv4 .OrderDirection (params .Direction ),
100100 "first" : githubv4 .Int (params .First ),
@@ -155,25 +155,21 @@ func GetDiscussion(getGQLClient GetGQLClientFn, t translations.TranslationHelper
155155 mcp .Required (),
156156 mcp .Description ("Repository name" ),
157157 ),
158- mcp .WithNumber ("discussion_id " ,
158+ mcp .WithNumber ("discussionNumber " ,
159159 mcp .Required (),
160- mcp .Description ("Discussion ID " ),
160+ mcp .Description ("Discussion Number " ),
161161 ),
162162 ),
163163 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
171169 }
172- discussionID , err := RequiredInt (request , "discussion_id" )
173- if err != nil {
170+ if err := mapstructure .Decode (request .Params .Arguments , & params ); err != nil {
174171 return mcp .NewToolResultError (err .Error ()), nil
175172 }
176-
177173 client , err := getGQLClient (ctx )
178174 if err != nil {
179175 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
187183 State githubv4.String
188184 CreatedAt githubv4.DateTime
189185 URL githubv4.String `graphql:"url"`
190- } `graphql:"discussion(number: $discussionID )"`
186+ } `graphql:"discussion(number: $discussionNumber )"`
191187 } `graphql:"repository(owner: $owner, name: $repo)"`
192188 }
193189 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 ),
197193 }
198194 if err := client .Query (ctx , & q , vars ); err != nil {
199195 return mcp .NewToolResultError (err .Error ()), nil
@@ -224,19 +220,16 @@ func GetDiscussionComments(getGQLClient GetGQLClientFn, t translations.Translati
224220 }),
225221 mcp .WithString ("owner" , mcp .Required (), mcp .Description ("Repository owner" )),
226222 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 " )),
228224 ),
229225 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
237231 }
238- discussionID , err := RequiredInt (request , "discussion_id" )
239- if err != nil {
232+ if err := mapstructure .Decode (request .Params .Arguments , & params ); err != nil {
240233 return mcp .NewToolResultError (err .Error ()), nil
241234 }
242235
@@ -253,13 +246,13 @@ func GetDiscussionComments(getGQLClient GetGQLClientFn, t translations.Translati
253246 Body githubv4.String
254247 }
255248 } `graphql:"comments(first:100)"`
256- } `graphql:"discussion(number: $discussionID )"`
249+ } `graphql:"discussion(number: $discussionNumber )"`
257250 } `graphql:"repository(owner: $owner, name: $repo)"`
258251 }
259252 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 ),
263256 }
264257 if err := client .Query (ctx , & q , vars ); err != nil {
265258 return mcp .NewToolResultError (err .Error ()), nil
@@ -280,7 +273,7 @@ func GetDiscussionComments(getGQLClient GetGQLClientFn, t translations.Translati
280273
281274func ListDiscussionCategories (getGQLClient GetGQLClientFn , t translations.TranslationHelperFunc ) (tool mcp.Tool , handler server.ToolHandlerFunc ) {
282275 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" )),
284277 mcp .WithToolAnnotation (mcp.ToolAnnotation {
285278 Title : t ("TOOL_LIST_DISCUSSION_CATEGORIES_USER_TITLE" , "List discussion categories" ),
286279 ReadOnlyHint : toBoolPtr (true ),
0 commit comments