Skip to content

Commit 602beb0

Browse files
refactor(repos): compact typed repository outputs
Replace raw REST output schemas with compact repository DTOs, retain one canonical snapshot per tool, and align modern JSON text with structured output while pinning legacy content. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
1 parent 596b0d0 commit 602beb0

39 files changed

Lines changed: 1213 additions & 9929 deletions

‎README.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -620,6 +620,8 @@ Repository tools expose output schemas and typed `structuredContent` to clients
620620

621621
For `get_file_contents`, directory results (including field projections) are structured arrays. File downloads and metadata-only responses use a `content` array of typed text, embedded-resource, or resource-link blocks, preserving status messages, text, base64 blobs, empty files, and download links. Text-only repository mutations such as starring and deletion also return a structured `message`; fork responses distinguish a repository reference from an in-progress message. Repository deletion still requires its existing confirmation flow before returning a completed result.
622622

623+
Structured repository results use compact DTOs rather than raw REST objects. Release lookups share the compact release shape with release listings; Git references retain the ref, object type, and SHA; annotated tags retain tag/message/tagger/target information; deletion commits retain SHA, message, authors, tree SHA, parent SHAs, and a human-facing `html_url` when available. Directory entries retain file metadata and useful HTML/download links, but omit API and hypermedia routing URLs even when those fields were requested in a projection. Legacy and unknown protocol versions retain the original text byte-for-byte; modern text-only JSON responses serialize the same compact DTO as `structuredContent`. Non-text resource blocks and tool errors retain their existing content behavior. Structured projections use the same sanitized and filtered source as the legacy formatter.
624+
623625
The issue metadata (`list_issue_types`, `list_issue_fields`), comment (`add_issue_comment`, `update_issue_comment`), dependency (`issue_dependency_read`, `issue_dependency_write`), and duplicate-detection (`find_duplicate`) tools provide typed `outputSchema` and `structuredContent` for protocol `2026-07-28` and newer. Older or unknown protocol versions retain the same text responses without these fields. Tool errors do not return structured content. Dependency and duplicate-detection tools retain their existing feature gates.
624626

625627
<!-- START AUTOMATED TOOLS -->

‎pkg/github/__toolsnaps__/create_branch.snap‎

