Skip to content

Commit f196364

Browse files
committed
Update get_pull_request_files search_pull_requests
1 parent 45bfff6 commit f196364

File tree

2 files changed

+5
-176
lines changed

2 files changed

+5
-176
lines changed

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -531,10 +531,8 @@ export GITHUB_MCP_TOOL_ADD_ISSUE_COMMENT_DESCRIPTION="an alternative description
531531
- `query`: Search query using GitHub pull request search syntax (string, required)
532532
- `owner`: Repository owner (string, optional)
533533
- `repo`: Repository name (string, optional)
534-
- `sort`: Sort field by number of matches of categories, defaults to best match (string, optional)
535-
- Enum: "comments", "reactions", "reactions-+1", "reactions--1", "reactions-smile", "reactions-thinking_face", "reactions-heart", "reactions-tada", "interactions", "created", "updated"
534+
- `sort`: Sort field (string, optional)
536535
- `order`: Sort order (string, optional)
537-
- Enum: "asc", "desc"
538536
- `page`: Page number (number, optional)
539537
- `perPage`: Results per page (number, optional)
540538

@@ -552,6 +550,10 @@ export GITHUB_MCP_TOOL_ADD_ISSUE_COMMENT_DESCRIPTION="an alternative description
552550
- `owner`: Repository owner (string, required)
553551
- `repo`: Repository name (string, required)
554552
- `pullNumber`: Pull request number (number, required)
553+
- `sort`: Sort field (string, optional)
554+
- `direction`: Sort direction (string, optional)
555+
- `perPage`: Results per page (number, optional)
556+
- `page`: Page number (number, optional)
555557

556558
- **get_pull_request_status** - Get the combined status of all status checks for a pull request
557559

e2e/e2e_test.go

Lines changed: 0 additions & 173 deletions
Original file line numberDiff line numberDiff line change
@@ -1447,179 +1447,6 @@ func TestPullRequestReviewCommentSubmit(t *testing.T) {
14471447
require.Equal(t, 3, len(comments), "expected to find three review comments")
14481448
}
14491449

