Skip to content

Commit c0a1f3d

Browse files
authored
Merge branch 'main' into fix-get-me-empty-arguments
2 parents f0fdaa8 + c36e4e4 commit c0a1f3d

35 files changed

Lines changed: 3849 additions & 147 deletions

README.md

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1069,7 +1069,8 @@ The following sets of tools are available:
10691069
- **Required OAuth Scopes**: `read:project`
10701070
- **Accepted OAuth Scopes**: `project`, `read:project`
10711071
- `field_id`: The field's ID. Required for 'get_project_field' method. (number, optional)
1072-
- `fields`: Specific list of field IDs to include in the response when getting a project item (e.g. ["102589", "985201", "169875"]). If not provided, only the title field is included. Only used for 'get_project_item' method. (string[], optional)
1072+
- `field_names`: Specific list of field names to include in the response when getting a project item (e.g. ["Status", "Priority"]). Resolved server-side to field IDs — pass this instead of 'fields' when you only know the human-readable names. Mutually exclusive with 'fields' — provide one, not both. Only used for 'get_project_item' method. (string[], optional)
1073+
- `fields`: Specific list of field IDs to include in the response when getting a project item (e.g. ["102589", "985201", "169875"]). If neither 'fields' nor 'field_names' is provided, only the title field is included. Mutually exclusive with 'field_names' — provide one, not both. Only used for 'get_project_item' method. (string[], optional)
10731074
- `item_id`: The item's ID. Required for 'get_project_item' method. (number, optional)
10741075
- `method`: The method to execute (string, required)
10751076
- `owner`: The owner (user or organization login). The name is not case sensitive. (string, optional)
@@ -1082,7 +1083,8 @@ The following sets of tools are available:
10821083
- **Accepted OAuth Scopes**: `project`, `read:project`
10831084
- `after`: Forward pagination cursor from previous pageInfo.nextCursor. (string, optional)
10841085
- `before`: Backward pagination cursor from previous pageInfo.prevCursor (rare). (string, optional)
1085-
- `fields`: Field IDs to include when listing project items (e.g. ["102589", "985201"]). CRITICAL: Always provide to get field values. Without this, only titles returned. Only used for 'list_project_items' method. (string[], optional)
1086+
- `field_names`: Field names to include when listing project items (e.g. ["Status", "Priority"]). Resolved server-side to field IDs — pass this instead of 'fields' when you only know the human-readable names. Names that fail to resolve return a structured error. Mutually exclusive with 'fields' — provide one, not both. Only used for 'list_project_items' method. (string[], optional)
1087+
- `fields`: Field IDs to include when listing project items (e.g. ["102589", "985201"]). CRITICAL: Always provide to get field values. Without this (and without 'field_names'), only titles returned. Mutually exclusive with 'field_names' — provide one, not both. Only used for 'list_project_items' method. (string[], optional)
10861088
- `method`: The action to perform (string, required)
10871089
- `owner`: The owner (user or organization login). The name is not case sensitive. (string, required)
10881090
- `owner_type`: Owner type (user or org). If not provided, will automatically try both. (string, optional)
@@ -1094,10 +1096,10 @@ The following sets of tools are available:
10941096
- **Required OAuth Scopes**: `project`
10951097
- `body`: The body of the status update (markdown). Used for 'create_project_status_update' method. (string, optional)
10961098
- `field_name`: The name of the iteration field (e.g. 'Sprint'). Required for 'create_iteration_field' method. (string, optional)
1097-
- `issue_number`: The issue number (use when item_type is 'issue' for 'add_project_item' method). Provide either issue_number or pull_request_number. (number, optional)
1098-
- `item_id`: The project item ID. Required for 'update_project_item' and 'delete_project_item' methods. (number, optional)
1099-
- `item_owner`: The owner (user or organization) of the repository containing the issue or pull request. Required for 'add_project_item' method. (string, optional)
1100-
- `item_repo`: The name of the repository containing the issue or pull request. Required for 'add_project_item' method. (string, optional)
1099+
- `issue_number`: The issue number. Required for 'add_project_item' when item_type is 'issue'. Also accepted by 'update_project_item' to resolve the item by issue number (combine with item_owner and item_repo). (number, optional)
1100+
- `item_id`: The project item ID. Required for 'delete_project_item'. For 'update_project_item', provide either item_id, or (item_owner + item_repo + issue_number) to resolve the item by issue. (number, optional)
1101+
- `item_owner`: The owner (user or organization) of the repository containing the issue or pull request. Required for 'add_project_item' method. Also accepted by 'update_project_item' when resolving the item by issue number. (string, optional)
1102+
- `item_repo`: The name of the repository containing the issue or pull request. Required for 'add_project_item' method. Also accepted by 'update_project_item' when resolving the item by issue number. (string, optional)
11011103
- `item_type`: The item's type, either issue or pull_request. Required for 'add_project_item' method. (string, optional)
11021104
- `iteration_duration`: Duration in days for iterations of the field (e.g. 7 for weekly, 14 for bi-weekly). Required for 'create_iteration_field' method. (number, optional)
11031105
- `iterations`: Custom iterations for 'create_iteration_field' method. Only set this when you need iterations with varying durations, breaks between them, or specific titles. Otherwise omit it: GitHub auto-creates three iterations of 'iteration_duration' days starting on 'start_date', which is the right choice for most cases. (object[], optional)
@@ -1110,7 +1112,7 @@ The following sets of tools are available:
11101112
- `status`: The status of the project. Used for 'create_project_status_update' method. (string, optional)
11111113
- `target_date`: The target date of the status update in YYYY-MM-DD format. Used for 'create_project_status_update' method. (string, optional)
11121114
- `title`: The project title. Required for 'create_project' method. (string, optional)
1113-
- `updated_field`: Object consisting of the ID of the project field to update and the new value for the field. To clear the field, set value to null. Example: {"id": 123456, "value": "New Value"}. Required for 'update_project_item' method. (object, optional)
1115+
- `updated_field`: Object describing the field to update and its new value. Required for 'update_project_item'. Two shapes are accepted: (1) by ID — {"id": 123456, "value": "..."}; (2) by name — {"name": "Status", "value": "In Progress"}. For single-select fields, option-name resolution requires the by-name shape; on the by-ID shape, pass the option ID. Set value to null to clear the field. (object, optional)
11141116

