github

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 16, 2026 License: MIT Imports: 41 Imported by: 1

Documentation

Overview

deprecated_tool_aliases.go

Index

Constants

View Source
const (
	DescriptionRepositoryOwner = "Repository owner"
	DescriptionRepositoryName  = "Repository name"
)
View Source
const (
	FilterDefault           = "default"
	FilterIncludeRead       = "include_read_notifications"
	FilterOnlyParticipating = "only_participating"
)
View Source
const (
	NotificationActionIgnore = "ignore"
	NotificationActionWatch  = "watch"
	NotificationActionDelete = "delete"
)

Enum values for ManageNotificationSubscription action

View Source
const (
	RepositorySubscriptionActionWatch  = "watch"
	RepositorySubscriptionActionIgnore = "ignore"
	RepositorySubscriptionActionDelete = "delete"
)
View Source
const (
	ProjectUpdateFailedError             = "failed to update a project item"
	ProjectAddFailedError                = "failed to add a project item"
	ProjectDeleteFailedError             = "failed to delete a project item"
	ProjectListFailedError               = "failed to list project items"
	ProjectStatusUpdateListFailedError   = "failed to list project status updates"
	ProjectStatusUpdateGetFailedError    = "failed to get project status update"
	ProjectStatusUpdateCreateFailedError = "failed to create project status update"
	ProjectResolveIDFailedError          = "failed to resolve project ID"
	MaxProjectsPerPage                   = 50
)
View Source
const DefaultGraphQLPageSize = 30
View Source
const GetMeUIResourceURI = "ui://github-mcp-server/get-me"

GetMeUIResourceURI is the URI for the get_me tool's MCP App UI resource.

View Source
const IssueWriteUIResourceURI = "ui://github-mcp-server/issue-write"

IssueWrite creates a tool to create a new or update an existing issue in a GitHub repository. IssueWriteUIResourceURI is the URI for the issue_write tool's MCP App UI resource.

View Source
const MCPAppMIMEType = "text/html;profile=mcp-app"

MCPAppMIMEType is the MIME type for MCP App UI resources.

View Source
const MCPAppsFeatureFlag = "remote_mcp_ui_apps"

MCPAppsFeatureFlag is the feature flag name for MCP Apps (interactive UI forms).

View Source
const PullRequestWriteUIResourceURI = "ui://github-mcp-server/pr-write"

PullRequestWriteUIResourceURI is the URI for the create_pull_request tool's MCP App UI resource.

Variables

View Source
var (
	ToolsetMetadataAll = inventory.ToolsetMetadata{
		ID:          "all",
		Description: "Special toolset that enables all available toolsets",
		Icon:        "apps",
	}
	ToolsetMetadataDefault = inventory.ToolsetMetadata{
		ID:          "default",
		Description: "Special toolset that enables the default toolset configuration. When no toolsets are specified, this is the set that is enabled",
		Icon:        "check-circle",
	}
	ToolsetMetadataContext = inventory.ToolsetMetadata{
		ID:               "context",
		Description:      "Tools that provide context about the current user and GitHub context you are operating in",
		Default:          true,
		Icon:             "person",
		InstructionsFunc: generateContextToolsetInstructions,
	}
	ToolsetMetadataRepos = inventory.ToolsetMetadata{
		ID:          "repos",
		Description: "GitHub Repository related tools",
		Default:     true,
		Icon:        "repo",
	}
	ToolsetMetadataGit = inventory.ToolsetMetadata{
		ID:          "git",
		Description: "GitHub Git API related tools for low-level Git operations",
		Icon:        "git-branch",
	}
	ToolsetMetadataIssues = inventory.ToolsetMetadata{
		ID:               "issues",
		Description:      "GitHub Issues related tools",
		Default:          true,
		Icon:             "issue-opened",
		InstructionsFunc: generateIssuesToolsetInstructions,
	}
	ToolsetMetadataPullRequests = inventory.ToolsetMetadata{
		ID:               "pull_requests",
		Description:      "GitHub Pull Request related tools",
		Default:          true,
		Icon:             "git-pull-request",
		InstructionsFunc: generatePullRequestsToolsetInstructions,
	}
	ToolsetMetadataUsers = inventory.ToolsetMetadata{
		ID:          "users",
		Description: "GitHub User related tools",
		Default:     true,
		Icon:        "people",
	}
	ToolsetMetadataOrgs = inventory.ToolsetMetadata{
		ID:          "orgs",
		Description: "GitHub Organization related tools",
		Icon:        "organization",
	}
	ToolsetMetadataActions = inventory.ToolsetMetadata{
		ID:          "actions",
		Description: "GitHub Actions workflows and CI/CD operations",
		Icon:        "workflow",
	}
	ToolsetMetadataCodeSecurity = inventory.ToolsetMetadata{
		ID:          "code_security",
		Description: "Code security related tools, such as GitHub Code Scanning",
		Icon:        "codescan",
	}
	ToolsetMetadataSecretProtection = inventory.ToolsetMetadata{
		ID:          "secret_protection",
		Description: "Secret protection related tools, such as GitHub Secret Scanning",
		Icon:        "shield-lock",
	}
	ToolsetMetadataDependabot = inventory.ToolsetMetadata{
		ID:          "dependabot",
		Description: "Dependabot tools",
		Icon:        "dependabot",
	}
	ToolsetMetadataNotifications = inventory.ToolsetMetadata{
		ID:          "notifications",
		Description: "GitHub Notifications related tools",
		Icon:        "bell",
	}
	ToolsetMetadataDiscussions = inventory.ToolsetMetadata{
		ID:               "discussions",
		Description:      "GitHub Discussions related tools",
		Icon:             "comment-discussion",
		InstructionsFunc: generateDiscussionsToolsetInstructions,
	}
	ToolsetMetadataGists = inventory.ToolsetMetadata{
		ID:          "gists",
		Description: "GitHub Gist related tools",
		Icon:        "logo-gist",
	}
	ToolsetMetadataSecurityAdvisories = inventory.ToolsetMetadata{
		ID:          "security_advisories",
		Description: "Security advisories related tools",
		Icon:        "shield",
	}
	ToolsetMetadataProjects = inventory.ToolsetMetadata{
		ID:               "projects",
		Description:      "GitHub Projects related tools",
		Icon:             "project",
		InstructionsFunc: generateProjectsToolsetInstructions,
	}
	ToolsetMetadataStargazers = inventory.ToolsetMetadata{
		ID:          "stargazers",
		Description: "GitHub Stargazers related tools",
		Icon:        "star",
	}
	ToolsetMetadataDynamic = inventory.ToolsetMetadata{
		ID:          "dynamic",
		Description: "Discover GitHub MCP tools that can help achieve tasks by enabling additional sets of tools, you can control the enablement of any toolset to access its tools when this toolset is enabled.",
		Icon:        "tools",
	}
	ToolsetLabels = inventory.ToolsetMetadata{
		ID:          "labels",
		Description: "GitHub Labels related tools",
		Icon:        "tag",
	}

	ToolsetMetadataCopilot = inventory.ToolsetMetadata{
		ID:          "copilot",
		Description: "Copilot related tools",
		Default:     true,
		Icon:        "copilot",
	}

	// Feature flag names for granular tool variants.
	// When active, consolidated tools are replaced by single-purpose granular tools.
	FeatureFlagIssuesGranular       = "issues_granular"
	FeatureFlagPullRequestsGranular = "pull_requests_granular"
)

Toolset metadata constants - these define all available toolsets and their descriptions. Tools use these constants to declare which toolset they belong to. Icons are Octicon names from https://primer.style/foundations/icons

View Source
var (
	// Remote-only toolsets - these are only available in the remote MCP server
	// but are documented here for consistency and to enable automated documentation.
	ToolsetMetadataCopilotSpaces = inventory.ToolsetMetadata{
		ID:          "copilot_spaces",
		Description: "Copilot Spaces tools",
		Icon:        "copilot",
	}
	ToolsetMetadataSupportSearch = inventory.ToolsetMetadata{
		ID:          "github_support_docs_search",
		Description: "Retrieve documentation to answer GitHub product and support questions. Topics include: GitHub Actions Workflows, Authentication, ...",
		Icon:        "book",
	}
)

AllowedFeatureFlags is the allowlist of feature flags that can be enabled by users via --features CLI flag or X-MCP-Features HTTP header. Only flags in this list are accepted; unknown flags are silently ignored. This is the single source of truth for which flags are user-controllable.

View Source
var DeprecatedToolAliases = map[string]string{

	"list_workflows":                 "actions_list",
	"list_workflow_runs":             "actions_list",
	"list_workflow_jobs":             "actions_list",
	"list_workflow_run_artifacts":    "actions_list",
	"get_workflow":                   "actions_get",
	"get_workflow_run":               "actions_get",
	"get_workflow_job":               "actions_get",
	"get_workflow_run_usage":         "actions_get",
	"get_workflow_run_logs":          "actions_get",
	"get_workflow_job_logs":          "actions_get",
	"download_workflow_run_artifact": "actions_get",
	"run_workflow":                   "actions_run_trigger",
	"rerun_workflow_run":             "actions_run_trigger",
	"rerun_failed_jobs":              "actions_run_trigger",
	"cancel_workflow_run":            "actions_run_trigger",
	"delete_workflow_run_logs":       "actions_run_trigger",

	"list_projects":       "projects_list",
	"list_project_fields": "projects_list",
	"list_project_items":  "projects_list",
	"get_project":         "projects_get",
	"get_project_field":   "projects_get",
	"get_project_item":    "projects_get",
	"add_project_item":    "projects_write",
	"update_project_item": "projects_write",
	"delete_project_item": "projects_write",
}

DeprecatedToolAliases maps old tool names to their new canonical names. When tools are renamed, add an entry here to maintain backward compatibility. Users referencing the old name will receive the new tool with a deprecation warning.

Example:

"get_issue": "issue_read",
"create_pr": "pull_request_create",
View Source
var ErrDepsNotInContext = errors.New("ToolDependencies not found in context; use ContextWithDeps to inject")

ErrDepsNotInContext is returned when ToolDependencies is not found in context.

View Source
var InsidersFeatureFlags = []string{
	MCPAppsFeatureFlag,
}

InsidersFeatureFlags is the list of feature flags that insiders mode enables. When insiders mode is active, all flags in this list are treated as enabled. This is the single source of truth for what "insiders" means in terms of feature flag expansion.

View Source
var RepositoryResourceArgumentResolvers = map[string]CompleteHandler{
	"owner":    completeOwner,
	"repo":     completeRepo,
	"branch":   completeBranch,
	"sha":      completeSHA,
	"tag":      completeTag,
	"prNumber": completePRNumber,
	"path":     completePath,
}

RepositoryResourceArgumentResolvers is a map of argument names to their completion handlers

View Source
var UIAssets embed.FS

UIAssets embeds the built MCP App UI HTML files. These files are generated by running `script/build-ui` which compiles the React/Primer components in the ui/ directory.

Functions

func ActionsGet added in v0.26.0

ActionsGet returns the tool and handler for getting GitHub Actions resources.

func ActionsGetJobLogs added in v0.26.0

