Skip to content

Commit 78c6b37

Browse files
SamMorrowDrumspatrick-knightCopilot
committed
feat(governance): add custom properties tools with multi-level scope challenge
Add custom properties support to the non-default governance toolset, completing the second half of the rulesets + custom properties work requested in #820. Rather than porting the original six single-level tools verbatim, this consolidates them into two level-parameterized tools: - custom_properties_read (level: repository | organization | enterprise) - custom_properties_write (level: repository | organization | enterprise) The `level` argument dispatches to the correct GitHub API. Repository level reads and writes property VALUES (property_name + value), while organization and enterprise levels read and write property DEFINITIONS/schema (value_type, required, allowed_values, default_value, description, values_editable_by). This distinction is documented in the tool and field descriptions. Both tools reuse the shared governanceReadScopeAccess/governanceWriteScopeAccess helpers (renamed from the ruleset-specific names) so rulesets and custom properties present one consistent, exhaustive scope-challenge policy that up-scopes based on the requested level. Co-authored-by: Patrick Knight <patrick-knight@github.com> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 1e886867-a922-419a-b02c-ac643716aea8
1 parent 1b9a80e commit 78c6b37

8 files changed

Lines changed: 810 additions & 18 deletions

File tree

‎README.md‎

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,7 @@ The following sets of tools are available:
586586
| <picture><source media="(prefers-color-scheme: dark)" srcset="pkg/octicons/icons/comment-discussion-dark.png"><source media="(prefers-color-scheme: light)" srcset="pkg/octicons/icons/comment-discussion-light.png"><img src="pkg/octicons/icons/comment-discussion-light.png" width="20" height="20" alt="comment-discussion"></picture> | `discussions` | GitHub Discussions related tools |
587587
| <picture><source media="(prefers-color-scheme: dark)" srcset="pkg/octicons/icons/logo-gist-dark.png"><source media="(prefers-color-scheme: light)" srcset="pkg/octicons/icons/logo-gist-light.png"><img src="pkg/octicons/icons/logo-gist-light.png" width="20" height="20" alt="logo-gist"></picture> | `gists` | GitHub Gist related tools |
588588
| <picture><source media="(prefers-color-scheme: dark)" srcset="pkg/octicons/icons/git-branch-dark.png"><source media="(prefers-color-scheme: light)" srcset="pkg/octicons/icons/git-branch-light.png"><img src="pkg/octicons/icons/git-branch-light.png" width="20" height="20" alt="git-branch"></picture> | `git` | GitHub Git API related tools for low-level Git operations |
589-
| <picture><source media="(prefers-color-scheme: dark)" srcset="pkg/octicons/icons/law-dark.png"><source media="(prefers-color-scheme: light)" srcset="pkg/octicons/icons/law-light.png"><img src="pkg/octicons/icons/law-light.png" width="20" height="20" alt="law"></picture> | `governance` | Repository governance tools for managing rulesets at the repository, organization, and enterprise levels |
589+
| <picture><source media="(prefers-color-scheme: dark)" srcset="pkg/octicons/icons/law-dark.png"><source media="(prefers-color-scheme: light)" srcset="pkg/octicons/icons/law-light.png"><img src="pkg/octicons/icons/law-light.png" width="20" height="20" alt="law"></picture> | `governance` | Repository governance tools for managing rulesets and custom properties at the repository, organization, and enterprise levels |
590590
| <picture><source media="(prefers-color-scheme: dark)" srcset="pkg/octicons/icons/issue-opened-dark.png"><source media="(prefers-color-scheme: light)" srcset="pkg/octicons/icons/issue-opened-light.png"><img src="pkg/octicons/icons/issue-opened-light.png" width="20" height="20" alt="issue-opened"></picture> | `issues` | GitHub Issues related tools |
591591
| <picture><source media="(prefers-color-scheme: dark)" srcset="pkg/octicons/icons/tag-dark.png"><source media="(prefers-color-scheme: light)" srcset="pkg/octicons/icons/tag-light.png"><img src="pkg/octicons/icons/tag-light.png" width="20" height="20" alt="tag"></picture> | `labels` | GitHub Labels related tools |
592592
| <picture><source media="(prefers-color-scheme: dark)" srcset="pkg/octicons/icons/bell-dark.png"><source media="(prefers-color-scheme: light)" srcset="pkg/octicons/icons/bell-light.png"><img src="pkg/octicons/icons/bell-light.png" width="20" height="20" alt="bell"></picture> | `notifications` | GitHub Notifications related tools |
@@ -892,6 +892,29 @@ The following sets of tools are available:
892892
- `rules`: An array of rules within the ruleset. Each rule is an object with a 'type' (e.g. 'creation', 'deletion', 'non_fast_forward', 'required_signatures', 'pull_request', 'required_status_checks') and, for rules that need configuration, a 'parameters' object (object[], required)
893893
- `target`: The target of the ruleset. Defaults to 'branch'. 'repository' is only valid for 'organization' and 'enterprise' level rulesets. (string, optional)
894894