11151117
</details>
11161118

@@ -1656,6 +1658,18 @@ export GITHUB_MCP_SERVER_TITLE="GHES MCP Server"
16561658

16571659
The exported Go API of this module should currently be considered unstable, and subject to breaking changes. In the future, we may offer stability; please file an issue if there is a use case where this would be valuable.
16581660

1661+
## Contributing
1662+
1663+
Contributions are welcome. Before opening a pull request, please read the [contributing guide](CONTRIBUTING.md) for setup, testing, linting, and documentation generation instructions.
1664+
1665+
## Support
1666+
1667+
For help using the GitHub MCP Server, see the [support guide](SUPPORT.md). If you have found a bug or want to request a feature, please search existing issues before opening a new one.
1668+
1669+
## Security
1670+
1671+
Please do not report security vulnerabilities through public issues. Follow the instructions in the [security policy](SECURITY.md) to report vulnerabilities responsibly.
1672+
16591673
## License
16601674

16611675
This project is licensed under the terms of the MIT open source license. Please refer to [MIT](./LICENSE) for the full terms.

docs/feature-flags.md

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,4 +338,94 @@ runtime behavior (such as output formatting) won't appear here.
338338
- 'blocked_by' - the subject issue is blocked by the related issue.
339339
- 'blocking' - the subject issue blocks the related issue. (string, required)
340340