ActionsGetJobLogs returns the tool and handler for getting workflow job logs.

func ActionsList added in v0.26.0

ActionsList returns the tool and handler for listing GitHub Actions resources.

func ActionsRunTrigger added in v0.26.0

ActionsRunTrigger returns the tool and handler for triggering GitHub Actions workflows.

func AddCommentToPendingReview added in v0.8.0

func AddCommentToPendingReview(t translations.TranslationHelperFunc) inventory.ServerTool

AddCommentToPendingReview creates a tool to add a comment to a pull request review.

func AddCommentToPendingReviewCall added in v0.33.1

func AddCommentToPendingReviewCall(ctx context.Context, client *githubv4.Client, params AddCommentToPendingReviewParams) (*mcp.CallToolResult, error)

AddCommentToPendingReviewCall adds a review comment to the viewer's pending pull request review.

func AddDefaultToolset added in v0.20.0

func AddDefaultToolset(result []string) []string

AddDefaultToolset removes the default toolset and expands it to the actual default toolset IDs

func AddIssueComment added in v0.2.0

AddIssueComment creates a tool to add a comment to an issue.

func AddReplyToPullRequestComment added in v0.31.0

func AddReplyToPullRequestComment(t translations.TranslationHelperFunc) inventory.ServerTool

AddReplyToPullRequestComment creates a tool to add a reply to an existing pull request comment.

func AddSubIssue added in v0.9.0

func AddSubIssue(ctx context.Context, client *github.Client, owner string, repo string, issueNumber int, subIssueID int, replaceParent bool) (*mcp.CallToolResult, error)

func AllPrompts added in v0.26.0

AllPrompts returns all prompts with their embedded toolset metadata. Prompt functions return ServerPrompt directly with toolset info.

func AllResources added in v0.26.0

AllResources returns all resource templates with their embedded toolset metadata. Resource definitions are stateless - handlers are generated on-demand during registration.

func AllTools added in v0.26.0

AllTools returns all tools with their embedded toolset metadata. Tool functions return ServerTool directly with toolset info.

func AssignCodingAgentPrompt added in v0.6.0

func AssignCodingAgentPrompt(t translations.TranslationHelperFunc) inventory.ServerPrompt

func AssignCopilotToIssue added in v0.4.0

func CleanTools added in v0.23.0

func CleanTools(toolNames []string) []string

CleanTools cleans tool names by removing duplicates and trimming whitespace. Validation of tool existence is done during registration.

func CompletionsHandler added in v0.24.0

func CompletionsHandler(getClient GetClientFn) func(ctx context.Context, req *mcp.CompleteRequest) (*mcp.CompleteResult, error)

func ContainsToolset added in v0.20.0

func ContainsToolset(tools []string, toCheck string) bool

func ContextWithDeps added in v0.26.0

func ContextWithDeps(ctx context.Context, deps ToolDependencies) context.Context

ContextWithDeps returns a new context with the ToolDependencies stored in it. This is used to inject dependencies at request time rather than at registration time, avoiding expensive closure creation during server initialization.

For the local server, this is called once at startup since deps don't change. For the remote server, this is called per-request with request-specific deps.

func ContextWithPollConfig added in v0.29.0

func ContextWithPollConfig(ctx context.Context, config PollConfig) context.Context

ContextWithPollConfig returns a context with polling configuration. Use this in tests to reduce or disable polling.

func CreateBranch added in v0.2.0

CreateBranch creates a tool to create a new branch.

func CreateGist added in v0.10.0

CreateGist creates a tool to create a new gist

func CreateIssue added in v0.2.0

func CreateIssue(ctx context.Context, client *github.Client, owner string, repo string, title string, body string, assignees []string, labels []string, milestoneNum int, issueType string) (*mcp.CallToolResult, error)

func CreateOrUpdateFile added in v0.2.0

CreateOrUpdateFile creates a tool to create or update a file in a GitHub repository.

func CreatePullRequest added in v0.2.0

CreatePullRequest creates a tool to create a new pull request.

func CreatePullRequestReview added in v0.2.0

func CreatePullRequestReview(ctx context.Context, client *githubv4.Client, params PullRequestReviewWriteParams) (*mcp.CallToolResult, error)

func CreateRepository added in v0.2.0

CreateRepository creates a tool to create a new GitHub repository.

func CreateToolScopeFilter added in v0.28.0

func CreateToolScopeFilter(tokenScopes []string) inventory.ToolFilter

CreateToolScopeFilter creates an inventory.ToolFilter that filters tools based on the token's OAuth scopes.

For PATs (Personal Access Tokens), we cannot issue OAuth scope challenges like we can with OAuth apps. Instead, we hide tools that require scopes the token doesn't have.

This is the recommended way to filter tools for stdio servers where the token is known at startup and won't change during the session.

The filter returns true (include tool) if:

  • The tool has no scope requirements (AcceptedScopes is empty)
  • The tool is read-only and only requires repo/public_repo scopes (works on public repos)
  • The token has at least one of the tool's accepted scopes

Example usage:

tokenScopes, err := scopes.FetchTokenScopes(ctx, token)
if err != nil {
    // Handle error - maybe skip filtering
}
filter := github.CreateToolScopeFilter(tokenScopes)
inventory := github.NewInventory(t).WithFilter(filter).Build()

func DeleteFile added in v0.3.0

DeleteFile creates a tool to delete a file in a GitHub repository. This tool uses a more roundabout way of deleting a file than just using the client.Repositories.DeleteFile. This is because REST file deletion endpoint (and client.Repositories.DeleteFile) don't add commit signing to the deletion commit, unlike how the endpoint backing the create_or_update_files tool does. This appears to be a quirk of the API. The approach implemented here gets automatic commit signing when used with either the github-actions user or as an app, both of which suit an LLM well.

func DeletePendingPullRequestReview added in v0.4.0

func DeletePendingPullRequestReview(ctx context.Context, client *githubv4.Client, params PullRequestReviewWriteParams) (*mcp.CallToolResult, error)

func DismissNotification added in v0.4.0

DismissNotification creates a tool to mark a notification as read/done.

func DynamicTools added in v0.26.0

func DynamicTools(r *inventory.Inventory) []inventory.ServerTool

DynamicTools returns the tools for dynamic toolset management. These tools allow runtime discovery and enablement of inventory. The r parameter provides the available toolset IDs for JSON Schema enums.

func EnableToolset added in v0.2.0

func EnableToolset(r *inventory.Inventory) inventory.ServerTool

EnableToolset creates a tool that enables a toolset at runtime.

func ForkRepository added in v0.2.0

ForkRepository creates a tool to fork a repository.

func GenerateToolsetsHelp added in v0.18.0

func GenerateToolsetsHelp() string

GenerateToolsetsHelp generates the help text for the toolsets flag

func GetCodeScanningAlert added in v0.2.0

func GetCommit added in v0.2.0

func GetDefaultToolsetIDs added in v0.18.0

func GetDefaultToolsetIDs() []string

GetDefaultToolsetIDs returns the IDs of toolsets marked as Default. This is a convenience function that builds an inventory to determine defaults.

func GetDependabotAlert added in v0.7.0

func GetDiscussion added in v0.7.0

func GetDiscussionComments added in v0.7.0

func GetDiscussionComments(t translations.TranslationHelperFunc) inventory.ServerTool

func GetFileContents added in v0.2.0

GetFileContents creates a tool to get the contents of a file or directory from a GitHub repository.

func GetGist added in v0.20.2

GetGist creates a tool to get the content of a gist

func GetGlobalSecurityAdvisory added in v0.13.0

func GetGlobalSecurityAdvisory(t translations.TranslationHelperFunc) inventory.ServerTool

func GetIssue added in v0.2.0

func GetIssue(ctx context.Context, client *github.Client, deps ToolDependencies, owner string, repo string, issueNumber int) (*mcp.CallToolResult, error)

func GetIssueComments added in v0.2.0

func GetIssueComments(ctx context.Context, client *github.Client, deps ToolDependencies, owner string, repo string, issueNumber int, pagination PaginationParams) (*mcp.CallToolResult, error)

func GetIssueLabels added in v0.20.0

func GetIssueLabels(ctx context.Context, client *githubv4.Client, owner string, repo string, issueNumber int) (*mcp.CallToolResult, error)

func GetLabel added in v0.18.0

GetLabel retrieves a specific label by name from a GitHub repository

func GetLabelForLabelsToolset added in v0.26.0

func GetLabelForLabelsToolset(t translations.TranslationHelperFunc) inventory.ServerTool

GetLabelForLabelsToolset returns the same GetLabel tool but registered in the labels toolset. This provides conformance with the original behavior where get_label was in both toolsets.

func GetLatestRelease added in v0.12.0

GetLatestRelease creates a tool to get the latest release in a GitHub repository.

func GetMe added in v0.2.0

GetMe creates a tool to get details of the authenticated user.

func GetNotificationDetails added in v0.4.0

func GetNotificationDetails(t translations.TranslationHelperFunc) inventory.ServerTool

GetNotificationDetails creates a tool to get details for a specific notification.

func GetPullRequest added in v0.2.0

func GetPullRequest(ctx context.Context, client *github.Client, deps ToolDependencies, owner, repo string, pullNumber int) (*mcp.CallToolResult, error)

func GetPullRequestCheckRuns added in v0.32.0

func GetPullRequestCheckRuns(ctx context.Context, client *github.Client, owner, repo string, pullNumber int, pagination PaginationParams) (*mcp.CallToolResult, error)

func GetPullRequestDiff added in v0.4.0

func GetPullRequestDiff(ctx context.Context, client *github.Client, owner, repo string, pullNumber int) (*mcp.CallToolResult, error)

func GetPullRequestFiles added in v0.2.0

func GetPullRequestFiles(ctx context.Context, client *github.Client, owner, repo string, pullNumber int, pagination PaginationParams) (*mcp.CallToolResult, error)

func GetPullRequestReviewComments added in v0.15.0

func GetPullRequestReviewComments(ctx context.Context, gqlClient *githubv4.Client, deps ToolDependencies, owner, repo string, pullNumber int, pagination CursorPaginationParams) (*mcp.CallToolResult, error)

func GetPullRequestReviews added in v0.2.0

func GetPullRequestReviews(ctx context.Context, client *github.Client, deps ToolDependencies, owner, repo string, pullNumber int) (*mcp.CallToolResult, error)

func GetPullRequestStatus added in v0.2.0

func GetPullRequestStatus(ctx context.Context, client *github.Client, owner, repo string, pullNumber int) (*mcp.CallToolResult, error)

func GetReleaseByTag added in v0.13.0

func GetRepositoryResourceBranchContent added in v0.2.0

func GetRepositoryResourceBranchContent(t translations.TranslationHelperFunc) inventory.ServerResourceTemplate

GetRepositoryResourceBranchContent defines the resource template for getting repository content for a branch.

func GetRepositoryResourceCommitContent added in v0.2.0

func GetRepositoryResourceCommitContent(t translations.TranslationHelperFunc) inventory.ServerResourceTemplate

GetRepositoryResourceCommitContent defines the resource template for getting repository content for a commit.