Lines changed: 51 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,18 @@
55
"title": "Create branch"
66
},
77
"description": "Create a new branch in a GitHub repository",
8+
"icons": [
9+
{
10+
"mimeType": "image/png",
11+
"src": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAABmJLR0QA/wD/AP+gvaeTAAABTklEQVRIie2UPUvDUBSGn5PW2qnYwUXExWhNpY2CUKT+BB10E3R0dnbrppuKLgouHbr5X5qlKRIFB+cuguBHj4O05KYfNsVJ+m7n3Hue54ZcrhDKQqGQTX1YVwg7QIbx0gh8b7VTJMMrqS+5RtgD7oDX2GhhC6UcbhkCVLZVuX1sesex4YCdX6uAGgIrsicjlrTGgQ9KVPDnmQgmgongPwgkXNiOq8ADMAtkx4UGvtflJvus20ANeIlN/vW5/kkt8L3D2HD6P9dRgSI8dQcc9w1IR3acBE3vbFSp8ZMVnoFSqJ/unZDe3pAYXyDIJarn9opbDZrewaAh2y7Oy5S1r6h5QG2Xxbw3piDw6xe244oKyxFmC5ihc+tS1qaqngKJyAEBGmZvSGzHVYT790T7aPozsaFoFZGboFGvDJsbOYuOuxuuc7n1uaV8sRSH8Q1DUVLnYLty3gAAAABJRU5ErkJggg==",
12+
"theme": "light"
13+
},
14+
{
15+
"mimeType": "image/png",
16+
"src": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAABmJLR0QA/wD/AP+gvaeTAAAA+ElEQVRIie2WLU5DQRRGzwUEirQCQ9BsoSGtZQHgSFgIsg4JXQCGP8V2QCBIEATZkJDgOJi+MJnMo30TFHmfmzvzfeeKyZ2BROpQvVHfrddDmhkZ4BY4Ai6BD7prAowjIoq7i85nFcGNf6qa1tayM1vAvBZQUg74c/WAHtAD/gMgn6YCT8A2MKwOTaZpCfAF3AGvFdlLx7XqdUVw4186rgWeE8Nn4cU67QLNAS/ASG3qmwVPqdaqjWw9A86BK+CkzaTuAseFBse/AiLiQg1gLzs3Bwb8XIp94AxYL/Af2xordap6v/htHKhv6nTlgBUAh9l6Rx11yfgG8ne/zwh2OysAAAAASUVORK5CYII=",
17+
"theme": "dark"
18+
}
19+
],
820
"inputSchema": {
921
"properties": {
1022
"branch": {
@@ -17,11 +29,13 @@
1729
},
1830
"owner": {
1931
"description": "Repository owner",
20-
"type": "string"
32+
"type": "string",
33+
"x-mcp-header": "owner"
2134
},
2235
"repo": {
2336
"description": "Repository name",
24-
"type": "string"
37+
"type": "string",
38+
"x-mcp-header": "repo"
2539
}
2640
},
2741
"required": [
@@ -31,5 +45,39 @@
3145
],
3246
"type": "object"
3347
},
34-
"name": "create_branch"
48+
"name": "create_branch",
49+
"outputSchema": {
50+
"additionalProperties": false,
51+
"properties": {
52+
"object": {
53+
"additionalProperties": false,
54+
"properties": {
55+
"sha": {
56+
"type": "string"
57+
},
58+
"type": {
59+
"description": "Git object kind: commit, tag, tree, or blob.",
60+
"type": "string"
61+
}
62+
},
63+
"required": [
64+
"type",
65+
"sha"
66+
],
67+
"type": "object"
68+
},
69+
"ref": {
70+
"description": "Fully qualified reference, such as refs/heads/main.",
71+
"type": "string"
72+
}
73+
},
74+
"required": [
75+
"ref",
76+
"object"
77+
],
78+
"type": [
79+
"null",
80+
"object"
81+
]
82+
}
3583
}

‎pkg/github/__toolsnaps__/create_branch_typed.snap‎

Lines changed: 0 additions & 110 deletions
This file was deleted.

‎pkg/github/__toolsnaps__/create_or_update_file.snap‎