341+
### `fields_param`
342+
343+
- **get_file_contents** - Get file or directory contents
344+
- **Required OAuth Scopes**: `repo`
345+
- `fields`: Subset of fields to return for each entry when the path is a directory. If omitted, all fields are returned. Ignored when the path is a single file. Use this to reduce response size when listing directories and you only need specific fields, e.g. just 'name' and 'type'. (string[], optional)
346+
- `owner`: Repository owner (username or organization) (string, required)
347+
- `path`: Path to file/directory (string, optional)
348+
- `ref`: Accepts optional git refs such as `refs/tags/{tag}`, `refs/heads/{branch}` or `refs/pull/{pr_number}/head` (string, optional)
349+
- `repo`: Repository name (string, required)
350+
- `sha`: Accepts optional commit SHA. If specified, it will be used instead of ref (string, optional)
351+
352+
- **list_commits** - List commits
353+
- **Required OAuth Scopes**: `repo`
354+
- `author`: Author username or email address to filter commits by (string, optional)
355+
- `fields`: Subset of fields to return for each commit. If omitted, all fields are returned. Use this to reduce response size when you only need specific fields, e.g. just 'sha' and 'html_url'. (string[], optional)
356+
- `owner`: Repository owner (string, required)
357+
- `page`: Page number for pagination (min 1) (number, optional)
358+
- `path`: Only commits containing this file path will be returned (string, optional)
359+
- `perPage`: Results per page for pagination (min 1, max 100) (number, optional)
360+
- `repo`: Repository name (string, required)
361+
- `sha`: Commit SHA, branch or tag name to list commits of. If not provided, uses the default branch of the repository. If a commit SHA is provided, will list commits up to that SHA. (string, optional)
362+
- `since`: Only commits after this date will be returned (ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ or YYYY-MM-DD) (string, optional)
363+
- `until`: Only commits before this date will be returned (ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ or YYYY-MM-DD) (string, optional)
364+
365+
- **list_issues** - List issues
366+
- **Required OAuth Scopes**: `repo`
367+
- `after`: Cursor for pagination. Use the cursor from the previous response. (string, optional)
368+
- `direction`: Order direction. If provided, the 'orderBy' also needs to be provided. (string, optional)
369+
- `field_filters`: Filter by custom issue field values. Each entry takes a field_name and a value; the server looks up the field and coerces the value to its type (single-select option name, text, number, or YYYY-MM-DD date). (object[], optional)
370+
- `fields`: Subset of fields to return for each issue. If omitted, all fields are returned. Use this to reduce response size when you only need specific fields; omitting 'body' and 'field_values' in particular drops the largest per-result data. (string[], optional)
371+
- `labels`: Filter by labels (string[], optional)
372+
- `orderBy`: Order issues by field. If provided, the 'direction' also needs to be provided. (string, optional)
373+
- `owner`: Repository owner (string, required)
374+
- `perPage`: Results per page for pagination (min 1, max 100) (number, optional)
375+
- `repo`: Repository name (string, required)
376+
- `since`: Filter by date (ISO 8601 timestamp) (string, optional)
377+
- `state`: Filter by state, by default both open and closed issues are returned when not provided (string, optional)
378+
379+
- **list_pull_requests** - List pull requests
380+
- **Required OAuth Scopes**: `repo`
381+
- `base`: Filter by base branch (string, optional)
382+
- `direction`: Sort direction (string, optional)
383+
- `fields`: Subset of fields to return for each pull request. If omitted, all fields are returned. Use this to reduce response size when you only need specific fields; omitting 'body' in particular drops the largest per-result data. (string[], optional)
384+
- `head`: Filter by head user/org and branch (string, optional)
385+
- `owner`: Repository owner (string, required)
386+
- `page`: Page number for pagination (min 1) (number, optional)
387+
- `perPage`: Results per page for pagination (min 1, max 100) (number, optional)
388+
- `repo`: Repository name (string, required)
389+
- `sort`: Sort by (string, optional)
390+
- `state`: Filter by state (string, optional)
391+
392+
- **list_releases** - List releases
393+
- **Required OAuth Scopes**: `repo`
394+
- `fields`: Subset of fields to return for each release. If omitted, all fields are returned. Use this to reduce response size when you only need specific fields; omitting 'body' in particular drops the largest per-release data. (string[], optional)
395+
- `owner`: Repository owner (string, required)
396+
- `page`: Page number for pagination (min 1) (number, optional)
397+
- `perPage`: Results per page for pagination (min 1, max 100) (number, optional)
398+
- `repo`: Repository name (string, required)
399+
400+
- **search_code** - Search code
401+
- **Required OAuth Scopes**: `repo`
402+
- `fields`: Subset of fields to return for each code search result. If omitted, all fields are returned. Use this to reduce response size when you only need specific fields; omitting 'repository' and 'text_matches' in particular drops the largest per-result data. (string[], optional)
403+
- `order`: Sort order for results (string, optional)
404+
- `page`: Page number for pagination (min 1) (number, optional)
405+
- `perPage`: Results per page for pagination (min 1, max 100) (number, optional)
406+
- `query`: Search query (GitHub code search REST). Implicit AND between terms; supports `OR`, `NOT`, and `"quoted phrase"` for exact match. Qualifiers: `repo:owner/repo`, `org:`, `user:`, `language:`, `path:dir` (prefix match), `filename:exact.ext`, `extension:`, `in:file`, `in:path`, `size:`, `is:archived`, `is:fork`. Max 256 chars. Examples: `WithContext language:go org:github`; `"package main" repo:o/r`; `func extension:go path:cmd repo:o/r`; `NOT TODO language:go repo:o/r`. (string, required)
407+
- `sort`: Sort field ('indexed' only) (string, optional)
408+
409+
- **search_issues** - Search issues
410+
- **Required OAuth Scopes**: `repo`
411+
- `fields`: Subset of fields to return for each issue result. If omitted, all fields are returned. Use this to reduce response size when you only need specific fields; omitting 'body', 'reactions', and 'labels' in particular drops the largest per-result data. (string[], optional)
412+
- `order`: Sort order (string, optional)
413+
- `owner`: Optional repository owner. If provided with repo, only issues for this repository are listed. (string, optional)
414+
- `page`: Page number for pagination (min 1) (number, optional)
415+
- `perPage`: Results per page for pagination (min 1, max 100) (number, optional)
416+
- `query`: Search query using GitHub issues search syntax (string, required)
417+
- `repo`: Optional repository name. If provided with owner, only issues for this repository are listed. (string, optional)
418+
- `sort`: Sort field by number of matches of categories, defaults to best match (string, optional)
419+
420+
- **search_pull_requests** - Search pull requests
421+
- **Required OAuth Scopes**: `repo`
422+
- `fields`: Subset of fields to return for each pull request result. If omitted, all fields are returned. Use this to reduce response size when you only need specific fields; omitting 'body', 'reactions', and 'labels' in particular drops the largest per-result data. (string[], optional)
423+
- `order`: Sort order (string, optional)
424+
- `owner`: Optional repository owner. If provided with repo, only pull requests for this repository are listed. (string, optional)
425+
- `page`: Page number for pagination (min 1) (number, optional)
426+
- `perPage`: Results per page for pagination (min 1, max 100) (number, optional)
427+
- `query`: Search query using GitHub pull request search syntax (string, required)
428+
- `repo`: Optional repository name. If provided with owner, only pull requests for this repository are listed. (string, optional)
429+
- `sort`: Sort field by number of matches of categories, defaults to best match (string, optional)
430+
341431
<!-- END AUTOMATED FEATURE FLAG TOOLS -->