func GetRepositoryResourceContent added in v0.2.0

GetRepositoryResourceContent defines the resource template for getting repository content.

func GetRepositoryResourcePrContent added in v0.2.0

func GetRepositoryResourcePrContent(t translations.TranslationHelperFunc) inventory.ServerResourceTemplate

GetRepositoryResourcePrContent defines the resource template for getting repository content for a pull request.

func GetRepositoryResourceTagContent added in v0.2.0

func GetRepositoryResourceTagContent(t translations.TranslationHelperFunc) inventory.ServerResourceTemplate

GetRepositoryResourceTagContent defines the resource template for getting repository content for a tag.

func GetRepositoryTree added in v0.21.0

GetRepositoryTree creates a tool to get the tree structure of a GitHub repository.

func GetSecretScanningAlert added in v0.2.0

func GetSecretScanningAlert(t translations.TranslationHelperFunc) inventory.ServerTool

func GetSubIssues added in v0.20.0

func GetSubIssues(ctx context.Context, client *github.Client, deps ToolDependencies, owner string, repo string, issueNumber int, pagination PaginationParams) (*mcp.CallToolResult, error)

func GetTag added in v0.3.0

GetTag creates a tool to get details about a specific tag in a GitHub repository.

func GetTeamMembers added in v0.12.0

func GetTeams added in v0.12.0

func GetToolsetsTools added in v0.2.0

func GetToolsetsTools(r *inventory.Inventory) inventory.ServerTool

GetToolsetsTools creates a tool that lists all tools in a specific toolset.

func GetUIAsset added in v0.31.0

func GetUIAsset(name string) (string, error)

GetUIAsset reads a UI asset from the embedded filesystem. The name should be just the filename (e.g., "get-me.html").

func GranularAddPullRequestReviewComment added in v0.33.1

func GranularAddPullRequestReviewComment(t translations.TranslationHelperFunc) inventory.ServerTool

GranularAddPullRequestReviewComment creates a tool to add a review comment.

func GranularAddSubIssue added in v0.33.1

GranularAddSubIssue creates a tool to add a sub-issue.

func GranularCreateIssue added in v0.33.1

GranularCreateIssue creates a tool to create a new issue.

func GranularCreatePullRequestReview added in v0.33.1

func GranularCreatePullRequestReview(t translations.TranslationHelperFunc) inventory.ServerTool

GranularCreatePullRequestReview creates a tool to create a PR review.

func GranularDeletePendingPullRequestReview added in v0.33.1

func GranularDeletePendingPullRequestReview(t translations.TranslationHelperFunc) inventory.ServerTool

GranularDeletePendingPullRequestReview creates a tool to delete a pending review.

func GranularRemoveSubIssue added in v0.33.1

func GranularRemoveSubIssue(t translations.TranslationHelperFunc) inventory.ServerTool

GranularRemoveSubIssue creates a tool to remove a sub-issue.

func GranularReprioritizeSubIssue added in v0.33.1

func GranularReprioritizeSubIssue(t translations.TranslationHelperFunc) inventory.ServerTool

GranularReprioritizeSubIssue creates a tool to reorder a sub-issue.

func GranularRequestPullRequestReviewers added in v0.33.1

func GranularRequestPullRequestReviewers(t translations.TranslationHelperFunc) inventory.ServerTool

GranularRequestPullRequestReviewers creates a tool to request reviewers.

func GranularResolveReviewThread added in v0.33.1

func GranularResolveReviewThread(t translations.TranslationHelperFunc) inventory.ServerTool

GranularResolveReviewThread creates a tool to resolve a review thread.

func GranularSetIssueFields added in v1.0.0

func GranularSetIssueFields(t translations.TranslationHelperFunc) inventory.ServerTool

GranularSetIssueFields creates a tool to set issue field values on an issue using GraphQL.

func GranularSubmitPendingPullRequestReview added in v0.33.1

func GranularSubmitPendingPullRequestReview(t translations.TranslationHelperFunc) inventory.ServerTool

GranularSubmitPendingPullRequestReview creates a tool to submit a pending review.

func GranularUnresolveReviewThread added in v0.33.1

func GranularUnresolveReviewThread(t translations.TranslationHelperFunc) inventory.ServerTool

GranularUnresolveReviewThread creates a tool to unresolve a review thread.

func GranularUpdateIssueAssignees added in v0.33.1

func GranularUpdateIssueAssignees(t translations.TranslationHelperFunc) inventory.ServerTool

GranularUpdateIssueAssignees creates a tool to update an issue's assignees.

func GranularUpdateIssueBody added in v0.33.1

func GranularUpdateIssueBody(t translations.TranslationHelperFunc) inventory.ServerTool

GranularUpdateIssueBody creates a tool to update an issue's body.

func GranularUpdateIssueLabels added in v0.33.1

func GranularUpdateIssueLabels(t translations.TranslationHelperFunc) inventory.ServerTool

GranularUpdateIssueLabels creates a tool to update an issue's labels.

func GranularUpdateIssueMilestone added in v0.33.1

func GranularUpdateIssueMilestone(t translations.TranslationHelperFunc) inventory.ServerTool

GranularUpdateIssueMilestone creates a tool to update an issue's milestone.

func GranularUpdateIssueState added in v0.33.1

func GranularUpdateIssueState(t translations.TranslationHelperFunc) inventory.ServerTool

GranularUpdateIssueState creates a tool to update an issue's state.

func GranularUpdateIssueTitle added in v0.33.1

func GranularUpdateIssueTitle(t translations.TranslationHelperFunc) inventory.ServerTool

GranularUpdateIssueTitle creates a tool to update an issue's title.

func GranularUpdateIssueType added in v0.33.1

func GranularUpdateIssueType(t translations.TranslationHelperFunc) inventory.ServerTool

GranularUpdateIssueType creates a tool to update an issue's type.

func GranularUpdatePullRequestBody added in v0.33.1

func GranularUpdatePullRequestBody(t translations.TranslationHelperFunc) inventory.ServerTool

GranularUpdatePullRequestBody creates a tool to update a PR's body.

func GranularUpdatePullRequestDraftState added in v0.33.1

func GranularUpdatePullRequestDraftState(t translations.TranslationHelperFunc) inventory.ServerTool

GranularUpdatePullRequestDraftState creates a tool to toggle draft state.

func GranularUpdatePullRequestState added in v0.33.1

func GranularUpdatePullRequestState(t translations.TranslationHelperFunc) inventory.ServerTool

GranularUpdatePullRequestState creates a tool to update a PR's state.

func GranularUpdatePullRequestTitle added in v0.33.1

func GranularUpdatePullRequestTitle(t translations.TranslationHelperFunc) inventory.ServerTool

GranularUpdatePullRequestTitle creates a tool to update a PR's title.

func HeaderAllowedFeatureFlags added in v1.0.0

func HeaderAllowedFeatureFlags() []string

HeaderAllowedFeatureFlags returns the feature flags that clients may enable via the X-MCP-Features header. It delegates to AllowedFeatureFlags as the single source of truth.

func InjectDepsMiddleware added in v0.31.0

func InjectDepsMiddleware(deps ToolDependencies) mcp.Middleware

func IssueRead added in v0.20.0

IssueRead creates a tool to get details of a specific issue in a GitHub repository.

func IssueToFixWorkflowPrompt added in v0.10.0

func IssueToFixWorkflowPrompt(t translations.TranslationHelperFunc) inventory.ServerPrompt

IssueToFixWorkflowPrompt provides a guided workflow for creating an issue and then generating a PR to fix it

func IssueWrite added in v0.20.0

func LabelWrite added in v0.18.0

LabelWrite handles create, update, and delete operations for GitHub labels

func ListAvailableToolsets added in v0.2.0

func ListAvailableToolsets() inventory.ServerTool

ListAvailableToolsets creates a tool that lists all available inventory.

func ListBranches added in v0.2.0

ListBranches creates a tool to list branches in a GitHub repository.

func ListCodeScanningAlerts added in v0.2.0

func ListCodeScanningAlerts(t translations.TranslationHelperFunc) inventory.ServerTool

func ListCommits added in v0.2.0

ListCommits creates a tool to get commits of a branch in a repository.

func ListDependabotAlerts added in v0.7.0

func ListDiscussionCategories added in v0.7.0

func ListDiscussionCategories(t translations.TranslationHelperFunc) inventory.ServerTool

func ListDiscussions added in v0.7.0

func ListGists added in v0.10.0

ListGists creates a tool to list gists for a user

func ListGlobalSecurityAdvisories added in v0.13.0

func ListGlobalSecurityAdvisories(t translations.TranslationHelperFunc) inventory.ServerTool

func ListIssueTypes added in v0.12.0

ListIssueTypes creates a tool to list defined issue types for an organization. This can be used to understand supported issue type values for creating or updating issues.

func ListIssues added in v0.2.0

ListIssues creates a tool to list and filter repository issues

func ListLabels added in v0.18.0

ListLabels lists labels from a repository

func ListNotifications added in v0.4.0

ListNotifications creates a tool to list notifications for the current user.

func ListOrgRepositorySecurityAdvisories added in v0.13.0

func ListOrgRepositorySecurityAdvisories(t translations.TranslationHelperFunc) inventory.ServerTool

func ListPullRequests added in v0.2.0

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

func ListReleases added in v0.12.0

ListReleases creates a tool to list releases in a GitHub repository.

func ListRepositorySecurityAdvisories added in v0.13.0

func ListRepositorySecurityAdvisories(t translations.TranslationHelperFunc) inventory.ServerTool

func ListSecretScanningAlerts added in v0.2.0

func ListSecretScanningAlerts(t translations.TranslationHelperFunc) inventory.ServerTool

func ListStarredRepositories added in v0.16.0

func ListStarredRepositories(t translations.TranslationHelperFunc) inventory.ServerTool

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

func ListTags added in v0.3.0

ListTags creates a tool to list tags in a GitHub repository.

func ManageNotificationSubscription added in v0.4.0

func ManageNotificationSubscription(t translations.TranslationHelperFunc) inventory.ServerTool

ManageNotificationSubscription creates a tool to manage a notification subscription (ignore, watch, delete)

func ManageRepositoryNotificationSubscription added in v0.4.0

func ManageRepositoryNotificationSubscription(t translations.TranslationHelperFunc) inventory.ServerTool

ManageRepositoryNotificationSubscription creates a tool to manage a repository notification subscription (ignore, watch, delete)

func MarkAllNotificationsRead added in v0.4.0

func MarkAllNotificationsRead(t translations.TranslationHelperFunc) inventory.ServerTool

MarkAllNotificationsRead creates a tool to mark all notifications as read.

func MarshalledTextResult added in v0.5.0

func MarshalledTextResult(v any) *mcp.CallToolResult

func MergePullRequest added in v0.2.0

MergePullRequest creates a tool to merge a pull request.

func MustGetUIAsset added in v0.31.0

func MustGetUIAsset(name string) string

MustGetUIAsset reads a UI asset and panics if it fails. Use this when the asset is required for server operation.

func NewDynamicTool added in v0.26.0

