MCPcopy Index your code
hub / github.com/github/github-mcp-server / getProject

Function getProject

pkg/github/projects.go:971–997  ·  view source on GitHub ↗
(ctx context.Context, client *github.Client, owner, ownerType string, projectNumber int)

Source from the content-addressed store, hash-verified

969}
970
971func getProject(ctx context.Context, client *github.Client, owner, ownerType string, projectNumber int) (*mcp.CallToolResult, bool, any, error) {
972 project, resp, err := fetchProjectV2(ctx, client, owner, ownerType, projectNumber)
973 if err != nil {
974 return ghErrors.NewGitHubAPIErrorResponse(ctx,
975 "failed to get project",
976 resp,
977 err,
978 ), false, nil, nil
979 }
980 defer func() { _ = resp.Body.Close() }()
981
982 if resp.StatusCode != http.StatusOK {
983 body, err := io.ReadAll(resp.Body)
984 if err != nil {
985 return nil, false, nil, fmt.Errorf("failed to read response body: %w", err)
986 }
987 return ghErrors.NewGitHubAPIStatusErrorResponse(ctx, "failed to get project", resp, body), false, nil, nil
988 }
989
990 minimalProject := convertToMinimalProject(project)
991 r, err := json.Marshal(minimalProject)
992 if err != nil {
993 return nil, false, nil, fmt.Errorf("failed to marshal response: %w", err)
994 }
995
996 return utils.NewToolResultText(string(r)), !project.GetPublic(), nil, nil
997}
998
999func getProjectField(ctx context.Context, client *github.Client, owner, ownerType string, projectNumber int, fieldID int64) (*mcp.CallToolResult, any, error) {
1000 var resp *github.Response

Callers 1

ProjectsGetFunction · 0.85

Calls 4

NewToolResultTextFunction · 0.92
fetchProjectV2Function · 0.85
convertToMinimalProjectFunction · 0.85
CloseMethod · 0.80

Tested by

no test coverage detected