pkg/errors/error.go

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package errors
22

33
import (
44
"context"
5+
"encoding/json"
56
stderrors "errors"
67
"fmt"
78
"net/http"
@@ -218,3 +219,48 @@ func NewGitHubAPIStatusErrorResponse(ctx context.Context, message string, resp *
218219
err := fmt.Errorf("unexpected status %d: %s", resp.StatusCode, string(body))
219220
return NewGitHubAPIErrorResponse(ctx, message, resp, err)
220221
}
222+
223+
// StructuredResolutionError is a machine-readable error returned by name-resolution
224+
// helpers (e.g. resolving a project field or single-select option by name). Agents
225+
// can parse the JSON body to self-correct without re-prompting.
226+
//
227+
// Kind values:
228+
// - "field_not_found" — no project field matches the supplied name
229+
// - "field_ambiguous" — more than one project field shares the supplied name
230+
// - "option_not_found" — no option on the resolved single-select field matches
231+
// - "option_ambiguous" — duplicate option names on the resolved field
232+
// - "item_not_in_project" — the issue/PR exists but is not an item on the project
233+
// - "wrong_field_type" — the named field is not the data type the caller expected
234+
type StructuredResolutionError struct {
235+
Kind string `json:"error"`
236+
Name string `json:"name,omitempty"`
237+
Field string `json:"field,omitempty"`
238+
Candidates []any `json:"candidates,omitempty"`
239+
Hint string `json:"hint,omitempty"`
240+
}
241+
242+
// Error implements the error interface; the message is the JSON body so that the
243+
// downstream tool result also carries the structured payload as plain text.
244+
func (e *StructuredResolutionError) Error() string {
245+
b, err := json.Marshal(e)
246+
if err != nil {
247+
return fmt.Sprintf(`{"error":%q,"name":%q}`, e.Kind, e.Name)
248+
}
249+
return string(b)
250+
}
251+
252+
// NewStructuredResolutionError constructs a StructuredResolutionError.
253+
func NewStructuredResolutionError(kind, name, hint string, candidates []any) *StructuredResolutionError {
254+
return &StructuredResolutionError{
255+
Kind: kind,
256+
Name: name,
257+
Hint: hint,
258+
Candidates: candidates,
259+
}
260+
}
261+
262+
// NewStructuredResolutionErrorResponse returns an mcp.CallToolResult whose text body
263+
// is the JSON-serialised StructuredResolutionError, suitable for agent self-correction.
264+
func NewStructuredResolutionErrorResponse(err *StructuredResolutionError) *mcp.CallToolResult {
265+
return utils.NewToolResultError(err.Error())
266+
}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
{
2+
"annotations": {
3+
"idempotentHint": false,
4+
"readOnlyHint": true,
5+
"title": "Get file or directory contents"
6+
},
7+
"description": "Get the contents of a file or directory from a GitHub repository",
8+
"inputSchema": {
9+
"properties": {
10+
"fields": {
11+
"description": "Subset of fields to return for each entry when the path is a directory. If omitted, all fields are returned. Ignored when the path is a single file. Use this to reduce response size when listing directories and you only need specific fields, e.g. just 'name' and 'type'.",
12+
"items": {
13+
"enum": [
14+
"type",
15+
"name",
16+
"path",
17+
"size",
18+
"sha",
19+
"url",
20+
"git_url",
21+
"html_url",
22+
"download_url"
23+
],
24+
"type": "string"
25+
},
26+
"type": "array"
27+
},
28+
"owner": {
29+
"description": "Repository owner (username or organization)",
30+
"type": "string"
31+
},
32+
"path": {
33+
"default": "/",
34+
"description": "Path to file/directory",
35+
"type": "string"
36+
},
37+
"ref": {
38+
"description": "Accepts optional git refs such as `refs/tags/{tag}`, `refs/heads/{branch}` or `refs/pull/{pr_number}/head`",
39+
"type": "string"
40+
},
41+
"repo": {
42+
"description": "Repository name",
43+
"type": "string"
44+
},
45+
"sha": {
46+
"description": "Accepts optional commit SHA. If specified, it will be used instead of ref",
47+
"type": "string"
48+
}
49+
},
50+
"required": [
51+
"owner",
52+
"repo"
53+
],
54+
"type": "object"
55+
},
56+
"name": "get_file_contents"
57+
}

0 commit comments

Comments
 (0)