Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR updates the end-to-end tests to use the new embedded resource API for text content rather than decoding base64 JSON.
- Removed old
TextContentJSON/base64 decode logic. - Switched to asserting on
mcp.EmbeddedResourceand extractingTextResourceContents. - Dropped the
encoding/base64import.
Comments suppressed due to low confidence (1)
e2e/e2e_test.go:513
- [nitpick] This comment is a bit vague. Consider clarifying what "raw api" refers to, or remove it if it's no longer needed.
// raw api
Comment on lines
+510
to
518
| embeddedResource, ok := resp.Content[1].(mcp.EmbeddedResource) | ||
| require.True(t, ok, "expected content to be of type EmbeddedResource") | ||
|
|
||
| var trimmedGetFileText struct { | ||
| Content string `json:"content"` | ||
| } | ||
| err = json.Unmarshal([]byte(textContent.Text), &trimmedGetFileText) | ||
| require.NoError(t, err, "expected to unmarshal text content successfully") | ||
| b, err := base64.StdEncoding.DecodeString(trimmedGetFileText.Content) | ||
| require.NoError(t, err, "expected to decode base64 content successfully") | ||
| require.Equal(t, fmt.Sprintf("Created by e2e test %s", t.Name()), string(b), "expected file content to match") | ||
| // raw api | ||
| textResource, ok := embeddedResource.Resource.(mcp.TextResourceContents) | ||
| require.True(t, ok, "expected embedded resource to be of type TextResourceContents") | ||
|
|
||
| require.Equal(t, fmt.Sprintf("Created by e2e test %s", t.Name()), textResource.Text, "expected file content to match") | ||
|
|
There was a problem hiding this comment.
The indexing (resp.Content[1]) and type assertion logic is duplicated in both tests. Consider extracting a helper like getTextFromEmbedded(resp) to improve readability and reduce duplication.
Comment on lines
+702
to
710
| embeddedResource, ok := resp.Content[1].(mcp.EmbeddedResource) | ||
| require.True(t, ok, "expected content to be of type EmbeddedResource") | ||
|
|
||
| var trimmedGetFileText struct { | ||
| Content string `json:"content"` | ||
| } | ||
| err = json.Unmarshal([]byte(textContent.Text), &trimmedGetFileText) | ||
| require.NoError(t, err, "expected to unmarshal text content successfully") | ||
| b, err := base64.StdEncoding.DecodeString(trimmedGetFileText.Content) | ||
| require.NoError(t, err, "expected to decode base64 content successfully") | ||
| require.Equal(t, fmt.Sprintf("Created by e2e test %s", t.Name()), string(b), "expected file content to match") | ||
| // raw api | ||
| textResource, ok := embeddedResource.Resource.(mcp.TextResourceContents) | ||
| require.True(t, ok, "expected embedded resource to be of type TextResourceContents") | ||
|
|
||
| require.Equal(t, fmt.Sprintf("Created by e2e test %s", t.Name()), textResource.Text, "expected file content to match") | ||
|
|
There was a problem hiding this comment.
Same pattern repeated here in TestDirectoryDeletion. Extracting a shared helper for fetching and validating TextResourceContents would reduce duplication.
SamMorrowDrums
approved these changes
Jun 17, 2025
Collaborator
|
Thanky you @tonytrg |
nickytonline
pushed a commit
to nickytonline/github-mcp-http
that referenced
this pull request
Oct 4, 2025
Co-authored-by: Sam Morrow <info@sam-morrow.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes:
Test will try to unmarshall the text body of:
"successfully downloaded text file", which is a simple string. https://github.com/github/github-mcp-server/blob/main/pkg/github/repositories.go#L498#505 makes use of the raw api, which requires a change in the e2e tests.