func NewDynamicTool(toolset inventory.ToolsetMetadata, tool mcp.Tool, handler func(deps DynamicToolDependencies) mcp.ToolHandlerFor[map[string]any, any]) inventory.ServerTool

NewDynamicTool creates a ServerTool with fully-typed DynamicToolDependencies. Dynamic tools use a different dependency structure (DynamicToolDependencies) than regular tools (ToolDependencies), so they intentionally use the closure pattern.

func NewInventory added in v0.26.0

NewInventory creates an Inventory with all available tools, resources, and prompts. Tools, resources, and prompts are self-describing with their toolset metadata embedded. This function is stateless - no dependencies are captured. Handlers are generated on-demand during registration via RegisterAll(ctx, server, deps). The "default" keyword in WithToolsets will expand to toolsets marked with Default: true.

func NewMCPServer added in v0.31.0

func NewMCPServer(ctx context.Context, cfg *MCPServerConfig, deps ToolDependencies, inv *inventory.Inventory, middleware ...mcp.Middleware) (*mcp.Server, error)

func NewServer

func NewServer(version, name, title string, opts *mcp.ServerOptions) *mcp.Server

NewServer creates a new GitHub MCP server with the given version, server name, display title, and options. If name or title are empty the defaults "github-mcp-server" and "GitHub MCP Server" are used.

func NewTool added in v0.26.0

func NewTool[In, Out any](
	toolset inventory.ToolsetMetadata,
	tool mcp.Tool,
	requiredScopes []scopes.Scope,
	handler func(ctx context.Context, deps ToolDependencies, req *mcp.CallToolRequest, args In) (*mcp.CallToolResult, Out, error),
) inventory.ServerTool

NewTool creates a ServerTool that retrieves ToolDependencies from context at call time. This avoids creating closures at registration time, which is important for performance in servers that create a new server instance per request (like the remote server).

The handler function receives deps extracted from context via MustDepsFromContext. Ensure ContextWithDeps is called to inject deps before any tool handlers are invoked.

requiredScopes specifies the minimum OAuth scopes needed for this tool. AcceptedScopes are automatically derived using the scope hierarchy (e.g., if public_repo is required, repo is also accepted since repo grants public_repo).

func NewToolFromHandler added in v0.26.0

func NewToolFromHandler(
	toolset inventory.ToolsetMetadata,
	tool mcp.Tool,
	requiredScopes []scopes.Scope,
	handler func(ctx context.Context, deps ToolDependencies, req *mcp.CallToolRequest) (*mcp.CallToolResult, error),
) inventory.ServerTool

NewToolFromHandler creates a ServerTool that retrieves ToolDependencies from context at call time. Use this when you have a handler that conforms to mcp.ToolHandler directly.

The handler function receives deps extracted from context via MustDepsFromContext. Ensure ContextWithDeps is called to inject deps before any tool handlers are invoked.

requiredScopes specifies the minimum OAuth scopes needed for this tool. AcceptedScopes are automatically derived using the scope hierarchy.

func OptionalBigIntArrayParam added in v0.20.2

func OptionalBigIntArrayParam(args map[string]any, p string) ([]int64, error)

OptionalBigIntArrayParam is a helper function that can be used to fetch a requested parameter from the request. It does the following checks: 1. Checks if the parameter is present in the request, if not, it returns an empty slice 2. If it is present, iterates the elements, checks each is a string, and converts them to int64 values

func OptionalBoolParamWithDefault added in v0.14.0

func OptionalBoolParamWithDefault(args map[string]any, p string, d bool) (bool, error)

OptionalBoolParamWithDefault is a helper function that can be used to fetch a requested parameter from the request similar to optionalBoolParam, but it also takes a default value.

func OptionalIntParam added in v0.2.0

func OptionalIntParam(args map[string]any, p string) (int, error)

OptionalIntParam is a helper function that can be used to fetch a requested parameter from the request. It does the following checks: 1. Checks if the parameter is present in the request, if not, it returns its zero-value 2. If it is present, it checks if the parameter is of the expected type (float64 or numeric string) and returns it

func OptionalIntParamWithDefault added in v0.2.0

func OptionalIntParamWithDefault(args map[string]any, p string, d int) (int, error)

OptionalIntParamWithDefault is a helper function that can be used to fetch a requested parameter from the request similar to optionalIntParam, but it also takes a default value.

func OptionalParam added in v0.2.0

func OptionalParam[T any](args map[string]any, p string) (T, error)

OptionalParam is a helper function that can be used to fetch a requested parameter from the request. It does the following checks: 1. Checks if the parameter is present in the request, if not, it returns its zero-value 2. If it is present, it checks if the parameter is of the expected type and returns it

func OptionalParamOK added in v0.2.0

func OptionalParamOK[T any, A map[string]any](args A, p string) (value T, ok bool, err error)

OptionalParamOK is a helper function that can be used to fetch a requested parameter from the request. It returns the value, a boolean indicating if the parameter was present, and an error if the type is wrong.

func OptionalStringArrayParam added in v0.2.0

func OptionalStringArrayParam(args map[string]any, p string) ([]string, error)

OptionalStringArrayParam is a helper function that can be used to fetch a requested parameter from the request. It does the following checks: 1. Checks if the parameter is present in the request, if not, it returns its zero-value 2. If it is present, iterates the elements and checks each is a string

func ProjectsGet added in v0.28.0

ProjectsGet returns the tool and handler for getting GitHub Projects resources.

func ProjectsList added in v0.28.0

ProjectsList returns the tool and handler for listing GitHub Projects resources.

func ProjectsWrite added in v0.28.0

ProjectsWrite returns the tool and handler for modifying GitHub Projects resources.

func PullRequestRead added in v0.18.0

PullRequestRead creates a tool to get details of a specific pull request.

func PullRequestReviewWrite added in v0.19.0

func PullRequestReviewWrite(t translations.TranslationHelperFunc) inventory.ServerTool

func PushFiles added in v0.2.0

PushFiles creates a tool to push multiple files in a single commit to a GitHub repository.

func RegisterUIResources added in v0.31.0

func RegisterUIResources(s *mcp.Server)

RegisterUIResources registers MCP App UI resources with the server. These are static resources (not templates) that serve HTML content for MCP App-enabled tools. The HTML is built from React/Primer components in the ui/ directory using `script/build-ui`.

func RemoteOnlyToolsets added in v0.26.0

func RemoteOnlyToolsets() []inventory.ToolsetMetadata

RemoteOnlyToolsets returns toolset metadata for toolsets that are only available in the remote MCP server. These are documented but not registered in the local server.

func RemoveSubIssue added in v0.9.0

func RemoveSubIssue(ctx context.Context, client *github.Client, owner string, repo string, issueNumber int, subIssueID int) (*mcp.CallToolResult, error)

func RemoveToolset added in v0.20.0

func RemoveToolset(tools []string, toRemove string) []string

func RepositoryResourceCompletionHandler added in v0.24.0

func RepositoryResourceCompletionHandler(getClient GetClientFn) func(ctx context.Context, req *mcp.CompleteRequest) (*mcp.CompleteResult, error)

RepositoryResourceCompletionHandler returns a CompletionHandlerFunc for repository resource completions.

func RepositoryResourceContentsHandler added in v0.2.0

func RepositoryResourceContentsHandler(resourceURITemplate *uritemplate.Template) mcp.ResourceHandler

RepositoryResourceContentsHandler returns a handler function for repository content requests. It retrieves ToolDependencies from the context at call time via MustDepsFromContext.

func ReprioritizeSubIssue added in v0.9.0

func ReprioritizeSubIssue(ctx context.Context, client *github.Client, owner string, repo string, issueNumber int, subIssueID int, afterID int, beforeID int) (*mcp.CallToolResult, error)

func RequestCopilotReview added in v0.3.0

RequestCopilotReview creates a tool to request a Copilot review for a pull request. Note that this tool will not work on GHES where this feature is unsupported. In future, we should not expose this tool if the configured host does not support it.

func RequiredBigInt added in v0.20.2

func RequiredBigInt(args map[string]any, p string) (int64, error)

RequiredBigInt is a helper function that can be used to fetch a requested parameter from the request. It does the following checks: 1. Checks if the parameter is present in the request. 2. Checks if the parameter is of the expected type (float64 or numeric string). 3. Checks if the parameter is not empty, i.e: non-zero value. 4. Validates that the float64 value can be safely converted to int64 without truncation.

func RequiredInt added in v0.2.0

func RequiredInt(args map[string]any, p string) (int, error)

RequiredInt is a helper function that can be used to fetch a requested parameter from the request. It does the following checks: 1. Checks if the parameter is present in the request. 2. Checks if the parameter is of the expected type (float64 or numeric string). 3. Checks if the parameter is not empty, i.e: non-zero value

func RequiredParam added in v0.5.0

func RequiredParam[T comparable](args map[string]any, p string) (T, error)

RequiredParam is a helper function that can be used to fetch a requested parameter from the request. It does the following checks: 1. Checks if the parameter is present in the request. 2. Checks if the parameter is of the expected type. 3. Checks if the parameter is not empty, i.e: non-zero value

func ResolveFeatureFlags added in v1.0.0

func ResolveFeatureFlags(enabledFeatures []string, insidersMode bool) map[string]bool

ResolveFeatureFlags computes the effective set of enabled feature flags by:

  1. Taking explicitly enabled features (from CLI flags or HTTP headers)
  2. Adding insiders-expanded features when insiders mode is active
  3. Validating all features against the AllowedFeatureFlags allowlist

Returns a set (map) for O(1) lookup by the feature checker.

func ResolveReviewThread added in v0.33.1

func ResolveReviewThread(ctx context.Context, client *githubv4.Client, threadID string, resolve bool) (*mcp.CallToolResult, error)

ResolveReviewThread resolves or unresolves a PR review thread using GraphQL mutations.

func ResolvedEnabledToolsets added in v0.31.0

func ResolvedEnabledToolsets(dynamicToolsets bool, enabledToolsets []string, enabledTools []string) []string

ResolvedEnabledToolsets determines which toolsets should be enabled based on config. Returns nil for "use defaults", empty slice for "none", or explicit list.

func SearchCode added in v0.2.0

SearchCode creates a tool to search for code across GitHub repositories.

func SearchIssues added in v0.2.0

SearchIssues creates a tool to search for issues.

func SearchOrgs added in v0.6.0

SearchOrgs creates a tool to search for GitHub organizations.

func SearchPullRequests added in v0.6.0

SearchPullRequests creates a tool to search for pull requests.

func SearchRepositories added in v0.2.0

SearchRepositories creates a tool to search for GitHub repositories.

func SearchUsers added in v0.2.0

SearchUsers creates a tool to search for GitHub users.

func StarRepository added in v0.16.0

StarRepository creates a tool to star a repository.

func SubIssueWrite added in v0.20.0

SubIssueWrite creates a tool to add a sub-issue to a parent issue.

func SubmitPendingPullRequestReview added in v0.4.0

func SubmitPendingPullRequestReview(ctx context.Context, client *githubv4.Client, params PullRequestReviewWriteParams) (*mcp.CallToolResult, error)

