Skip to content

Commit 21a1df7

Browse files
RossTarrantCopilot
andcommitted
Use inline discussion comments schema
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent b43600a commit 21a1df7

2 files changed

Lines changed: 23 additions & 26 deletions

File tree

pkg/github/__toolsnaps__/get_discussion_comments.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"type": "string"
2424
},
2525
"perPage": {
26-
"description": "Optional page size. Do not provide unless the user explicitly asks for a page size, limit, first N comments, or pagination.",
26+
"description": "Results per page for pagination (min 1, max 100)",
2727
"maximum": 100,
2828
"minimum": 1,
2929
"type": "number"

pkg/github/discussions.go

Lines changed: 22 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -384,30 +384,6 @@ Does not return comments, replies, or comment counts. Do not use this for reques
384384
}
385385

386386
func GetDiscussionComments(t translations.TranslationHelperFunc) inventory.ServerTool {
387-
schema := WithCursorPagination(&jsonschema.Schema{
388-
Type: "object",
389-
Properties: map[string]*jsonschema.Schema{
390-
"owner": {
391-
Type: "string",
392-
Description: "Repository owner or organization login. For org-level discussion URLs like https://github.com/orgs/ORG/discussions/NUMBER, use ORG.",
393-
},
394-
"repo": {
395-
Type: "string",
396-
Description: "Repository name. For org-level discussion URLs like https://github.com/orgs/ORG/discussions/NUMBER, use .github.",
397-
},
398-
"discussionNumber": {
399-
Type: "number",
400-
Description: "Discussion number from the URL path after /discussions/. This is not a node ID.",
401-
},
402-
"includeReplies": {
403-
Type: "boolean",
404-
Description: "Optional. Set true only when the user explicitly asks to include replies. Set false when the user explicitly asks to exclude replies. Omit when replies are not mentioned.",
405-
},
406-
},
407-
Required: []string{"owner", "repo", "discussionNumber"},
408-
})
409-
schema.Properties["perPage"].Description = "Optional page size. Do not provide unless the user explicitly asks for a page size, limit, first N comments, or pagination."
410-
411387
return NewTool(
412388
ToolsetMetadataDiscussions,
413389
mcp.Tool{
@@ -420,7 +396,28 @@ Do not call get_discussion first for comment-related requests; this tool is suff
420396
Title: t("TOOL_GET_DISCUSSION_COMMENTS_USER_TITLE", "Get discussion comments"),
421397
ReadOnlyHint: true,
422398
},
423-
InputSchema: schema,
399+
InputSchema: WithCursorPagination(&jsonschema.Schema{
400+
Type: "object",
401+
Properties: map[string]*jsonschema.Schema{
402+
"owner": {
403+
Type: "string",
404+
Description: "Repository owner or organization login. For org-level discussion URLs like https://github.com/orgs/ORG/discussions/NUMBER, use ORG.",
405+
},
406+
"repo": {
407+
Type: "string",
408+
Description: "Repository name. For org-level discussion URLs like https://github.com/orgs/ORG/discussions/NUMBER, use .github.",
409+
},
410+
"discussionNumber": {
411+
Type: "number",
412+
Description: "Discussion number from the URL path after /discussions/. This is not a node ID.",
413+
},
414+
"includeReplies": {
415+
Type: "boolean",
416+
Description: "Optional. Set true only when the user explicitly asks to include replies. Set false when the user explicitly asks to exclude replies. Omit when replies are not mentioned.",
417+
},
418+
},
419+
Required: []string{"owner", "repo", "discussionNumber"},
420+
}),
424421
},
425422
[]scopes.Scope{scopes.Repo},
426423
func(ctx context.Context, deps ToolDependencies, _ *mcp.CallToolRequest, args map[string]any) (*mcp.CallToolResult, any, error) {

0 commit comments

Comments
 (0)