Lines changed: 95 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,18 @@
55
"title": "Create or update file"
66
},
77
"description": "Create or update a single file in a GitHub repository. \nIf updating, you should provide the SHA of the file you want to update. Use this tool to create or update a file in a GitHub repository remotely; do not use it for local file operations.\n\nTo obtain the current blob SHA before updating, call the get_file_contents tool with the same owner, repo, and path, and set its ref parameter to this tool's branch value. The first text result reports the blob SHA for the requested path.\n\nSHA MUST be provided for existing file updates.\n",
8+
"icons": [
9+
{
10+
"mimeType": "image/png",
11+
"src": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAABmJLR0QA/wD/AP+gvaeTAAABTklEQVRIie2UPUvDUBSGn5PW2qnYwUXExWhNpY2CUKT+BB10E3R0dnbrppuKLgouHbr5X5qlKRIFB+cuguBHj4O05KYfNsVJ+m7n3Hue54ZcrhDKQqGQTX1YVwg7QIbx0gh8b7VTJMMrqS+5RtgD7oDX2GhhC6UcbhkCVLZVuX1sesex4YCdX6uAGgIrsicjlrTGgQ9KVPDnmQgmgongPwgkXNiOq8ADMAtkx4UGvtflJvus20ANeIlN/vW5/kkt8L3D2HD6P9dRgSI8dQcc9w1IR3acBE3vbFSp8ZMVnoFSqJ/unZDe3pAYXyDIJarn9opbDZrewaAh2y7Oy5S1r6h5QG2Xxbw3piDw6xe244oKyxFmC5ihc+tS1qaqngKJyAEBGmZvSGzHVYT790T7aPozsaFoFZGboFGvDJsbOYuOuxuuc7n1uaV8sRSH8Q1DUVLnYLty3gAAAABJRU5ErkJggg==",
12+
"theme": "light"
13+
},
14+
{
15+
"mimeType": "image/png",
16+
"src": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAABmJLR0QA/wD/AP+gvaeTAAAA+ElEQVRIie2WLU5DQRRGzwUEirQCQ9BsoSGtZQHgSFgIsg4JXQCGP8V2QCBIEATZkJDgOJi+MJnMo30TFHmfmzvzfeeKyZ2BROpQvVHfrddDmhkZ4BY4Ai6BD7prAowjIoq7i85nFcGNf6qa1tayM1vAvBZQUg74c/WAHtAD/gMgn6YCT8A2MKwOTaZpCfAF3AGvFdlLx7XqdUVw4186rgWeE8Nn4cU67QLNAS/ASG3qmwVPqdaqjWw9A86BK+CkzaTuAseFBse/AiLiQg1gLzs3Bwb8XIp94AxYL/Af2xordap6v/htHKhv6nTlgBUAh9l6Rx11yfgG8ne/zwh2OysAAAAASUVORK5CYII=",
17+
"theme": "dark"
18+
}
19+
],
820
"inputSchema": {
921
"properties": {
1022
"allow_symlink_write": {
@@ -26,15 +38,17 @@
2638
},
2739
"owner": {
2840
"description": "Repository owner (username or organization)",
29-
"type": "string"
41+
"type": "string",
42+
"x-mcp-header": "owner"
3043
},
3144
"path": {
3245
"description": "Path where to create/update the file",
3346
"type": "string"
3447
},
3548
"repo": {
3649
"description": "Repository name",
37-
"type": "string"
50+
"type": "string",
51+
"x-mcp-header": "repo"
3852
},
3953
"sha": {
4054
"description": "The blob SHA of the file being replaced. Required if the file already exists. Retrieve it with get_file_contents using the same owner, repo, and path, with ref set to this tool's branch value.",
@@ -51,5 +65,83 @@
5165
],
5266
"type": "object"
5367
},
54-
"name": "create_or_update_file"
68+
"name": "create_or_update_file",
69+
"outputSchema": {
70+
"additionalProperties": false,
71+
"properties": {
72+
"commit": {
73+
"additionalProperties": false,
74+
"properties": {
75+
"author": {
76+
"additionalProperties": false,
77+
"properties": {
78+
"date": {
79+
"type": "string"
80+
},
81+
"email": {
82+
"type": "string"
83+
},
84+
"name": {
85+
"type": "string"
86+
}
87+
},
88+
"type": [
89+
"null",
90+
"object"
91+
]
92+
},
93+
"html_url": {
94+
"type": "string"
95+
},
96+
"message": {
97+
"type": "string"
98+
},
99+
"sha": {
100+
"type": "string"
101+
}
102+
},
103+
"required": [
104+
"sha"
105+
],
106+
"type": [
107+
"null",
108+
"object"
109+
]
110+
},
111+
"content": {
112+
"additionalProperties": false,
113+
"properties": {
114+
"html_url": {
115+
"type": "string"
116+
},
117+
"name": {
118+
"type": "string"
119+
},
120+
"path": {
121+
"type": "string"
122+
},
123+
"sha": {
124+
"type": "string"
125+
},
126+
"size": {
127+
"type": "integer"
128+
}
129+
},
130+
"required": [
131+
"name",
132+
"path",
133+
"sha",
134+
"html_url"
135+
],
136+
"type": [
137+
"null",
138+
"object"
139+
]
140+
}
141+
},
142+
"type": [
143+
"null",
144+
"object"
145+
]
146+
}
55147
}

0 commit comments

Comments
 (0)