895+
- **custom_properties_read** - Read custom properties
896+
- **OAuth Challenge Scopes**: `repo`, `read:org`, `read:enterprise`
897+
- `enterprise`: Enterprise slug. Required when level is 'enterprise'. (string, optional)
898+
- `level`: The level at which custom properties are managed:
899+
- 'repository': The custom property VALUES assigned to a repository (requires 'owner' and 'repo').
900+
- 'organization': The custom property DEFINITIONS (schema) for an organization (requires 'org').
901+
- 'enterprise': The custom property DEFINITIONS (schema) for an enterprise (requires 'enterprise'). (string, required)
902+
- `org`: Organization name. Required when level is 'organization'. (string, optional)
903+
- `owner`: Repository owner. Required when level is 'repository'. (string, optional)
904+
- `repo`: Repository name. Required when level is 'repository'. (string, optional)
905+
906+
- **custom_properties_write** - Set custom properties
907+
- **OAuth Challenge Scopes**: `repo`, `admin:org`, `admin:enterprise`
908+
- `enterprise`: Enterprise slug. Required when level is 'enterprise'. (string, optional)
909+
- `level`: The level at which custom properties are managed:
910+
- 'repository': The custom property VALUES assigned to a repository (requires 'owner' and 'repo').
911+
- 'organization': The custom property DEFINITIONS (schema) for an organization (requires 'org').
912+
- 'enterprise': The custom property DEFINITIONS (schema) for an enterprise (requires 'enterprise'). (string, required)
913+
- `org`: Organization name. Required when level is 'organization'. (string, optional)
914+
- `owner`: Repository owner. Required when level is 'repository'. (string, optional)
915+
- `properties`: The custom properties to create or update. At the repository level each item assigns a value ('property_name' and 'value'); at the organization and enterprise levels each item defines the schema ('property_name' and 'value_type', plus optional definition fields). (object[], required)
916+
- `repo`: Repository name. Required when level is 'repository'. (string, optional)
917+
895918
- **repository_ruleset_read** - Read repository rulesets
896919
- **OAuth Challenge Scopes**: `repo`, `read:org`, `read:enterprise`
897920
- `actor_name`: The handle for the GitHub user account to filter rule suites on. Used by the 'list_rule_suites' method. (string, optional)