func ToBoolPtr added in v0.5.0

func ToBoolPtr(b bool) *bool

ToBoolPtr converts a bool to a *bool pointer.

func ToStringPtr added in v0.7.0

func ToStringPtr(s string) *string

ToStringPtr converts a string to a *string pointer. Returns nil if the string is empty.

func UIAssetsAvailable added in v0.31.0

func UIAssetsAvailable() bool

UIAssetsAvailable returns true if the MCP App UI assets have been built. This checks for a known UI asset file to determine if `script/build-ui` has been run. Use this to gracefully skip UI registration when assets aren't available, allowing Insiders mode to work for non-UI features without requiring a UI build.

func UnstarRepository added in v0.16.0

UnstarRepository creates a tool to unstar a repository.

func UpdateGist added in v0.10.0

UpdateGist creates a tool to edit an existing gist

func UpdateIssue added in v0.2.0

func UpdateIssue(ctx context.Context, client *github.Client, gqlClient *githubv4.Client, owner string, repo string, issueNumber int, title string, body string, assignees []string, labels []string, milestoneNum int, issueType string, state string, stateReason string, duplicateOf int) (*mcp.CallToolResult, error)

func UpdatePullRequest added in v0.2.0

UpdatePullRequest creates a tool to update an existing pull request.

func UpdatePullRequestBranch added in v0.2.0

func UpdatePullRequestBranch(t translations.TranslationHelperFunc) inventory.ServerTool

UpdatePullRequestBranch creates a tool to update a pull request branch with the latest changes from the base branch.

func WithCursorPagination added in v0.9.0

func WithCursorPagination(schema *jsonschema.Schema) *jsonschema.Schema

WithCursorPagination adds only cursor-based pagination parameters to a tool (no page parameter).

func WithPagination added in v0.2.0

func WithPagination(schema *jsonschema.Schema) *jsonschema.Schema

WithPagination adds REST API pagination parameters to a tool. https://docs.github.com/en/rest/using-the-rest-api/using-pagination-in-the-rest-api

func WithUnifiedPagination added in v0.9.0

func WithUnifiedPagination(schema *jsonschema.Schema) *jsonschema.Schema

WithUnifiedPagination adds REST API pagination parameters to a tool. GraphQL tools will use this and convert page/perPage to GraphQL cursor parameters internally.

Types

type AddCommentToPendingReviewParams added in v0.33.1

type AddCommentToPendingReviewParams struct {
	Owner       string
	Repo        string
	PullNumber  int32
	Path        string
	Body        string
	SubjectType string
	Line        *int32
	Side        *string
	StartLine   *int32
	StartSide   *string
}

AddCommentToPendingReviewParams contains the parameters for adding a comment to a pending review.

type AgentAssignmentInput added in v0.28.1

type AgentAssignmentInput struct {
	BaseRef            *githubv4.String `json:"baseRef,omitempty"`
	CustomAgent        *githubv4.String `json:"customAgent,omitempty"`
	CustomInstructions *githubv4.String `json:"customInstructions,omitempty"`
	TargetRepositoryID githubv4.ID      `json:"targetRepositoryId"`
}

AgentAssignmentInput represents the input for assigning an agent to an issue.

type BaseDeps added in v0.26.0

type BaseDeps struct {
	// Pre-created clients
	Client    *gogithub.Client
	GQLClient *githubv4.Client
	RawClient *raw.Client

	// Static dependencies
	RepoAccessCache   *lockdown.RepoAccessCache
	T                 translations.TranslationHelperFunc
	Flags             FeatureFlags
	ContentWindowSize int

	// Observability exporters (includes logger)
	Obsv observability.Exporters
	// contains filtered or unexported fields
}

BaseDeps is the standard implementation of ToolDependencies for the local server. It stores pre-created clients. The remote server can create its own struct implementing ToolDependencies with different client creation strategies.

func NewBaseDeps added in v0.26.0

func NewBaseDeps(
	client *gogithub.Client,
	gqlClient *githubv4.Client,
	rawClient *raw.Client,
	repoAccessCache *lockdown.RepoAccessCache,
	t translations.TranslationHelperFunc,
	flags FeatureFlags,
	contentWindowSize int,
	featureChecker inventory.FeatureFlagChecker,
	obsv observability.Exporters,
) *BaseDeps

NewBaseDeps creates a BaseDeps with the provided clients and configuration.

func (BaseDeps) GetClient added in v0.26.0

func (d BaseDeps) GetClient(_ context.Context) (*gogithub.Client, error)

GetClient implements ToolDependencies.

func (BaseDeps) GetContentWindowSize added in v0.26.0

func (d BaseDeps) GetContentWindowSize() int

GetContentWindowSize implements ToolDependencies.

func (BaseDeps) GetFlags added in v0.26.0

func (d BaseDeps) GetFlags(_ context.Context) FeatureFlags

GetFlags implements ToolDependencies.

func (BaseDeps) GetGQLClient added in v0.26.0

func (d BaseDeps) GetGQLClient(_ context.Context) (*githubv4.Client, error)

GetGQLClient implements ToolDependencies.

func (BaseDeps) GetRawClient added in v0.26.0

func (d BaseDeps) GetRawClient(_ context.Context) (*raw.Client, error)

GetRawClient implements ToolDependencies.

func (BaseDeps) GetRepoAccessCache added in v0.26.0

func (d BaseDeps) GetRepoAccessCache(_ context.Context) (*lockdown.RepoAccessCache, error)

GetRepoAccessCache implements ToolDependencies.

func (BaseDeps) GetT added in v0.26.0

GetT implements ToolDependencies.

func (BaseDeps) IsFeatureEnabled added in v0.29.0

func (d BaseDeps) IsFeatureEnabled(ctx context.Context, flagName string) bool

IsFeatureEnabled checks if a feature flag is enabled. Returns false if the feature checker is nil, flag name is empty, or an error occurs. This allows tools to conditionally change behavior based on feature flags.

func (BaseDeps) Logger added in v0.33.1

func (d BaseDeps) Logger(_ context.Context) *slog.Logger

Logger implements ToolDependencies.

func (BaseDeps) Metrics added in v0.33.1

func (d BaseDeps) Metrics(ctx context.Context) metrics.Metrics

Metrics implements ToolDependencies.

type BasicNoOrder added in v0.9.0

type BasicNoOrder struct {
	Repository struct {
		Discussions DiscussionFragment `graphql:"discussions(first: $first, after: $after)"`
	} `graphql:"repository(owner: $owner, name: $repo)"`
}

func (*BasicNoOrder) GetDiscussionFragment added in v0.9.0

func (q *BasicNoOrder) GetDiscussionFragment() DiscussionFragment

Implement the interface for all query types

type BasicWithOrder added in v0.9.0

type BasicWithOrder struct {
	Repository struct {
		Discussions DiscussionFragment `graphql:"discussions(first: $first, after: $after, orderBy: { field: $orderByField, direction: $orderByDirection })"`
	} `graphql:"repository(owner: $owner, name: $repo)"`
}

func (*BasicWithOrder) GetDiscussionFragment added in v0.9.0

func (q *BasicWithOrder) GetDiscussionFragment() DiscussionFragment

type CloseIssueInput added in v0.15.0

type CloseIssueInput struct {
	IssueID          githubv4.ID             `json:"issueId"`
	ClientMutationID *githubv4.String        `json:"clientMutationId,omitempty"`
	StateReason      *IssueClosedStateReason `json:"stateReason,omitempty"`
	DuplicateIssueID *githubv4.ID            `json:"duplicateIssueId,omitempty"`
}

CloseIssueInput represents the input for closing an issue via the GraphQL API. Used to extend the functionality of the githubv4 library to support closing issues as duplicates.

type CompleteHandler added in v0.24.0

type CompleteHandler func(ctx context.Context, client *github.Client, resolved map[string]string, argValue string) ([]string, error)

CompleteHandler defines function signature for completion handlers

type CreateProjectV2StatusUpdateInput added in v0.31.0

type CreateProjectV2StatusUpdateInput struct {
	ProjectID        githubv4.ID      `json:"projectId"`
	Body             *githubv4.String `json:"body,omitempty"`
	Status           *githubv4.String `json:"status,omitempty"`
	StartDate        *githubv4.String `json:"startDate,omitempty"`
	TargetDate       *githubv4.String `json:"targetDate,omitempty"`
	ClientMutationID *githubv4.String `json:"clientMutationId,omitempty"`
}

CreateProjectV2StatusUpdateInput is the input for the createProjectV2StatusUpdate mutation. Defined locally because the shurcooL/githubv4 library does not include this type.

type CursorPaginationParams added in v0.9.0

type CursorPaginationParams struct {
	PerPage int
	After   string
}

func OptionalCursorPaginationParams added in v0.9.0

func OptionalCursorPaginationParams(args map[string]any) (CursorPaginationParams, error)

OptionalCursorPaginationParams returns the "perPage" and "after" parameters from the request, without the "page" parameter, suitable for cursor-based pagination only.

func (CursorPaginationParams) ToGraphQLParams added in v0.9.0

func (p CursorPaginationParams) ToGraphQLParams() (*GraphQLPaginationParams, error)

ToGraphQLParams converts cursor pagination parameters to GraphQL-specific parameters.

type DiscussionFragment added in v0.9.0

type DiscussionFragment struct {
	Nodes      []NodeFragment
	PageInfo   PageInfoFragment
	TotalCount githubv4.Int
}

type DiscussionQueryResult added in v0.9.0

type DiscussionQueryResult interface {
	GetDiscussionFragment() DiscussionFragment
}

Common interface for all discussion query types

type DynamicToolDependencies added in v0.26.0

type DynamicToolDependencies struct {
	// Server is the MCP server to register tools with
	Server *mcp.Server
	// Inventory contains all available tools, resources and prompts that can be enabled dynamically
	Inventory *inventory.Inventory
	// ToolDeps are the dependencies passed to tools when they are registered
	ToolDeps any
	// T is the translation helper function
	T translations.TranslationHelperFunc
}

DynamicToolDependencies contains dependencies for dynamic toolset management tools. It includes the managed Inventory, the server for registration, and the deps that will be passed to tools when they are dynamically enabled.

type FeatureFlags added in v0.21.0

type FeatureFlags struct {
	LockdownMode bool
	InsidersMode bool
}

FeatureFlags defines runtime feature toggles that adjust tool behavior.

type GetClientFn added in v0.2.0

type GetClientFn func(context.Context) (*github.Client, error)

type GetGQLClientFn added in v0.4.0

type GetGQLClientFn func(context.Context) (*githubv4.Client, error)

type GraphQLPaginationParams added in v0.9.0

type GraphQLPaginationParams struct {
	First *int32
	After *string
}

type IssueClosedStateReason added in v0.15.0

type IssueClosedStateReason string

IssueClosedStateReason represents the reason an issue was closed. Used to extend the functionality of the githubv4 library to support closing issues as duplicates.

const (
	IssueClosedStateReasonCompleted  IssueClosedStateReason = "COMPLETED"
	IssueClosedStateReasonDuplicate  IssueClosedStateReason = "DUPLICATE"
	IssueClosedStateReasonNotPlanned IssueClosedStateReason = "NOT_PLANNED"
)

