Skip to content

Commit 4df2d3d

Browse files
committed
WIP: schema generation
1 parent 3c18a34 commit 4df2d3d

22 files changed

+3310
-2109
lines changed

cmd/tools2md/main.go

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package main
2+
3+
import (
4+
"flag"
5+
"fmt"
6+
"os"
7+
8+
"github.com/github/github-mcp-server/internal/tools2md"
9+
"github.com/github/github-mcp-server/pkg/github"
10+
"github.com/github/github-mcp-server/pkg/translations"
11+
)
12+
13+
var filepath = flag.String("filepath", "schema.md", "filepath to schema file")
14+
15+
func main() {
16+
tools := github.DefaultTools(translations.NullTranslationHelper)
17+
md := tools2md.Convert(tools)
18+
if *filepath == "" {
19+
panic("filepath cannot be empty")
20+
}
21+
22+
err := os.WriteFile(*filepath, []byte(md), 0600)
23+
if err != nil {
24+
panic(err)
25+
}
26+
27+
fmt.Println("Schema file generated successfully at", *filepath)
28+
}

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ require (
5757
go.opentelemetry.io/otel/trace v1.35.0 // indirect
5858
go.opentelemetry.io/proto/otlp v1.5.0 // indirect
5959
go.uber.org/multierr v1.11.0 // indirect
60-
golang.org/x/sys v0.31.0 // indirect
60+
golang.org/x/sys v0.32.0 // indirect
6161
golang.org/x/text v0.23.0 // indirect
6262
golang.org/x/time v0.5.0 // indirect
6363
google.golang.org/protobuf v1.36.5 // indirect

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,8 @@ golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5h
145145
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
146146
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
147147
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
148-
golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik=
149-
golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
148+
golang.org/x/sys v0.32.0 h1:s77OFDvIQeibCmezSnk/q6iAfkdiQaJi4VzroCFrN20=
149+
golang.org/x/sys v0.32.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
150150
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
151151
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
152152
golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY=
Lines changed: 235 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,235 @@
1+
## Tools
2+
3+
### Users
4+
5+
- **get_me** - Get details of the authenticated GitHub user. Use this when a request include "me", "my"...
6+
- `reason`: Optional: reason the session was created (string, optional)
7+
8+
### Issues
9+
10+
- **get_issue** - Get details of a specific issue in a GitHub repository
11+
- `issue_number`: The number of the issue (number, required)
12+
- `owner`: The owner of the repository (string, required)
13+
- `repo`: The name of the repository (string, required)
14+
15+
- **search_issues** - Search for issues and pull requests across GitHub repositories
16+
- `order`: Sort order ('asc' or 'desc') (string, optional)
17+
- `page`: Page number for pagination (min 1) (number, optional)
18+
- `perPage`: Results per page for pagination (min 1, max 100) (number, optional)
19+
- `q`: Search query using GitHub issues search syntax (string, required)
20+
- `sort`: Sort field (comments, reactions, created, etc.) (string, optional)
21+
22+
- **list_issues** - List issues in a GitHub repository with filtering options
23+
- `direction`: Sort direction ('asc', 'desc') (string, optional)
24+
- `labels`: Filter by labels (array, optional)
25+
- `owner`: Repository owner (string, required)
26+
- `page`: Page number for pagination (min 1) (number, optional)
27+
- `perPage`: Results per page for pagination (min 1, max 100) (number, optional)
28+
- `repo`: Repository name (string, required)
29+
- `since`: Filter by date (ISO 8601 timestamp) (string, optional)
30+
- `sort`: Sort by ('created', 'updated', 'comments') (string, optional)
31+
- `state`: Filter by state ('open', 'closed', 'all') (string, optional)
32+
33+
- **get_issue_comments** - Get comments for a GitHub issue
34+
- `issue_number`: Issue number (number, required)
35+
- `owner`: Repository owner (string, required)
36+
- `page`: Page number (number, optional)
37+
- `per_page`: Number of records per page (number, optional)
38+
- `repo`: Repository name (string, required)
39+
40+
- **create_issue** - Create a new issue in a GitHub repository
41+
- `assignees`: Usernames to assign to this issue (array, optional)
42+
- `body`: Issue body content (string, optional)
43+
- `labels`: Labels to apply to this issue (array, optional)
44+
- `milestone`: Milestone number (number, optional)
45+
- `owner`: Repository owner (string, required)
46+
- `repo`: Repository name (string, required)
47+
- `title`: Issue title (string, required)
48+
49+
- **add_issue_comment** - Add a comment to an existing issue
50+
- `body`: Comment text (string, required)
51+
- `issue_number`: Issue number to comment on (number, required)
52+
- `owner`: Repository owner (string, required)
53+
- `repo`: Repository name (string, required)
54+
55+
- **update_issue** - Update an existing issue in a GitHub repository
56+
- `assignees`: New assignees (array, optional)
57+
- `body`: New description (string, optional)
58+
- `issue_number`: Issue number to update (number, required)
59+
- `labels`: New labels (array, optional)
60+
- `milestone`: New milestone number (number, optional)
61+
- `owner`: Repository owner (string, required)
62+
- `repo`: Repository name (string, required)
63+
- `state`: New state ('open' or 'closed') (string, optional)
64+
- `title`: New title (string, optional)
65+
66+
### Pull Requests
67+
68+
- **get_pull_request** - Get details of a specific pull request
69+
- `owner`: Repository owner (string, required)
70+
- `pullNumber`: Pull request number (number, required)
71+
- `repo`: Repository name (string, required)
72+
73+
- **list_pull_requests** - List and filter repository pull requests
74+
- `base`: Filter by base branch (string, optional)
75+
- `direction`: Sort direction ('asc', 'desc') (string, optional)
76+
- `head`: Filter by head user/org and branch (string, optional)
77+
- `owner`: Repository owner (string, required)
78+
- `page`: Page number for pagination (min 1) (number, optional)
79+
- `perPage`: Results per page for pagination (min 1, max 100) (number, optional)
80+
- `repo`: Repository name (string, required)
81+
- `sort`: Sort by ('created', 'updated', 'popularity', 'long-running') (string, optional)
82+
- `state`: Filter by state ('open', 'closed', 'all') (string, optional)
83+
84+
- **get_pull_request_files** - Get the list of files changed in a pull request
85+
- `owner`: Repository owner (string, required)
86+
- `pullNumber`: Pull request number (number, required)
87+
- `repo`: Repository name (string, required)
88+
89+
- **get_pull_request_status** - Get the combined status of all status checks for a pull request
90+
- `owner`: Repository owner (string, required)
91+
- `pullNumber`: Pull request number (number, required)
92+
- `repo`: Repository name (string, required)
93+
94+
- **get_pull_request_comments** - Get the review comments on a pull request
95+
- `owner`: Repository owner (string, required)
96+
- `pullNumber`: Pull request number (number, required)
97+
- `repo`: Repository name (string, required)
98+
99+
- **get_pull_request_reviews** - Get the reviews on a pull request
100+
- `owner`: Repository owner (string, required)
101+
- `pullNumber`: Pull request number (number, required)
102+
- `repo`: Repository name (string, required)
103+
104+
- **merge_pull_request** - Merge a pull request
105+
- `commit_message`: Extra detail for merge commit (string, optional)
106+
- `commit_title`: Title for merge commit (string, optional)
107+
- `merge_method`: Merge method ('merge', 'squash', 'rebase') (string, optional)
108+
- `owner`: Repository owner (string, required)
109+
- `pullNumber`: Pull request number (number, required)
110+
- `repo`: Repository name (string, required)
111+
112+
- **update_pull_request_branch** - Update a pull request branch with the latest changes from the base branch
113+
- `expectedHeadSha`: The expected SHA of the pull request's HEAD ref (string, optional)
114+
- `owner`: Repository owner (string, required)
115+
- `pullNumber`: Pull request number (number, required)
116+
- `repo`: Repository name (string, required)
117+
118+
- **create_pull_request_review** - Create a review on a pull request
119+
- `body`: Review comment text (string, optional)
120+
- `comments`: Line-specific comments array of objects to place comments on pull request changes. Requires path and body. For line comments use line or position. For multi-line comments use start_line and line with optional side parameters. (array, optional)
121+
- `commitId`: SHA of commit to review (string, optional)
122+
- `event`: Review action ('APPROVE', 'REQUEST_CHANGES', 'COMMENT') (string, required)
123+
- `owner`: Repository owner (string, required)
124+
- `pullNumber`: Pull request number (number, required)
125+
- `repo`: Repository name (string, required)
126+
127+
- **create_pull_request** - Create a new pull request in a GitHub repository
128+
- `base`: Branch to merge into (string, required)
129+
- `body`: PR description (string, optional)
130+
- `draft`: Create as draft PR (boolean, optional)
131+
- `head`: Branch containing changes (string, required)
132+
- `maintainer_can_modify`: Allow maintainer edits (boolean, optional)
133+
- `owner`: Repository owner (string, required)
134+
- `repo`: Repository name (string, required)
135+
- `title`: PR title (string, required)
136+
137+
- **update_pull_request** - Update an existing pull request in a GitHub repository
138+
- `base`: New base branch name (string, optional)
139+
- `body`: New description (string, optional)
140+
- `maintainer_can_modify`: Allow maintainer edits (boolean, optional)
141+
- `owner`: Repository owner (string, required)
142+
- `pullNumber`: Pull request number to update (number, required)
143+
- `repo`: Repository name (string, required)
144+
- `state`: New state ('open' or 'closed') (string, optional)
145+
- `title`: New title (string, optional)
146+
147+
### Repositories
148+
149+
- **get_file_contents** - Get the contents of a file or directory from a GitHub repository
150+
- `branch`: Branch to get contents from (string, optional)
151+
- `owner`: Repository owner (username or organization) (string, required)
152+
- `path`: Path to file/directory (string, required)
153+
- `repo`: Repository name (string, required)
154+
155+
- **get_commit** - Get details for a commit from a GitHub repository
156+
- `owner`: Repository owner (string, required)
157+
- `page`: Page number for pagination (min 1) (number, optional)
158+
- `perPage`: Results per page for pagination (min 1, max 100) (number, optional)
159+
- `repo`: Repository name (string, required)
160+
- `sha`: Commit SHA, branch name, or tag name (string, required)
161+
162+
- **list_commits** - Get list of commits of a branch in a GitHub repository
163+
- `owner`: Repository owner (string, required)
164+
- `page`: Page number for pagination (min 1) (number, optional)
165+
- `perPage`: Results per page for pagination (min 1, max 100) (number, optional)
166+
- `repo`: Repository name (string, required)
167+
- `sha`: Branch name (string, optional)
168+
169+
- **create_or_update_file** - Create or update a single file in a GitHub repository
170+
- `branch`: Branch to create/update the file in (string, required)
171+
- `content`: Content of the file (string, required)
172+
- `message`: Commit message (string, required)
173+
- `owner`: Repository owner (username or organization) (string, required)
174+
- `path`: Path where to create/update the file (string, required)
175+
- `repo`: Repository name (string, required)
176+
- `sha`: SHA of file being replaced (for updates) (string, optional)
177+
178+
- **create_repository** - Create a new GitHub repository in your account
179+
- `autoInit`: Initialize with README (boolean, optional)
180+
- `description`: Repository description (string, optional)
181+
- `name`: Repository name (string, required)
182+
- `private`: Whether repo should be private (boolean, optional)
183+
184+
- **fork_repository** - Fork a GitHub repository to your account or specified organization
185+
- `organization`: Organization to fork to (string, optional)
186+
- `owner`: Repository owner (string, required)
187+
- `repo`: Repository name (string, required)
188+
189+
- **create_branch** - Create a new branch in a GitHub repository
190+
- `branch`: Name for new branch (string, required)
191+
- `from_branch`: Source branch (defaults to repo default) (string, optional)
192+
- `owner`: Repository owner (string, required)
193+
- `repo`: Repository name (string, required)
194+
195+
- **push_files** - Push multiple files to a GitHub repository in a single commit
196+
- `branch`: Branch to push to (string, required)
197+
- `files`: Array of file objects to push, each object with path (string) and content (string) (array, required)
198+
- `message`: Commit message (string, required)
199+
- `owner`: Repository owner (string, required)
200+
- `repo`: Repository name (string, required)
201+
202+
### Search
203+
204+
- **search_repositories** - Search for GitHub repositories
205+
- `page`: Page number for pagination (min 1) (number, optional)
206+
- `perPage`: Results per page for pagination (min 1, max 100) (number, optional)
207+
- `query`: Search query (string, required)
208+
209+
- **search_code** - Search for code across GitHub repositories
210+
- `order`: Sort order ('asc' or 'desc') (string, optional)
211+
- `page`: Page number for pagination (min 1) (number, optional)
212+
- `perPage`: Results per page for pagination (min 1, max 100) (number, optional)
213+
- `q`: Search query using GitHub code search syntax (string, required)
214+
- `sort`: Sort field ('indexed' only) (string, optional)
215+
216+
- **search_users** - Search for GitHub users
217+
- `order`: Sort order ('asc' or 'desc') (string, optional)
218+
- `page`: Page number for pagination (min 1) (number, optional)
219+
- `perPage`: Results per page for pagination (min 1, max 100) (number, optional)
220+
- `q`: Search query using GitHub users search syntax (string, required)
221+
- `sort`: Sort field (followers, repositories, joined) (string, optional)
222+
223+
### Code Scanning
224+
225+
- **get_code_scanning_alert** - Get details of a specific code scanning alert in a GitHub repository.
226+
- `alertNumber`: The number of the alert. (number, required)
227+
- `owner`: The owner of the repository. (string, required)
228+
- `repo`: The name of the repository. (string, required)
229+
230+
- **list_code_scanning_alerts** - List code scanning alerts in a GitHub repository.
231+
- `owner`: The owner of the repository. (string, required)
232+
- `ref`: The Git reference for the results you want to list. (string, optional)
233+
- `repo`: The name of the repository. (string, required)
234+
- `severity`: Only code scanning alerts with this severity will be returned. Possible values are: critical, high, medium, low, warning, note, error. (string, optional)
235+
- `state`: State of the code scanning alerts to list. Set to closed to list only closed code scanning alerts. Default: open (string, optional)
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
## Tools
2+
3+
### Test Category 1
4+
5+
- **test_tool_1** - A tool for testing
6+
- No parameters required
7+
8+
- **test_tool_3** - Yet another tool for testing
9+
- No parameters required
10+
11+
### Test Category 2
12+
13+
- **test_tool_2** - Another tool for testing
14+
- No parameters required
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
## Tools
2+
3+
### Test Category
4+
5+
- **test_tool** - A tool for testing
6+
- No parameters required
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
## Tools
2+
3+
### Test Category
4+
5+
- **test_tool** - A tool for testing
6+
- `prop_1`: A test property (string, required)
7+
- `prop_2`: Another test property (number, optional)

0 commit comments

Comments
 (0)