‎docs/remote-server.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Below is a table of available toolsets for the remote GitHub MCP Server. Each to
3030
| <picture><source media="(prefers-color-scheme: dark)" srcset="../pkg/octicons/icons/comment-discussion-dark.png"><source media="(prefers-color-scheme: light)" srcset="../pkg/octicons/icons/comment-discussion-light.png"><img src="../pkg/octicons/icons/comment-discussion-light.png" width="20" height="20" alt="comment-discussion"></picture><br>`discussions` | GitHub Discussions related tools | https://api.githubcopilot.com/mcp/x/discussions | [Install](https://insiders.vscode.dev/redirect/mcp/install?name=gh-discussions&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Fx%2Fdiscussions%22%7D) | [read-only](https://api.githubcopilot.com/mcp/x/discussions/readonly) | [Install read-only](https://insiders.vscode.dev/redirect/mcp/install?name=gh-discussions&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Fx%2Fdiscussions%2Freadonly%22%7D) |
3131
| <picture><source media="(prefers-color-scheme: dark)" srcset="../pkg/octicons/icons/logo-gist-dark.png"><source media="(prefers-color-scheme: light)" srcset="../pkg/octicons/icons/logo-gist-light.png"><img src="../pkg/octicons/icons/logo-gist-light.png" width="20" height="20" alt="logo-gist"></picture><br>`gists` | GitHub Gist related tools | https://api.githubcopilot.com/mcp/x/gists | [Install](https://insiders.vscode.dev/redirect/mcp/install?name=gh-gists&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Fx%2Fgists%22%7D) | [read-only](https://api.githubcopilot.com/mcp/x/gists/readonly) | [Install read-only](https://insiders.vscode.dev/redirect/mcp/install?name=gh-gists&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Fx%2Fgists%2Freadonly%22%7D) |
3232
| <picture><source media="(prefers-color-scheme: dark)" srcset="../pkg/octicons/icons/git-branch-dark.png"><source media="(prefers-color-scheme: light)" srcset="../pkg/octicons/icons/git-branch-light.png"><img src="../pkg/octicons/icons/git-branch-light.png" width="20" height="20" alt="git-branch"></picture><br>`git` | GitHub Git API related tools for low-level Git operations | https://api.githubcopilot.com/mcp/x/git | [Install](https://insiders.vscode.dev/redirect/mcp/install?name=gh-git&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Fx%2Fgit%22%7D) | [read-only](https://api.githubcopilot.com/mcp/x/git/readonly) | [Install read-only](https://insiders.vscode.dev/redirect/mcp/install?name=gh-git&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Fx%2Fgit%2Freadonly%22%7D) |
33-
| <picture><source media="(prefers-color-scheme: dark)" srcset="../pkg/octicons/icons/law-dark.png"><source media="(prefers-color-scheme: light)" srcset="../pkg/octicons/icons/law-light.png"><img src="../pkg/octicons/icons/law-light.png" width="20" height="20" alt="law"></picture><br>`governance` | Repository governance tools for managing rulesets at the repository, organization, and enterprise levels | https://api.githubcopilot.com/mcp/x/governance | [Install](https://insiders.vscode.dev/redirect/mcp/install?name=gh-governance&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Fx%2Fgovernance%22%7D) | [read-only](https://api.githubcopilot.com/mcp/x/governance/readonly) | [Install read-only](https://insiders.vscode.dev/redirect/mcp/install?name=gh-governance&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Fx%2Fgovernance%2Freadonly%22%7D) |
33+
| <picture><source media="(prefers-color-scheme: dark)" srcset="../pkg/octicons/icons/law-dark.png"><source media="(prefers-color-scheme: light)" srcset="../pkg/octicons/icons/law-light.png"><img src="../pkg/octicons/icons/law-light.png" width="20" height="20" alt="law"></picture><br>`governance` | Repository governance tools for managing rulesets and custom properties at the repository, organization, and enterprise levels | https://api.githubcopilot.com/mcp/x/governance | [Install](https://insiders.vscode.dev/redirect/mcp/install?name=gh-governance&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Fx%2Fgovernance%22%7D) | [read-only](https://api.githubcopilot.com/mcp/x/governance/readonly) | [Install read-only](https://insiders.vscode.dev/redirect/mcp/install?name=gh-governance&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Fx%2Fgovernance%2Freadonly%22%7D) |
3434
| <picture><source media="(prefers-color-scheme: dark)" srcset="../pkg/octicons/icons/issue-opened-dark.png"><source media="(prefers-color-scheme: light)" srcset="../pkg/octicons/icons/issue-opened-light.png"><img src="../pkg/octicons/icons/issue-opened-light.png" width="20" height="20" alt="issue-opened"></picture><br>`issues` | GitHub Issues related tools | https://api.githubcopilot.com/mcp/x/issues | [Install](https://insiders.vscode.dev/redirect/mcp/install?name=gh-issues&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Fx%2Fissues%22%7D) | [read-only](https://api.githubcopilot.com/mcp/x/issues/readonly) | [Install read-only](https://insiders.vscode.dev/redirect/mcp/install?name=gh-issues&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Fx%2Fissues%2Freadonly%22%7D) |
3535
| <picture><source media="(prefers-color-scheme: dark)" srcset="../pkg/octicons/icons/tag-dark.png"><source media="(prefers-color-scheme: light)" srcset="../pkg/octicons/icons/tag-light.png"><img src="../pkg/octicons/icons/tag-light.png" width="20" height="20" alt="tag"></picture><br>`labels` | GitHub Labels related tools | https://api.githubcopilot.com/mcp/x/labels | [Install](https://insiders.vscode.dev/redirect/mcp/install?name=gh-labels&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Fx%2Flabels%22%7D) | [read-only](https://api.githubcopilot.com/mcp/x/labels/readonly) | [Install read-only](https://insiders.vscode.dev/redirect/mcp/install?name=gh-labels&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Fx%2Flabels%2Freadonly%22%7D) |
3636
| <picture><source media="(prefers-color-scheme: dark)" srcset="../pkg/octicons/icons/bell-dark.png"><source media="(prefers-color-scheme: light)" srcset="../pkg/octicons/icons/bell-light.png"><img src="../pkg/octicons/icons/bell-light.png" width="20" height="20" alt="bell"></picture><br>`notifications` | GitHub Notifications related tools | https://api.githubcopilot.com/mcp/x/notifications | [Install](https://insiders.vscode.dev/redirect/mcp/install?name=gh-notifications&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Fx%2Fnotifications%22%7D) | [read-only](https://api.githubcopilot.com/mcp/x/notifications/readonly) | [Install read-only](https://insiders.vscode.dev/redirect/mcp/install?name=gh-notifications&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Fx%2Fnotifications%2Freadonly%22%7D) |
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{
2+
"annotations": {
3+
"idempotentHint": false,
4+
"readOnlyHint": true,
5+
"title": "Read custom properties"
6+
},
7+
"description": "Read custom properties at the repository, organization, or enterprise level. At the repository level this returns the property values assigned to a repository; at the organization and enterprise levels it returns the property definitions (schema). Select the level with the 'level' parameter.",
8+
"inputSchema": {
9+
"properties": {
10+
"enterprise": {
11+
"description": "Enterprise slug. Required when level is 'enterprise'.",
12+
"type": "string"
13+
},
14+
"level": {
15+
"description": "The level at which custom properties are managed:\n- 'repository': The custom property VALUES assigned to a repository (requires 'owner' and 'repo').\n- 'organization': The custom property DEFINITIONS (schema) for an organization (requires 'org').\n- 'enterprise': The custom property DEFINITIONS (schema) for an enterprise (requires 'enterprise').",
16+
"enum": [
17+
"repository",
18+
"organization",
19+
"enterprise"
20+
],
21+
"type": "string"
22+
},
23+
"org": {
24+
"description": "Organization name. Required when level is 'organization'.",
25+
"type": "string"
26+
},
27+
"owner": {
28+
"description": "Repository owner. Required when level is 'repository'.",
29+
"type": "string"
30+
},
31+
"repo": {
32+
"description": "Repository name. Required when level is 'repository'.",
33+
"type": "string"
34+
}
35+
},
36+
"required": [
37+
"level"
38+
],
39+
"type": "object"
40+
},
41+
"name": "custom_properties_read"
42+
}
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
{
2+
"annotations": {
3+
"idempotentHint": false,
4+
"readOnlyHint": false,
5+
"title": "Set custom properties"
6+
},
7+
"description": "Create or update custom properties at the repository, organization, or enterprise level. At the repository level this sets the property values on a repository (the properties must already be defined for the organization); at the organization and enterprise levels it creates or updates the property definitions (schema). Select the level with the 'level' parameter.",
8+
"inputSchema": {
9+
"properties": {
10+
"enterprise": {
11+
"description": "Enterprise slug. Required when level is 'enterprise'.",
12+
"type": "string"
13+
},
14+
"level": {
15+
"description": "The level at which custom properties are managed:\n- 'repository': The custom property VALUES assigned to a repository (requires 'owner' and 'repo').\n- 'organization': The custom property DEFINITIONS (schema) for an organization (requires 'org').\n- 'enterprise': The custom property DEFINITIONS (schema) for an enterprise (requires 'enterprise').",
16+
"enum": [
17+
"repository",
18+
"organization",
19+
"enterprise"
20+
],
21+
"type": "string"
22+
},
23+
"org": {
24+
"description": "Organization name. Required when level is 'organization'.",
25+
"type": "string"
26+
},
27+
"owner": {
28+
"description": "Repository owner. Required when level is 'repository'.",
29+
"type": "string"
30+
},
31+
"properties": {
32+
"description": "The custom properties to create or update. At the repository level each item assigns a value ('property_name' and 'value'); at the organization and enterprise levels each item defines the schema ('property_name' and 'value_type', plus optional definition fields).",
33+
"items": {
34+
"properties": {
35+
"allowed_values": {
36+
"description": "Organization and enterprise levels only: the ordered list of allowed values for single_select and multi_select properties.",
37+
"items": {
38+
"type": "string"
39+
},
40+
"type": "array"
41+
},
42+
"default_value": {
43+
"description": "Organization and enterprise levels only: the value applied when a repository does not set the property. A string or an array of strings."
44+
},
45+
"description": {
46+
"description": "Organization and enterprise levels only: a short description of the property.",
47+
"type": "string"
48+
},
49+
"property_name": {
50+
"description": "The name of the custom property.",
51+
"type": "string"
52+
},
53+
"required": {
54+
"description": "Organization and enterprise levels only: whether the property must be set on every repository.",
55+
"type": "boolean"
56+
},
57+
"value": {
58+
"description": "Repository level only: the value to assign. A string, an array of strings, or null to clear the value."
59+
},
60+
"value_type": {
61+
"description": "Organization and enterprise levels only: the data type of the property. Required when defining a property.",
62+
"enum": [
63+
"string",
64+
"single_select",
65+
"multi_select",
66+
"true_false",
67+
"url"
68+
],
69+
"type": "string"
70+
},
71+
"values_editable_by": {
72+
"description": "Organization and enterprise levels only: who can edit the values of the property.",
73+
"enum": [
74+
"org_actors",
75+
"org_and_repo_actors"
76+
],
77+
"type": "string"
78+
}
79+
},
80+
"required": [
81+
"property_name"
82+
],
83+
"type": "object"
84+
},
85+
"type": "array"
86+
},
87+
"repo": {
88+
"description": "Repository name. Required when level is 'repository'.",
89+
"type": "string"
90+
}
91+
},
92+
"required": [
93+
"level",
94+
"properties"
95+
],
96+
"type": "object"
97+
},
98+
"name": "custom_properties_write"
99+
}

0 commit comments

Comments
 (0)