type IssueFieldCreateOrUpdateInput added in v1.0.0

type IssueFieldCreateOrUpdateInput struct {
	FieldID              githubv4.ID       `json:"fieldId"`
	TextValue            *githubv4.String  `json:"textValue,omitempty"`
	NumberValue          *githubv4.Float   `json:"numberValue,omitempty"`
	DateValue            *githubv4.String  `json:"dateValue,omitempty"`
	SingleSelectOptionID *githubv4.ID      `json:"singleSelectOptionId,omitempty"`
	Delete               *githubv4.Boolean `json:"delete,omitempty"`
}

IssueFieldCreateOrUpdateInput represents a single field value to set on an issue.

type IssueFragment added in v0.11.0

type IssueFragment struct {
	Number     githubv4.Int
	Title      githubv4.String
	Body       githubv4.String
	State      githubv4.String
	DatabaseID int64

	Author struct {
		Login githubv4.String
	}
	CreatedAt githubv4.DateTime
	UpdatedAt githubv4.DateTime
	Labels    struct {
		Nodes []struct {
			Name        githubv4.String
			ID          githubv4.String
			Description githubv4.String
		}
	} `graphql:"labels(first: 100)"`
	Comments struct {
		TotalCount githubv4.Int
	} `graphql:"comments"`
}

IssueFragment represents a fragment of an issue node in the GraphQL API.

type IssueQueryFragment added in v0.11.0

type IssueQueryFragment struct {
	Nodes    []IssueFragment `graphql:"nodes"`
	PageInfo struct {
		HasNextPage     githubv4.Boolean
		HasPreviousPage githubv4.Boolean
		StartCursor     githubv4.String
		EndCursor       githubv4.String
	}
	TotalCount int
}

type IssueQueryResult added in v0.11.0

type IssueQueryResult interface {
	GetIssueFragment() IssueQueryFragment
}

Common interface for all issue query types

type ListIssuesQuery added in v0.11.0

type ListIssuesQuery struct {
	Repository struct {
		Issues IssueQueryFragment `graphql:"issues(first: $first, after: $after, states: $states, orderBy: {field: $orderBy, direction: $direction})"`
	} `graphql:"repository(owner: $owner, name: $repo)"`
}

ListIssuesQuery is the root query structure for fetching issues with optional label filtering.

func (*ListIssuesQuery) GetIssueFragment added in v0.11.0

func (q *ListIssuesQuery) GetIssueFragment() IssueQueryFragment

type ListIssuesQueryTypeWithLabels added in v0.11.0

type ListIssuesQueryTypeWithLabels struct {
	Repository struct {
		Issues IssueQueryFragment `` /* 131-byte string literal not displayed */
	} `graphql:"repository(owner: $owner, name: $repo)"`
}

ListIssuesQueryTypeWithLabels is the query structure for fetching issues with optional label filtering.

func (*ListIssuesQueryTypeWithLabels) GetIssueFragment added in v0.11.0

func (q *ListIssuesQueryTypeWithLabels) GetIssueFragment() IssueQueryFragment

Implement the interface for all query types

type ListIssuesQueryTypeWithLabelsWithSince added in v0.11.0

type ListIssuesQueryTypeWithLabelsWithSince struct {
	Repository struct {
		Issues IssueQueryFragment `` /* 158-byte string literal not displayed */
	} `graphql:"repository(owner: $owner, name: $repo)"`
}

ListIssuesQueryTypeWithLabelsWithSince is the query structure for fetching issues with both label and since filtering.

func (*ListIssuesQueryTypeWithLabelsWithSince) GetIssueFragment added in v0.11.0

type ListIssuesQueryWithSince added in v0.11.0

type ListIssuesQueryWithSince struct {
	Repository struct {
		Issues IssueQueryFragment `` /* 141-byte string literal not displayed */
	} `graphql:"repository(owner: $owner, name: $repo)"`
}

ListIssuesQueryWithSince is the query structure for fetching issues without label filtering but with since filtering.

func (*ListIssuesQueryWithSince) GetIssueFragment added in v0.11.0

func (q *ListIssuesQueryWithSince) GetIssueFragment() IssueQueryFragment

type MCPServerConfig added in v0.31.0

type MCPServerConfig struct {
	// Version of the server
	Version string

	// GitHub Host to target for API requests (e.g. github.com or github.enterprise.com)
	Host string

	// GitHub Token to authenticate with the GitHub API
	Token string

	// EnabledToolsets is a list of toolsets to enable
	// See: https://github.com/github/github-mcp-server?tab=readme-ov-file#tool-configuration
	EnabledToolsets []string

	// EnabledTools is a list of specific tools to enable (additive to toolsets)
	// When specified, these tools are registered in addition to any specified toolset tools
	EnabledTools []string

	// EnabledFeatures is a list of feature flags that are enabled
	// Items with FeatureFlagEnable matching an entry in this list will be available
	EnabledFeatures []string

	// Whether to enable dynamic toolsets
	// See: https://github.com/github/github-mcp-server?tab=readme-ov-file#dynamic-tool-discovery
	DynamicToolsets bool

	// ReadOnly indicates if we should only offer read-only tools
	ReadOnly bool

	// Translator provides translated text for the server tooling
	Translator translations.TranslationHelperFunc

	// Content window size
	ContentWindowSize int

	// LockdownMode indicates if we should enable lockdown mode
	LockdownMode bool

	// InsidersMode indicates if we should enable experimental features
	InsidersMode bool

	// Logger is used for logging within the server
	Logger *slog.Logger
	// RepoAccessTTL overrides the default TTL for repository access cache entries.
	RepoAccessTTL *time.Duration

	// ExcludeTools is a list of tool names that should be disabled regardless of
	// other configuration. These tools will be excluded even if their toolset is enabled
	// or they are explicitly listed in EnabledTools.
	ExcludeTools []string

	// TokenScopes contains the OAuth scopes available to the token.
	// When non-nil, tools requiring scopes not in this list will be hidden.
	// This is used for PAT scope filtering where we can't issue scope challenges.
	TokenScopes []string

	// Additional server options to apply
	ServerOptions []MCPServerOption
}

type MCPServerOption added in v0.31.0

type MCPServerOption func(*mcp.ServerOptions)

type MinimalBranch added in v0.14.0

type MinimalBranch struct {
	Name      string `json:"name"`
	SHA       string `json:"sha"`
	Protected bool   `json:"protected"`
}

MinimalBranch is the trimmed output type for branch objects.

type MinimalCheckRun added in v0.32.0

type MinimalCheckRun struct {
	ID          int64  `json:"id"`
	Name        string `json:"name"`
	Status      string `json:"status"`
	Conclusion  string `json:"conclusion,omitempty"`
	HTMLURL     string `json:"html_url,omitempty"`
	DetailsURL  string `json:"details_url,omitempty"`
	StartedAt   string `json:"started_at,omitempty"`
	CompletedAt string `json:"completed_at,omitempty"`
}

MinimalCheckRun is the trimmed output type for check run objects.

type MinimalCheckRunsResult added in v0.32.0

type MinimalCheckRunsResult struct {
	TotalCount int               `json:"total_count"`
	CheckRuns  []MinimalCheckRun `json:"check_runs"`
}

MinimalCheckRunsResult is the trimmed output type for check runs list results.

type MinimalCommit added in v0.14.0

type MinimalCommit struct {
	SHA       string              `json:"sha"`
	HTMLURL   string              `json:"html_url"`
	Commit    *MinimalCommitInfo  `json:"commit,omitempty"`
	Author    *MinimalUser        `json:"author,omitempty"`
	Committer *MinimalUser        `json:"committer,omitempty"`
	Stats     *MinimalCommitStats `json:"stats,omitempty"`
	Files     []MinimalCommitFile `json:"files,omitempty"`
}

MinimalCommit is the trimmed output type for commit objects.

type MinimalCommitAuthor added in v0.14.0

type MinimalCommitAuthor struct {
	Name  string `json:"name,omitempty"`
	Email string `json:"email,omitempty"`
	Date  string `json:"date,omitempty"`
}

MinimalCommitAuthor represents commit author information.

type MinimalCommitFile added in v0.14.0

type MinimalCommitFile struct {
	Filename  string `json:"filename"`
	Status    string `json:"status,omitempty"`
	Additions int    `json:"additions,omitempty"`
	Deletions int    `json:"deletions,omitempty"`
	Changes   int    `json:"changes,omitempty"`
}

MinimalCommitFile represents a file changed in a commit.

type MinimalCommitInfo added in v0.14.0

type MinimalCommitInfo struct {
	Message   string               `json:"message"`
	Author    *MinimalCommitAuthor `json:"author,omitempty"`
	Committer *MinimalCommitAuthor `json:"committer,omitempty"`
}

MinimalCommitInfo represents core commit information.

type MinimalCommitStats added in v0.14.0

type MinimalCommitStats struct {
	Additions int `json:"additions,omitempty"`
	Deletions int `json:"deletions,omitempty"`
	Total     int `json:"total,omitempty"`
}

MinimalCommitStats represents commit statistics.

type MinimalFileCommit added in v0.31.0

type MinimalFileCommit struct {
	SHA     string               `json:"sha"`
	Message string               `json:"message,omitempty"`
	HTMLURL string               `json:"html_url,omitempty"`
	Author  *MinimalCommitAuthor `json:"author,omitempty"`
}

MinimalFileCommit is the trimmed commit portion of a file operation response.

type MinimalFileContent added in v0.31.0

type MinimalFileContent struct {
	Name    string `json:"name"`
	Path    string `json:"path"`
	SHA     string `json:"sha"`
	Size    int    `json:"size,omitempty"`
	HTMLURL string `json:"html_url"`
}

MinimalFileContent is the trimmed content portion of a file operation response.

type MinimalFileContentResponse added in v0.31.0

type MinimalFileContentResponse struct {
	Content *MinimalFileContent `json:"content,omitempty"`
	Commit  *MinimalFileCommit  `json:"commit,omitempty"`
}

MinimalFileContentResponse is the trimmed output type for create/update/delete file responses.

type MinimalIssue added in v0.31.0

type MinimalIssue struct {
	Number            int               `json:"number"`
	Title             string            `json:"title"`
	Body              string            `json:"body,omitempty"`
	State             string            `json:"state"`
	StateReason       string            `json:"state_reason,omitempty"`
	Draft             bool              `json:"draft,omitempty"`
	Locked            bool              `json:"locked,omitempty"`
	HTMLURL           string            `json:"html_url,omitempty"`
	User              *MinimalUser      `json:"user,omitempty"`
	AuthorAssociation string            `json:"author_association,omitempty"`
	Labels            []string          `json:"labels,omitempty"`
	Assignees         []string          `json:"assignees,omitempty"`
	Milestone         string            `json:"milestone,omitempty"`
	Comments          int               `json:"comments,omitempty"`
	Reactions         *MinimalReactions `json:"reactions,omitempty"`
	CreatedAt         string            `json:"created_at,omitempty"`
	UpdatedAt         string            `json:"updated_at,omitempty"`
	ClosedAt          string            `json:"closed_at,omitempty"`
	ClosedBy          string            `json:"closed_by,omitempty"`
	IssueType         string            `json:"issue_type,omitempty"`
}

