Type granular issue MCP inputs and protocol-gated outputs by SamMorrowDrums · Pull Request #3394 · github/github-mcp-server · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
23 changes: 23 additions & 0 deletions docs/error-handling.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,29 @@ This function:
return ghErrors.NewGitHubGraphQLErrorResponse(ctx, message, err), nil
```

### Typed Tool Results

Tools registered with concrete `NewTool[In, Out]` types expose output schemas and
`structuredContent` only when the negotiated protocol is `2026-07-28` or newer.
Older or unknown protocols retain the original text responses without these
typed-output additions. Ordinary API and validation errors never expose the
SDK-generated zero-value structured output.

Handler-provided structured statuses are distinct from generated error output.
For example, `issue_write` can return `IsError: true` with
`status: "awaiting_user_submission"` while an MCP App form is pending. Modern
clients retain that explicit status and its reason; legacy clients retain the
stop message and error flag without structured content. This status does not
mean the issue was created or updated. The output schema includes a strict
status variant alongside the mutation's `id`/`url` variant. Multi-round-trip
`InputRequests` continue to pass through unchanged.

The consolidated issue tools use method-discriminated object outputs for modern
successes. Issue and comment data are projected from the API responses into
compact DTOs, excluding API, node, and hypermedia URLs while retaining human
links. Legacy text is marshalled separately and keeps its original format and
fields.

### Context Management

The error handling system uses context to store errors for later inspection:
Expand Down
39 changes: 36 additions & 3 deletions pkg/github/__toolsnaps__/add_issue_comment_reaction.snap
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,18 @@
"title": "Add Reaction to Issue or Pull Request Comment"
},
"description": "Add a reaction to an issue or pull request comment.",
"icons": [
{
"mimeType": "image/png",
"src": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAABmJLR0QA/wD/AP+gvaeTAAAC2UlEQVRIicWVMUyTaRjHf/+vVUpOJOdilOYoUvVreq2CDmLOwdlAS5xMbrrhBifjY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ERJOIKSjoUArwBPwUFFaKIIngAJARCPIgdh4cgRBYt6ZIAEYEqdhpEw0fhCbkKa68dxyNtsfNzzpnZu3NhwpYGBdUqcA+4A1wEZiK0DawD74FWSml3JAJ1CngGLAIngU1gFfgZKWeAG8AFoAu8At6mlH6VtqTOqJ/UP2pDnRuQO6c27VlbrQ0Dvq121Fulag7q5qPmW18SdSqUd9Qrw4Jn9bNR21YrRQkvYixDKy/AuB3jWjocqKpdtXFU8AxrOTqZzp2PgvnaMRDUA+tB7mypG+OCZ3hbahPgRPguAR9LihaicEu9WcKxClzOi/fU1wPAk7rjgX0uEfNG3cs7mJjtE+wA5/olpZQEHgNf6K2NJyW4NeD7v7c4WptjSc0svlMjdzyM2fbdOyOA7x/T+7mzGj9H8xgIWuquevpw4HmsivkxwBdC/WJRsBKLqqPOHgH8aqybtcJlF0m1WLndUToJ5V31q9r3NOYk7Wh1Wa0PyK3HzA3l/4H3uzIrwFNgCThF7/x/AH5EylngOnAe6AAvgXcppd9DEWRE08DdeIou/RVgJaXUGYQzUfsL+zmwV7BtIq0AAAAASUVORK5CYII=",
"theme": "dark"
}
],
"inputSchema": {
"properties": {
"comment_id": {
Expand All @@ -30,11 +42,13 @@
},
"owner": {
"description": "Repository owner (username or organization)",
"type": "string"
"type": "string",
"x-mcp-header": "owner"
},
"repo": {
"description": "Repository name",
"type": "string"
"type": "string",
"x-mcp-header": "repo"
}
},
"required": [
Expand All @@ -45,5 +59,24 @@
],
"type": "object"
},
"name": "add_issue_comment_reaction"
"name": "add_issue_comment_reaction",
"outputSchema": {
"additionalProperties": false,
"properties": {
"id": {
"type": "string"
},
"url": {
"type": "string"
}
},
"required": [
"id",
"url"
],
"type": [
"null",
"object"
]
}
}
39 changes: 36 additions & 3 deletions pkg/github/__toolsnaps__/add_issue_reaction.snap
Loading
Loading