1450-
func TestListIssues(t *testing.T) {
1451-
t.Parallel()
1452-
1453-
mcpClient := setupMCPClient(t)
1454-
1455-
ctx := context.Background()
1456-
1457-
// First, who am I
1458-
getMeRequest := mcp.CallToolRequest{}
1459-
getMeRequest.Params.Name = "get_me"
1460-
1461-
t.Log("Getting current user...")
1462-
resp, err := mcpClient.CallTool(ctx, getMeRequest)
1463-
require.NoError(t, err, "expected to call 'get_me' tool successfully")
1464-
require.False(t, resp.IsError, fmt.Sprintf("expected result not to be an error: %+v", resp))
1465-
1466-
require.False(t, resp.IsError, "expected result not to be an error")
1467-
require.Len(t, resp.Content, 1, "expected content to have one item")
1468-
1469-
textContent, ok := resp.Content[0].(mcp.TextContent)
1470-
require.True(t, ok, "expected content to be of type TextContent")
1471-
1472-
var trimmedGetMeText struct {
1473-
Login string `json:"login"`
1474-
}
1475-
err = json.Unmarshal([]byte(textContent.Text), &trimmedGetMeText)
1476-
require.NoError(t, err, "expected to unmarshal text content successfully")
1477-
1478-
currentOwner := trimmedGetMeText.Login
1479-
1480-
// Then create a repository with a README (via autoInit)
1481-
repoName := fmt.Sprintf("github-mcp-server-e2e-%s-%d", t.Name(), time.Now().UnixMilli())
1482-
createRepoRequest := mcp.CallToolRequest{}
1483-
createRepoRequest.Params.Name = "create_repository"
1484-
createRepoRequest.Params.Arguments = map[string]any{
1485-
"name": repoName,
1486-
"private": true,
1487-
"autoInit": true,
1488-
}
1489-
1490-
t.Logf("Creating repository %s/%s...", currentOwner, repoName)
1491-
resp, err := mcpClient.CallTool(ctx, createRepoRequest)
1492-
require.NoError(t, err, "expected to call 'create_repository' tool successfully")
1493-
require.False(t, resp.IsError, fmt.Sprintf("expected result not to be an error: %+v", resp))
1494-
1495-
// Cleanup the repository after the test
1496-
t.Cleanup(func() {
1497-
// MCP Server doesn't support deletions, but we can use the GitHub Client
1498-
ghClient := getRESTClient(t)
1499-
t.Logf("Deleting repository %s/%s...", currentOwner, repoName)
1500-
ghClient.Repositories.Delete(context.Background(), currentOwner, repoName)
1501-
// require.NoError(t, err, "expected to delete repository successfully")
1502-
})
1503-
1504-
// Create a branch on which to create a new commit
1505-
createBranchRequest := mcp.CallToolRequest{}
1506-
createBranchRequest.Params.Name = "create_branch"
1507-
createBranchRequest.Params.Arguments = map[string]any{
1508-
"owner": currentOwner,
1509-
"repo": repoName,
1510-
"branch": "test-branch",
1511-
"from_branch": "main",
1512-
}
1513-
1514-
t.Logf("Creating branch in %s/%s...", currentOwner, repoName)
1515-
resp, err = mcpClient.CallTool(ctx, createBranchRequest)
1516-
require.NoError(t, err, "expected to call 'create_branch' tool successfully")
1517-
require.False(t, resp.IsError, fmt.Sprintf("expected result not to be an error: %+v", resp))
1518-
1519-
// Create a commit with a new file
1520-
commitRequest := mcp.CallToolRequest{}
1521-
commitRequest.Params.Name = "create_or_update_file"
1522-
commitRequest.Params.Arguments = map[string]any{
1523-
"owner": currentOwner,
1524-
"repo": repoName,
1525-
"path": "test-file.txt",
1526-
"content": fmt.Sprintf("Created by e2e test %s\nwith multiple lines", t.Name()),
1527-
"message": "Add test file",
1528-
"branch": "test-branch",
1529-
}
1530-
1531-
t.Logf("Creating commit with new file in %s/%s...", currentOwner, repoName)
1532-
resp, err = mcpClient.CallTool(ctx, commitRequest)
1533-
require.NoError(t, err, "expected to call 'create_or_update_file' tool successfully")
1534-
require.False(t, resp.IsError, fmt.Sprintf("expected result not to be an error: %+v", resp))
1535-
1536-
textContent, ok = resp.Content[0].(mcp.TextContent)
1537-
require.True(t, ok, "expected content to be of type TextContent")
1538-
1539-
var trimmedCommitText struct {
1540-
Commit struct {
1541-
SHA string `json:"sha"`
1542-
} `json:"commit"`
1543-
}
1544-
err = json.Unmarshal([]byte(textContent.Text), &trimmedCommitText)
1545-
require.NoError(t, err, "expected to unmarshal text content successfully")
1546-
1547-
// Create a pull request
1548-
prRequest := mcp.CallToolRequest{}
1549-
prRequest.Params.Name = "create_pull_request"
1550-
prRequest.Params.Arguments = map[string]any{
1551-
"owner": currentOwner,
1552-
"repo": repoName,
1553-
"title": "Test PR",
1554-
"body": "This is a test PR",
1555-
"head": "test-branch",
1556-
"base": "main",
1557-
}
1558-
1559-
t.Logf("Creating pull request in %s/%s...", currentOwner, repoName)
1560-
resp, err = mcpClient.CallTool(ctx, prRequest)
1561-
require.NoError(t, err, "expected to call 'create_pull_request' tool successfully")
1562-
require.False(t, resp.IsError, fmt.Sprintf("expected result not to be an error: %+v", resp))
1563-
1564-
// Create a review for the pull request, but we can't approve it
1565-
// because the current owner also owns the PR.
1566-
createPendingPullRequestReviewRequest := mcp.CallToolRequest{}
1567-
createPendingPullRequestReviewRequest.Params.Name = "create_pending_pull_request_review"
1568-
createPendingPullRequestReviewRequest.Params.Arguments = map[string]any{
1569-
"owner": currentOwner,
1570-
"repo": repoName,
1571-
"pullNumber": 1,
1572-
}
1573-
1574-
t.Logf("Creating pending review for pull request in %s/%s...", currentOwner, repoName)
1575-
resp, err = mcpClient.CallTool(ctx, createPendingPullRequestReviewRequest)
1576-
require.NoError(t, err, "expected to call 'create_pending_pull_request_review' tool successfully")
1577-
require.False(t, resp.IsError, fmt.Sprintf("expected result not to be an error: %+v", resp))
1578-
1579-
textContent, ok = resp.Content[0].(mcp.TextContent)
1580-
require.True(t, ok, "expected content to be of type TextContent")
1581-
require.Equal(t, "pending pull request created", textContent.Text)
1582-
1583-
t.Logf("Creating an issue in %s/%s...", currentOwner, repoName)
1584-
createIssueRequest := mcp.CallToolRequest{}
1585-
createIssueRequest.Params.Name = "create_issue"
1586-
createIssueRequest.Params.Arguments = map[string]any{
1587-
"owner": currentOwner,
1588-
"repo": repoName,
1589-
"title": "Test Issue",
1590-
"body": "This is a test issue",
1591-
}
1592-
resp, err = mcpClient.CallTool(ctx, createIssueRequest)
1593-
require.NoError(t, err, "expected to call 'create_issue' tool successfully")
1594-
require.False(t, resp.IsError, fmt.Sprintf("expected result not to be an error: %+v", resp))
1595-
1596-
// List issues in the repository
1597-
listIssuesRequest := mcp.CallToolRequest{}
1598-
listIssuesRequest.Params.Name = "list_issues"
1599-
listIssuesRequest.Params.Arguments = map[string]any{
1600-
"owner": currentOwner,
1601-
"repo": repoName,
1602-
}
1603-
1604-
t.Logf("Listing issues in %s/%s...", currentOwner, repoName)
1605-
resp, err = mcpClient.CallTool(ctx, listIssuesRequest)
1606-
require.NoError(t, err, "expected to call 'list_issues' tool successfully")
1607-
require.False(t, resp.IsError, fmt.Sprintf("expected result not to be an error: %+v", resp))
1608-
1609-
textContent, ok = resp.Content[0].(mcp.TextContent)
1610-
require.True(t, ok, "expected content to be of type TextContent")
1611-
1612-
var issues []struct {
1613-
ID int `json:"id"`
1614-
Number int `json:"number"`
1615-
Title string `json:"title"`
1616-
Body string `json:"body"`
1617-
}
1618-
err = json.Unmarshal([]byte(textContent.Text), &issues)
1619-
require.NoError(t, err, "expected to unmarshal text content successfully")
1620-
require.Len(t, issues, 1, "expected to find one issue")
1621-
}
1622-
16231450
func TestPullRequestReviewDeletion(t *testing.T) {
16241451
t.Parallel()
16251452

0 commit comments

Comments
 (0)