MinimalIssue is the trimmed output type for issue objects to reduce verbosity.

type MinimalIssueComment added in v0.31.0

type MinimalIssueComment struct {
	ID                int64             `json:"id"`
	Body              string            `json:"body,omitempty"`
	HTMLURL           string            `json:"html_url"`
	User              *MinimalUser      `json:"user,omitempty"`
	AuthorAssociation string            `json:"author_association,omitempty"`
	Reactions         *MinimalReactions `json:"reactions,omitempty"`
	CreatedAt         string            `json:"created_at,omitempty"`
	UpdatedAt         string            `json:"updated_at,omitempty"`
}

MinimalIssueComment is the trimmed output type for issue comment objects to reduce verbosity.

type MinimalIssuesResponse added in v0.32.0

type MinimalIssuesResponse struct {
	Issues     []MinimalIssue  `json:"issues"`
	TotalCount int             `json:"totalCount"`
	PageInfo   MinimalPageInfo `json:"pageInfo"`
}

MinimalIssuesResponse is the trimmed output for a paginated list of issues.

type MinimalPRBranch added in v0.31.0

type MinimalPRBranch struct {
	Ref  string               `json:"ref"`
	SHA  string               `json:"sha"`
	Repo *MinimalPRBranchRepo `json:"repo,omitempty"`
}

MinimalPRBranch is the trimmed output type for pull request branch references.

type MinimalPRBranchRepo added in v0.31.0

type MinimalPRBranchRepo struct {
	FullName    string `json:"full_name"`
	Description string `json:"description,omitempty"`
}

MinimalPRBranchRepo is the trimmed repo info nested inside a PR branch.

type MinimalPRFile added in v0.32.0

type MinimalPRFile struct {
	Filename         string `json:"filename"`
	Status           string `json:"status,omitempty"`
	Additions        int    `json:"additions,omitempty"`
	Deletions        int    `json:"deletions,omitempty"`
	Changes          int    `json:"changes,omitempty"`
	Patch            string `json:"patch,omitempty"`
	PreviousFilename string `json:"previous_filename,omitempty"`
}

MinimalPRFile represents a file changed in a pull request. Compared to MinimalCommitFile, it includes the patch diff and previous filename for renames.

type MinimalPageInfo added in v0.32.0

type MinimalPageInfo struct {
	HasNextPage     bool   `json:"hasNextPage"`
	HasPreviousPage bool   `json:"hasPreviousPage"`
	StartCursor     string `json:"startCursor,omitempty"`
	EndCursor       string `json:"endCursor,omitempty"`
}

MinimalPageInfo contains pagination cursor information.

type MinimalProject added in v0.17.0

type MinimalProject struct {
	ID               *int64            `json:"id,omitempty"`
	NodeID           *string           `json:"node_id,omitempty"`
	Owner            *MinimalUser      `json:"owner,omitempty"`
	Creator          *MinimalUser      `json:"creator,omitempty"`
	Title            *string           `json:"title,omitempty"`
	Description      *string           `json:"description,omitempty"`
	Public           *bool             `json:"public,omitempty"`
	ClosedAt         *github.Timestamp `json:"closed_at,omitempty"`
	CreatedAt        *github.Timestamp `json:"created_at,omitempty"`
	UpdatedAt        *github.Timestamp `json:"updated_at,omitempty"`
	DeletedAt        *github.Timestamp `json:"deleted_at,omitempty"`
	Number           *int              `json:"number,omitempty"`
	ShortDescription *string           `json:"short_description,omitempty"`
	DeletedBy        *MinimalUser      `json:"deleted_by,omitempty"`
	OwnerType        string            `json:"owner_type,omitempty"`
}

type MinimalProjectStatusUpdate added in v0.31.0

type MinimalProjectStatusUpdate struct {
	ID         string       `json:"id"`
	Body       string       `json:"body,omitempty"`
	Status     string       `json:"status,omitempty"`
	CreatedAt  string       `json:"created_at,omitempty"`
	StartDate  string       `json:"start_date,omitempty"`
	TargetDate string       `json:"target_date,omitempty"`
	Creator    *MinimalUser `json:"creator,omitempty"`
}

type MinimalPullRequest added in v0.31.0

type MinimalPullRequest struct {
	Number             int              `json:"number"`
	Title              string           `json:"title"`
	Body               string           `json:"body,omitempty"`
	State              string           `json:"state"`
	Draft              bool             `json:"draft"`
	Merged             bool             `json:"merged"`
	MergeableState     string           `json:"mergeable_state,omitempty"`
	HTMLURL            string           `json:"html_url"`
	User               *MinimalUser     `json:"user,omitempty"`
	Labels             []string         `json:"labels,omitempty"`
	Assignees          []string         `json:"assignees,omitempty"`
	RequestedReviewers []string         `json:"requested_reviewers,omitempty"`
	MergedBy           string           `json:"merged_by,omitempty"`
	Head               *MinimalPRBranch `json:"head,omitempty"`
	Base               *MinimalPRBranch `json:"base,omitempty"`
	Additions          int              `json:"additions,omitempty"`
	Deletions          int              `json:"deletions,omitempty"`
	ChangedFiles       int              `json:"changed_files,omitempty"`
	Commits            int              `json:"commits,omitempty"`
	Comments           int              `json:"comments,omitempty"`
	CreatedAt          string           `json:"created_at,omitempty"`
	UpdatedAt          string           `json:"updated_at,omitempty"`
	ClosedAt           string           `json:"closed_at,omitempty"`
	MergedAt           string           `json:"merged_at,omitempty"`
	Milestone          string           `json:"milestone,omitempty"`
}

MinimalPullRequest is the trimmed output type for pull request objects to reduce verbosity.

type MinimalPullRequestReview added in v0.32.0

type MinimalPullRequestReview struct {
	ID                int64        `json:"id"`
	State             string       `json:"state"`
	Body              string       `json:"body,omitempty"`
	HTMLURL           string       `json:"html_url"`
	User              *MinimalUser `json:"user,omitempty"`
	CommitID          string       `json:"commit_id,omitempty"`
	SubmittedAt       string       `json:"submitted_at,omitempty"`
	AuthorAssociation string       `json:"author_association,omitempty"`
}

MinimalPullRequestReview is the trimmed output type for pull request review objects to reduce verbosity.

type MinimalReactions added in v0.31.0

type MinimalReactions struct {
	TotalCount int `json:"total_count"`
	PlusOne    int `json:"+1"`
	MinusOne   int `json:"-1"`
	Laugh      int `json:"laugh"`
	Confused   int `json:"confused"`
	Heart      int `json:"heart"`
	Hooray     int `json:"hooray"`
	Rocket     int `json:"rocket"`
	Eyes       int `json:"eyes"`
}

MinimalReactions is the trimmed output type for reaction summaries, dropping the API URL.

type MinimalRelease added in v0.14.0

type MinimalRelease struct {
	ID          int64        `json:"id"`
	TagName     string       `json:"tag_name"`
	Name        string       `json:"name,omitempty"`
	Body        string       `json:"body,omitempty"`
	HTMLURL     string       `json:"html_url"`
	PublishedAt string       `json:"published_at,omitempty"`
	Prerelease  bool         `json:"prerelease"`
	Draft       bool         `json:"draft"`
	Author      *MinimalUser `json:"author,omitempty"`
}

MinimalRelease is the trimmed output type for release objects.

type MinimalRepository added in v0.14.0

type MinimalRepository struct {
	ID            int64    `json:"id"`
	Name          string   `json:"name"`
	FullName      string   `json:"full_name"`
	Description   string   `json:"description,omitempty"`
	HTMLURL       string   `json:"html_url"`
	Language      string   `json:"language,omitempty"`
	Stars         int      `json:"stargazers_count"`
	Forks         int      `json:"forks_count"`
	OpenIssues    int      `json:"open_issues_count"`
	UpdatedAt     string   `json:"updated_at,omitempty"`
	CreatedAt     string   `json:"created_at,omitempty"`
	Topics        []string `json:"topics,omitempty"`
	Private       bool     `json:"private"`
	Fork          bool     `json:"fork"`
	Archived      bool     `json:"archived"`
	DefaultBranch string   `json:"default_branch,omitempty"`
}

MinimalRepository is the trimmed output type for repository objects to reduce verbosity.

type MinimalResponse added in v0.14.0

type MinimalResponse struct {
	ID  string `json:"id"`
	URL string `json:"url"`
}

MinimalResponse represents a minimal response for all CRUD operations. Success is implicit in the HTTP response status, and all other information can be derived from the URL or fetched separately if needed.

type MinimalReviewComment added in v0.32.0

type MinimalReviewComment struct {
	Body      string `json:"body,omitempty"`
	Path      string `json:"path"`
	Line      *int   `json:"line,omitempty"`
	Author    string `json:"author,omitempty"`
	CreatedAt string `json:"created_at,omitempty"`
	UpdatedAt string `json:"updated_at,omitempty"`
	HTMLURL   string `json:"html_url"`
}

MinimalReviewComment is the trimmed output type for PR review comment objects.

type MinimalReviewThread added in v0.32.0

type MinimalReviewThread struct {
	IsResolved  bool                   `json:"is_resolved"`
	IsOutdated  bool                   `json:"is_outdated"`
	IsCollapsed bool                   `json:"is_collapsed"`
	Comments    []MinimalReviewComment `json:"comments"`
	TotalCount  int                    `json:"total_count"`
}

MinimalReviewThread is the trimmed output type for PR review thread objects.

type MinimalReviewThreadsResponse added in v0.32.0

type MinimalReviewThreadsResponse struct {
	ReviewThreads []MinimalReviewThread `json:"review_threads"`
	TotalCount    int                   `json:"totalCount"`
	PageInfo      MinimalPageInfo       `json:"pageInfo"`
}

MinimalReviewThreadsResponse is the trimmed output for a paginated list of PR review threads.

type MinimalSearchRepositoriesResult added in v0.14.0

type MinimalSearchRepositoriesResult struct {
	TotalCount        int                 `json:"total_count"`
	IncompleteResults bool                `json:"incomplete_results"`
	Items             []MinimalRepository `json:"items"`
}

MinimalSearchRepositoriesResult is the trimmed output type for repository search results.

type MinimalSearchUsersResult added in v0.5.0

type MinimalSearchUsersResult struct {
	TotalCount        int           `json:"total_count"`
	IncompleteResults bool          `json:"incomplete_results"`
	Items             []MinimalUser `json:"items"`
}

MinimalSearchUsersResult is the trimmed output type for user search results.

type MinimalTag added in v0.32.0

type MinimalTag struct {
	Name string `json:"name"`
	SHA  string `json:"sha"`
}

MinimalTag is the trimmed output type for tag objects.

type MinimalUser added in v0.5.0

