MCPcopy
hub / github.com/github/github-mcp-server / ListPullRequests

Function ListPullRequests

pkg/github/pullrequests.go:1298–1449  ·  view source on GitHub ↗

ListPullRequests creates a tool to list and filter repository pull requests.

(t translations.TranslationHelperFunc)

Source from the content-addressed store, hash-verified

1296
1297// ListPullRequests creates a tool to list and filter repository pull requests.
1298func ListPullRequests(t translations.TranslationHelperFunc) inventory.ServerTool {
1299 schema := &jsonschema.Schema{
1300 Type: "object",
1301 Properties: map[string]*jsonschema.Schema{
1302 "owner": {
1303 Type: "string",
1304 Description: "Repository owner",
1305 },
1306 "repo": {
1307 Type: "string",
1308 Description: "Repository name",
1309 },
1310 "state": {
1311 Type: "string",
1312 Description: "Filter by state",
1313 Enum: []any{"open", "closed", "all"},
1314 },
1315 "head": {
1316 Type: "string",
1317 Description: "Filter by head user/org and branch",
1318 },
1319 "base": {
1320 Type: "string",
1321 Description: "Filter by base branch",
1322 },
1323 "sort": {
1324 Type: "string",
1325 Description: "Sort by",
1326 Enum: []any{"created", "updated", "popularity", "long-running"},
1327 },
1328 "direction": {
1329 Type: "string",
1330 Description: "Sort direction",
1331 Enum: []any{"asc", "desc"},
1332 },
1333 },
1334 Required: []string{"owner", "repo"},
1335 }
1336 WithPagination(schema)
1337
1338 return NewTool(
1339 ToolsetMetadataPullRequests,
1340 mcp.Tool{
1341 Name: "list_pull_requests",
1342 Description: t("TOOL_LIST_PULL_REQUESTS_DESCRIPTION", "List pull requests in a GitHub repository. If the user specifies an author, then DO NOT use this tool and use the search_pull_requests tool instead."),
1343 Annotations: &mcp.ToolAnnotations{
1344 Title: t("TOOL_LIST_PULL_REQUESTS_USER_TITLE", "List pull requests"),
1345 ReadOnlyHint: true,
1346 },
1347 InputSchema: schema,
1348 },
1349 []scopes.Scope{scopes.Repo},
1350 func(ctx context.Context, deps ToolDependencies, _ *mcp.CallToolRequest, args map[string]any) (*mcp.CallToolResult, any, error) {
1351 owner, err := RequiredParam[string](args, "owner")
1352 if err != nil {
1353 return utils.NewToolResultError(err.Error()), nil, nil
1354 }
1355 repo, err := RequiredParam[string](args, "repo")

Callers 2

AllToolsFunction · 0.85
Test_ListPullRequestsFunction · 0.85

Calls 13

NewToolResultErrorFunction · 0.92
SanitizeFunction · 0.92
NewToolResultTextFunction · 0.92
WithPaginationFunction · 0.85
NewToolFunction · 0.85
OptionalPaginationParamsFunction · 0.85
ListMethod · 0.80
CloseMethod · 0.80
GetClientMethod · 0.65

Tested by 1

Test_ListPullRequestsFunction · 0.68