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

Function ListStarredRepositories

pkg/github/repositories.go:1995–2136  ·  view source on GitHub ↗

ListStarredRepositories creates a tool to list starred repositories for the authenticated user or a specified user.

(t translations.TranslationHelperFunc)

Source from the content-addressed store, hash-verified

1993
1994// ListStarredRepositories creates a tool to list starred repositories for the authenticated user or a specified user.
1995func ListStarredRepositories(t translations.TranslationHelperFunc) inventory.ServerTool {
1996 return NewTool(
1997 ToolsetMetadataStargazers,
1998 mcp.Tool{
1999 Name: "list_starred_repositories",
2000 Description: t("TOOL_LIST_STARRED_REPOSITORIES_DESCRIPTION", "List starred repositories"),
2001 Annotations: &mcp.ToolAnnotations{
2002 Title: t("TOOL_LIST_STARRED_REPOSITORIES_USER_TITLE", "List starred repositories"),
2003 ReadOnlyHint: true,
2004 },
2005 InputSchema: WithPagination(&jsonschema.Schema{
2006 Type: "object",
2007 Properties: map[string]*jsonschema.Schema{
2008 "username": {
2009 Type: "string",
2010 Description: "Username to list starred repositories for. Defaults to the authenticated user.",
2011 },
2012 "sort": {
2013 Type: "string",
2014 Description: "How to sort the results. Can be either 'created' (when the repository was starred) or 'updated' (when the repository was last pushed to).",
2015 Enum: []any{"created", "updated"},
2016 },
2017 "direction": {
2018 Type: "string",
2019 Description: "The direction to sort the results by.",
2020 Enum: []any{"asc", "desc"},
2021 },
2022 },
2023 }),
2024 },
2025 []scopes.Scope{scopes.Repo},
2026 func(ctx context.Context, deps ToolDependencies, _ *mcp.CallToolRequest, args map[string]any) (*mcp.CallToolResult, any, error) {
2027 username, err := OptionalParam[string](args, "username")
2028 if err != nil {
2029 return utils.NewToolResultError(err.Error()), nil, nil
2030 }
2031 sort, err := OptionalParam[string](args, "sort")
2032 if err != nil {
2033 return utils.NewToolResultError(err.Error()), nil, nil
2034 }
2035 direction, err := OptionalParam[string](args, "direction")
2036 if err != nil {
2037 return utils.NewToolResultError(err.Error()), nil, nil
2038 }
2039 pagination, err := OptionalPaginationParams(args)
2040 if err != nil {
2041 return utils.NewToolResultError(err.Error()), nil, nil
2042 }
2043
2044 opts := &github.ActivityListStarredOptions{
2045 ListOptions: github.ListOptions{
2046 Page: pagination.Page,
2047 PerPage: pagination.PerPage,
2048 },
2049 }
2050 if sort != "" {
2051 opts.Sort = sort
2052 }

Callers 2

AllToolsFunction · 0.85

Calls 9

NewToolResultErrorFunction · 0.92
NewToolResultTextFunction · 0.92
NewToolFunction · 0.85
WithPaginationFunction · 0.85
OptionalPaginationParamsFunction · 0.85
attachJoinedIFCLabelFunction · 0.85
CloseMethod · 0.80
GetClientMethod · 0.65
ErrorMethod · 0.45

Tested by 1