type MinimalUser struct {
	Login      string       `json:"login"`
	ID         int64        `json:"id,omitempty"`
	ProfileURL string       `json:"profile_url,omitempty"`
	AvatarURL  string       `json:"avatar_url,omitempty"`
	Details    *UserDetails `json:"details,omitempty"` // Optional field for additional user details
}

MinimalUser is the output type for user and organization search results.

type NodeFragment added in v0.9.0

type NodeFragment struct {
	Number         githubv4.Int
	Title          githubv4.String
	CreatedAt      githubv4.DateTime
	UpdatedAt      githubv4.DateTime
	Closed         githubv4.Boolean
	IsAnswered     githubv4.Boolean
	AnswerChosenAt *githubv4.DateTime
	Author         struct {
		Login githubv4.String
	}
	Category struct {
		Name githubv4.String
	} `graphql:"category"`
	URL githubv4.String `graphql:"url"`
}

type OrganizationTeams added in v0.12.0

type OrganizationTeams struct {
	Org   string     `json:"org"`
	Teams []TeamInfo `json:"teams"`
}

type PageInfoFragment added in v0.9.0

type PageInfoFragment struct {
	HasNextPage     bool
	HasPreviousPage bool
	StartCursor     githubv4.String
	EndCursor       githubv4.String
}

type PaginationParams added in v0.2.0

type PaginationParams struct {
	Page    int
	PerPage int
	After   string
}

func OptionalPaginationParams added in v0.2.0

func OptionalPaginationParams(args map[string]any) (PaginationParams, error)

OptionalPaginationParams returns the "page", "perPage", and "after" parameters from the request, or their default values if not present, "page" default is 1, "perPage" default is 30. In future, we may want to make the default values configurable, or even have this function returned from `withPagination`, where the defaults are provided alongside the min/max values.

func (PaginationParams) ToGraphQLParams added in v0.9.0

func (p PaginationParams) ToGraphQLParams() (*GraphQLPaginationParams, error)

ToGraphQLParams converts REST API pagination parameters to GraphQL-specific parameters. This converts page/perPage to first parameter for GraphQL queries. If After is provided, it takes precedence over page-based pagination.

type PollConfig added in v0.29.0

type PollConfig struct {
	MaxAttempts int
	Delay       time.Duration
}

PollConfig configures the PR polling behavior.

type PullRequestReviewWriteParams added in v0.19.0

type PullRequestReviewWriteParams struct {
	Method     string
	Owner      string
	Repo       string
	PullNumber int32
	Body       string
	Event      string
	CommitID   *string
	ThreadID   string
}

type ReplaceActorsForAssignableInput added in v0.4.0

type ReplaceActorsForAssignableInput struct {
	AssignableID githubv4.ID   `json:"assignableId"`
	ActorIDs     []githubv4.ID `json:"actorIds"`
}

type RequestDeps added in v0.31.0

type RequestDeps struct {
	RepoAccessOpts    []lockdown.RepoAccessOption
	T                 translations.TranslationHelperFunc
	ContentWindowSize int
	// contains filtered or unexported fields
}

func NewRequestDeps added in v0.31.0

func NewRequestDeps(
	apiHosts utils.APIHostResolver,
	version string,
	lockdownMode bool,
	repoAccessOpts []lockdown.RepoAccessOption,
	t translations.TranslationHelperFunc,
	contentWindowSize int,
	featureChecker inventory.FeatureFlagChecker,
	obsv observability.Exporters,
) *RequestDeps

NewRequestDeps creates a RequestDeps with the provided clients and configuration.

func (*RequestDeps) GetClient added in v0.31.0

func (d *RequestDeps) GetClient(ctx context.Context) (*gogithub.Client, error)

GetClient implements ToolDependencies.

func (*RequestDeps) GetContentWindowSize added in v0.31.0

func (d *RequestDeps) GetContentWindowSize() int

GetContentWindowSize implements ToolDependencies.

func (*RequestDeps) GetFlags added in v0.31.0

func (d *RequestDeps) GetFlags(ctx context.Context) FeatureFlags

GetFlags implements ToolDependencies.

func (*RequestDeps) GetGQLClient added in v0.31.0

func (d *RequestDeps) GetGQLClient(ctx context.Context) (*githubv4.Client, error)

GetGQLClient implements ToolDependencies.

func (*RequestDeps) GetRawClient added in v0.31.0

func (d *RequestDeps) GetRawClient(ctx context.Context) (*raw.Client, error)

GetRawClient implements ToolDependencies.

func (*RequestDeps) GetRepoAccessCache added in v0.31.0

func (d *RequestDeps) GetRepoAccessCache(ctx context.Context) (*lockdown.RepoAccessCache, error)

GetRepoAccessCache implements ToolDependencies.

func (*RequestDeps) GetT added in v0.31.0

GetT implements ToolDependencies.

func (*RequestDeps) IsFeatureEnabled added in v0.31.0

func (d *RequestDeps) IsFeatureEnabled(ctx context.Context, flagName string) bool

IsFeatureEnabled checks if a feature flag is enabled.

func (*RequestDeps) Logger added in v0.33.1

func (d *RequestDeps) Logger(_ context.Context) *slog.Logger

Logger implements ToolDependencies.

func (*RequestDeps) Metrics added in v0.33.1

func (d *RequestDeps) Metrics(ctx context.Context) metrics.Metrics

Metrics implements ToolDependencies.

type SetIssueFieldValueInput added in v1.0.0

type SetIssueFieldValueInput struct {
	IssueID          githubv4.ID                     `json:"issueId"`
	IssueFields      []IssueFieldCreateOrUpdateInput `json:"issueFields"`
	ClientMutationID *githubv4.String                `json:"clientMutationId,omitempty"`
}

SetIssueFieldValueInput represents the input for the setIssueFieldValue GraphQL mutation.

type TeamInfo added in v0.12.0

type TeamInfo struct {
	Name        string `json:"name"`
	Slug        string `json:"slug"`
	Description string `json:"description"`
}

type ToolDependencies added in v0.26.0

type ToolDependencies interface {
	// GetClient returns a GitHub REST API client
	GetClient(ctx context.Context) (*gogithub.Client, error)

	// GetGQLClient returns a GitHub GraphQL client
	GetGQLClient(ctx context.Context) (*githubv4.Client, error)

	// GetRawClient returns a raw content client for GitHub
	GetRawClient(ctx context.Context) (*raw.Client, error)

	// GetRepoAccessCache returns the lockdown mode repo access cache
	GetRepoAccessCache(ctx context.Context) (*lockdown.RepoAccessCache, error)

	// GetT returns the translation helper function
	GetT() translations.TranslationHelperFunc

	// GetFlags returns feature flags
	GetFlags(ctx context.Context) FeatureFlags

	// GetContentWindowSize returns the content window size for log truncation
	GetContentWindowSize() int

	// IsFeatureEnabled checks if a feature flag is enabled.
	IsFeatureEnabled(ctx context.Context, flagName string) bool

	// Logger returns the structured logger, optionally enriched with
	// request-scoped data from ctx. Integrators provide their own slog.Handler
	// to control where logs are sent.
	Logger(ctx context.Context) *slog.Logger

	// Metrics returns the metrics client
	Metrics(ctx context.Context) metrics.Metrics
}

ToolDependencies defines the interface for dependencies that tool handlers need. This is an interface to allow different implementations:

  • Local server: stores closures that create clients on demand
  • Remote server: can store pre-created clients per-request for efficiency

The toolsets package uses `any` for deps and tool handlers type-assert to this interface.

func DepsFromContext added in v0.26.0

func DepsFromContext(ctx context.Context) (ToolDependencies, bool)

DepsFromContext retrieves ToolDependencies from the context. Returns the deps and true if found, or nil and false if not present. Use MustDepsFromContext if you want to panic on missing deps (for handlers that require deps to function).

func MustDepsFromContext added in v0.26.0

func MustDepsFromContext(ctx context.Context) ToolDependencies

MustDepsFromContext retrieves ToolDependencies from the context. Panics if deps are not found - use this in handlers where deps are required.

type TreeEntryResponse added in v0.21.0

type TreeEntryResponse struct {
	Path string `json:"path"`
	Type string `json:"type"`
	Size *int   `json:"size,omitempty"`
	Mode string `json:"mode"`
	SHA  string `json:"sha"`
	URL  string `json:"url"`
}

TreeEntryResponse represents a single entry in a Git tree.

type TreeResponse added in v0.21.0

type TreeResponse struct {
	SHA       string              `json:"sha"`
	Truncated bool                `json:"truncated"`
	Tree      []TreeEntryResponse `json:"tree"`
	TreeSHA   string              `json:"tree_sha"`
	Owner     string              `json:"owner"`
	Repo      string              `json:"repo"`
	Recursive bool                `json:"recursive"`
	Count     int                 `json:"count"`
}

TreeResponse represents the response structure for a Git tree.

type UpdateIssueInput added in v0.28.1

type UpdateIssueInput struct {
	ID              githubv4.ID           `json:"id"`
	AssigneeIDs     []githubv4.ID         `json:"assigneeIds"`
	AgentAssignment *AgentAssignmentInput `json:"agentAssignment,omitempty"`
}

UpdateIssueInput represents the input for updating an issue with agent assignment.

type UserDetails added in v0.7.0

type UserDetails struct {
	Name              string    `json:"name,omitempty"`
	Company           string    `json:"company,omitempty"`
	Blog              string    `json:"blog,omitempty"`
	Location          string    `json:"location,omitempty"`
	Email             string    `json:"email,omitempty"`
	Hireable          bool      `json:"hireable,omitempty"`
	Bio               string    `json:"bio,omitempty"`
	TwitterUsername   string    `json:"twitter_username,omitempty"`
	PublicRepos       int       `json:"public_repos"`
	PublicGists       int       `json:"public_gists"`
	Followers         int       `json:"followers"`
	Following         int       `json:"following"`
	CreatedAt         time.Time `json:"created_at"`
	UpdatedAt         time.Time `json:"updated_at"`
	PrivateGists      int       `json:"private_gists,omitempty"`
	TotalPrivateRepos int64     `json:"total_private_repos,omitempty"`
	OwnedPrivateRepos int64     `json:"owned_private_repos,omitempty"`
}

UserDetails contains additional fields about a GitHub user not already present in MinimalUser. Used by get_me context tool but omitted from search_users.

type WithCategoryAndOrder added in v0.9.0

type WithCategoryAndOrder struct {
	Repository struct {
		Discussions DiscussionFragment `` /* 141-byte string literal not displayed */
	} `graphql:"repository(owner: $owner, name: $repo)"`
}

func (*WithCategoryAndOrder) GetDiscussionFragment added in v0.9.0

func (q *WithCategoryAndOrder) GetDiscussionFragment() DiscussionFragment

type WithCategoryNoOrder added in v0.9.0

type WithCategoryNoOrder struct {
	Repository struct {
		Discussions DiscussionFragment `graphql:"discussions(first: $first, after: $after, categoryId: $categoryId)"`
	} `graphql:"repository(owner: $owner, name: $repo)"`
}

func (*WithCategoryNoOrder) GetDiscussionFragment added in v0.9.0

func (q *WithCategoryNoOrder) GetDiscussionFragment() DiscussionFragment

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL