github

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2026 License: MIT Imports: 48 Imported by: 0

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 FeatureFlagCSVOutput = "csv_output"

FeatureFlagCSVOutput is the feature flag name for CSV output on list tools.

View Source
const FeatureFlagFieldsParam = "fields_param"

FeatureFlagFieldsParam is the feature flag name for the optional `fields` parameter on selected read tools (for example search_code and get_file_contents). When enabled, those tools advertise `fields` and filter each result to the requested subset, reducing response size. It is gated so the feature can be rolled out gradually and disabled as a kill switch without a redeploy.

View Source
const FeatureFlagFileBlame = "file_blame"

FeatureFlagFileBlame is the feature flag name for the get_file_blame tool, which exposes git blame information for a file. It is gated so the extra tool is not advertised by default, keeping the tool surface small unless opted in.

View Source
const FeatureFlagIFCLabels = "ifc_labels"

FeatureFlagIFCLabels is the feature flag name for IFC security labels in tool results.

View Source
const FeatureFlagIssueDependencies = "issue_dependencies"

FeatureFlagIssueDependencies is the feature flag name for the issue dependency tools (issue_dependency_read / issue_dependency_write), which read and edit an issue's blocked-by / blocking relationships. It is gated so these tools are not advertised in the default surface, keeping the fixed tool-schema cost small unless explicitly opted in.

View Source
const GetMeUIResourceURI = "ui://omnigit-mcp/get-me"

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

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

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 PullRequestEditUIResourceURI = "ui://omnigit-mcp/pr-edit"

PullRequestEditUIResourceURI is the URI for the update_pull_request tool's MCP App UI resource.

View Source
const PullRequestWriteUIResourceURI = "ui://omnigit-mcp/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",
	}
	ToolsetMetadataCodeQuality = inventory.ToolsetMetadata{
		ID:          "code_quality",
		Description: "GitHub Code Quality related tools",
		Icon:        "code-square",
	}
	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",
	}
	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.

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

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

func ActionsGetJobLogs

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

func ActionsList

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

func ActionsRunTrigger

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

func AddCommentToPendingReview

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.6.0

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

func AddDefaultToolset(result []string) []string

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

func AddIssueComment

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

func AddReplyToPullRequestComment

func AddReplyToPullRequestComment(t translations.TranslationHelperFunc) inventory.ServerTool

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

func AddSubIssue

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

func AllPrompts

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

func AllResources

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

func AllTools

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

func CleanTools

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

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

func ContainsToolset

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

func ContextWithDeps

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

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

CreateBranch creates a tool to create a new branch.

func CreateGist

CreateGist creates a tool to create a new gist

func CreateIssue

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

func CreateOrUpdateFile

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

func CreatePullRequest

CreatePullRequest creates a tool to create a new pull request.

func CreatePullRequestReview

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

func CreateRepository

CreateRepository creates a tool to create a new GitHub repository.

func CreateToolScopeFilter

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

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

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

func DiscussionCommentWrite added in v0.6.0

func DiscussionCommentWrite(t translations.TranslationHelperFunc) inventory.ServerTool

func DismissNotification

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

func FetchProjectIsPrivate added in v0.6.0

func FetchProjectIsPrivate(ctx context.Context, client *github.Client, owner, ownerType string, projectNumber int) (bool, error)

FetchProjectIsPrivate returns whether a GitHub Project is private.

func FetchRepoIsPrivate added in v0.6.0

func FetchRepoIsPrivate(ctx context.Context, client *github.Client, owner, repo string) (bool, error)

FetchRepoIsPrivate returns whether a repository is private. It is a thin wrapper around the GitHub Repositories.Get endpoint provided as a shared helper for IFC label computation across tools.

func ForkRepository

ForkRepository creates a tool to fork a repository.

func GenerateToolsetsHelp

func GenerateToolsetsHelp() string

GenerateToolsetsHelp generates the help text for the toolsets flag

func GetCodeQualityFinding added in v0.6.0

func GetCodeQualityFinding(t translations.TranslationHelperFunc) inventory.ServerTool

func GetDefaultToolsetIDs

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 GetFileBlame added in v0.6.0

func GetFileContents

GetFileContents creates a tool to get the contents of a file or directory from a GitHub repository. It is the FeatureFlagFieldsParam-enabled variant: it advertises the optional `fields` parameter and filters directory listings to the requested subset. Both this and LegacyGetFileContents register under the tool name "get_file_contents"; exactly one is active for any given request thanks to mutually exclusive FeatureFlagEnable / FeatureFlagDisable annotations.

func GetGist

GetGist creates a tool to get the content of a gist

func GetIssue

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

func GetIssueBlockedBy added in v0.6.0

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

GetIssueBlockedBy lists the issues that block the given issue.

func GetIssueBlocking added in v0.6.0

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

GetIssueBlocking lists the issues that the given issue blocks.

func GetIssueComments

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

func GetIssueLabels

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

func GetIssueParent added in v0.6.0

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

GetIssueParent returns the parent issue of the given issue, or a null parent when the issue is not a sub-issue. It reads the GraphQL Issue.parent field, the upward counterpart to get_sub_issues.

The parent title is always sanitized (it may be cross-repo). Under lockdown mode the parent is only returned when its author has push access to the parent repo (mirroring GetIssue); otherwise it is omitted.

func GetLabel

GetLabel retrieves a specific label by name from a GitHub repository

func GetLabelForLabelsToolset

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

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

func GetMe

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

func GetNotificationDetails

func GetNotificationDetails(t translations.TranslationHelperFunc) inventory.ServerTool

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

func GetPullRequest

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

func GetPullRequestCheckRuns added in v0.6.0

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

func GetPullRequestCommits added in v0.6.0

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

func GetPullRequestDiff

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

func GetPullRequestFiles

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

func GetPullRequestReviewComments

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

func GetPullRequestReviews

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

func GetPullRequestStatus

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

func GetRepositoryResourceBranchContent

func GetRepositoryResourceBranchContent(t translations.TranslationHelperFunc) inventory.ServerResourceTemplate

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

func GetRepositoryResourceCommitContent

func GetRepositoryResourceCommitContent(t translations.TranslationHelperFunc) inventory.ServerResourceTemplate

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

func GetRepositoryResourceContent

GetRepositoryResourceContent defines the resource template for getting repository content.

func GetRepositoryResourcePrContent

func GetRepositoryResourcePrContent(t translations.TranslationHelperFunc) inventory.ServerResourceTemplate

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

func GetRepositoryResourceTagContent

func GetRepositoryResourceTagContent(t translations.TranslationHelperFunc) inventory.ServerResourceTemplate

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

func GetRepositoryTree

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

func GetSubIssues

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

func GetTag

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

func GetUIAsset

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 GranularAddIssueCommentReaction added in v0.6.0

func GranularAddIssueCommentReaction(t translations.TranslationHelperFunc) inventory.ServerTool

GranularAddIssueCommentReaction adds a reaction to an issue or pull request comment.

func GranularAddIssueReaction added in v0.6.0

func GranularAddIssueReaction(t translations.TranslationHelperFunc) inventory.ServerTool

GranularAddIssueReaction adds a reaction to an issue or pull request.

func GranularAddPullRequestReviewComment added in v0.6.0

func GranularAddPullRequestReviewComment(t translations.TranslationHelperFunc) inventory.ServerTool

GranularAddPullRequestReviewComment creates a tool to add a review comment.

func GranularAddPullRequestReviewCommentReaction added in v0.6.0

func GranularAddPullRequestReviewCommentReaction(t translations.TranslationHelperFunc) inventory.ServerTool

GranularAddPullRequestReviewCommentReaction adds a reaction to a pull request review comment.

func GranularAddSubIssue added in v0.6.0

GranularAddSubIssue creates a tool to add a sub-issue.

func GranularCreateIssue added in v0.6.0

GranularCreateIssue creates a tool to create a new issue.

func GranularCreatePullRequestReview added in v0.6.0

func GranularCreatePullRequestReview(t translations.TranslationHelperFunc) inventory.ServerTool

GranularCreatePullRequestReview creates a tool to create a PR review.

func GranularDeletePendingPullRequestReview added in v0.6.0

func GranularDeletePendingPullRequestReview(t translations.TranslationHelperFunc) inventory.ServerTool

GranularDeletePendingPullRequestReview creates a tool to delete a pending review.

func GranularRemoveSubIssue added in v0.6.0

func GranularRemoveSubIssue(t translations.TranslationHelperFunc) inventory.ServerTool

GranularRemoveSubIssue creates a tool to remove a sub-issue.

func GranularReprioritizeSubIssue added in v0.6.0

func GranularReprioritizeSubIssue(t translations.TranslationHelperFunc) inventory.ServerTool

GranularReprioritizeSubIssue creates a tool to reorder a sub-issue.

func GranularRequestPullRequestReviewers added in v0.6.0

func GranularRequestPullRequestReviewers(t translations.TranslationHelperFunc) inventory.ServerTool

GranularRequestPullRequestReviewers creates a tool to request reviewers.

func GranularResolveReviewThread added in v0.6.0

func GranularResolveReviewThread(t translations.TranslationHelperFunc) inventory.ServerTool

GranularResolveReviewThread creates a tool to resolve a review thread.

func GranularSetIssueFields added in v0.6.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.6.0

func GranularSubmitPendingPullRequestReview(t translations.TranslationHelperFunc) inventory.ServerTool

GranularSubmitPendingPullRequestReview creates a tool to submit a pending review.

func GranularUnresolveReviewThread added in v0.6.0

func GranularUnresolveReviewThread(t translations.TranslationHelperFunc) inventory.ServerTool

GranularUnresolveReviewThread creates a tool to unresolve a review thread.

func GranularUpdateIssueAssignees added in v0.6.0

func GranularUpdateIssueAssignees(t translations.TranslationHelperFunc) inventory.ServerTool

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

func GranularUpdateIssueBody added in v0.6.0

func GranularUpdateIssueBody(t translations.TranslationHelperFunc) inventory.ServerTool

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

func GranularUpdateIssueLabels added in v0.6.0

func GranularUpdateIssueLabels(t translations.TranslationHelperFunc) inventory.ServerTool

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

func GranularUpdateIssueMilestone added in v0.6.0

func GranularUpdateIssueMilestone(t translations.TranslationHelperFunc) inventory.ServerTool

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

func GranularUpdateIssueState added in v0.6.0

func GranularUpdateIssueState(t translations.TranslationHelperFunc) inventory.ServerTool

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

func GranularUpdateIssueTitle added in v0.6.0

func GranularUpdateIssueTitle(t translations.TranslationHelperFunc) inventory.ServerTool

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

func GranularUpdateIssueType added in v0.6.0

func GranularUpdateIssueType(t translations.TranslationHelperFunc) inventory.ServerTool

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

func GranularUpdatePullRequestBody added in v0.6.0

func GranularUpdatePullRequestBody(t translations.TranslationHelperFunc) inventory.ServerTool

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

func GranularUpdatePullRequestDraftState added in v0.6.0

func GranularUpdatePullRequestDraftState(t translations.TranslationHelperFunc) inventory.ServerTool

GranularUpdatePullRequestDraftState creates a tool to toggle draft state.

func GranularUpdatePullRequestState added in v0.6.0

func GranularUpdatePullRequestState(t translations.TranslationHelperFunc) inventory.ServerTool

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

func GranularUpdatePullRequestTitle added in v0.6.0

func GranularUpdatePullRequestTitle(t translations.TranslationHelperFunc) inventory.ServerTool

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

func HeaderAllowedFeatureFlags added in v0.6.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

func InjectDepsMiddleware(deps ToolDependencies) mcp.Middleware

func IssueCommentWrite

IssueCommentWrite creates a tool to update or delete an issue comment.

func IssueDependencyRead added in v0.6.0

IssueDependencyRead creates a tool to read an issue's blocked-by and blocking relationships. It is a separate, feature-flagged tool (rather than a method on the default issue_read) so the whole dependency capability can be gated as a unit without enlarging the default issue tool surface.

func IssueDependencyWrite added in v0.6.0

IssueDependencyWrite creates a tool to add or remove an issue dependency (blocked-by / blocking) relationship. The REST dependency endpoints are always expressed as "the blocked issue is blocked_by the blocking issue", so both directions are served by the same endpoint pair with the two issues swapped.

func IssueRead

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

func IssueToFixWorkflowPrompt

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

IssueWrite is the FeatureFlagIssueFields-enabled variant of issue_write (with the issue_fields parameter). LegacyIssueWrite is served when the flag is off. Both register under the tool name "issue_write"; exactly one is active at a time via mutually exclusive feature-flag annotations. When the flag is removed, delete LegacyIssueWrite outright and drop the feature-flag fields on IssueWrite.

func LabelWrite

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

func LegacyGetFileContents added in v0.6.0

func LegacyGetFileContents(t translations.TranslationHelperFunc) inventory.ServerTool

LegacyGetFileContents is the FeatureFlagFieldsParam-disabled variant of get_file_contents. It exposes the original schema (no `fields` parameter) and never filters directory listings, so it acts as the kill switch when the flag is off. It owns the canonical get_file_contents.snap; the flag-enabled variant owns get_file_contents_ff_<flag>.snap. Delete this function when the flag is removed.

func LegacyListCommits added in v0.6.0

LegacyListCommits is the FeatureFlagFieldsParam-disabled variant of list_commits. It exposes the original schema (no `fields` parameter) and never filters results, so it acts as the kill switch when the flag is off. It owns the canonical list_commits.snap; the flag-enabled variant owns list_commits_ff_<flag>.snap. Delete this function when the flag is removed.

func LegacyListIssues added in v0.6.0

LegacyListIssues is the FeatureFlagFieldsParam-disabled variant of list_issues. It exposes the original schema (no `fields` parameter) and never filters results, so it acts as the kill switch when the flag is off. It owns the canonical list_issues.snap; the flag-enabled variant owns list_issues_ff_<flag>.snap. Delete this function when the flag is removed.

func LegacyListPullRequests added in v0.6.0

func LegacyListPullRequests(t translations.TranslationHelperFunc) inventory.ServerTool

LegacyListPullRequests is the FeatureFlagFieldsParam-disabled variant of list_pull_requests. It exposes the original schema (no `fields` parameter) and never filters results, so it acts as the kill switch when the flag is off. It owns the canonical list_pull_requests.snap; the flag-enabled variant owns list_pull_requests_ff_<flag>.snap. Delete this function when the flag is removed.

func LegacyListReleases added in v0.6.0

LegacyListReleases is the FeatureFlagFieldsParam-disabled variant of list_releases. It exposes the original schema (no `fields` parameter) and never filters results, so it acts as the kill switch when the flag is off. It owns the canonical list_releases.snap; the flag-enabled variant owns list_releases_ff_<flag>.snap. Delete this function when the flag is removed.

func LegacySearchCode added in v0.6.0

LegacySearchCode is the FeatureFlagFieldsParam-disabled variant of search_code. It exposes the original schema (no `fields` parameter) and never filters results, so it acts as the kill switch when the flag is off. It owns the canonical search_code.snap; the flag-enabled variant owns search_code_ff_<flag>.snap. Delete this function when the flag is removed.

func LegacySearchIssues added in v0.6.0

LegacySearchIssues is the FeatureFlagFieldsParam-disabled variant of search_issues. It exposes the original schema (no `fields` parameter) and never filters results, so it acts as the kill switch when the flag is off. It owns the canonical search_issues.snap; the flag-enabled variant owns search_issues_ff_<flag>.snap. Delete this function when the flag is removed.

func LegacySearchPullRequests added in v0.6.0

func LegacySearchPullRequests(t translations.TranslationHelperFunc) inventory.ServerTool

LegacySearchPullRequests is the FeatureFlagFieldsParam-disabled variant of search_pull_requests. It exposes the original schema (no `fields` parameter) and never filters results, so it acts as the kill switch when the flag is off. It owns the canonical search_pull_requests.snap; the flag-enabled variant owns search_pull_requests_ff_<flag>.snap. Delete this function when the flag is removed.

func ListBranches

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

func ListCommits

ListCommits creates a tool to get the list of commits of a branch in a GitHub repository. It is the FeatureFlagFieldsParam-enabled variant: it advertises the optional `fields` parameter and filters each commit to the requested subset. Both this and LegacyListCommits register under the tool name "list_commits"; exactly one is active for any given request thanks to mutually exclusive FeatureFlagEnable / FeatureFlagDisable annotations.

func ListGists

ListGists creates a tool to list gists for a user

func ListIssueFields added in v0.6.0

ListIssueFields creates a tool to list issue field definitions for a repository or organization.

func ListIssueTypes

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

func ListIssues

ListIssues creates a tool to list issues in a GitHub repository. It is the FeatureFlagFieldsParam-enabled variant: it advertises the optional `fields` parameter and filters each issue to the requested subset. Both this and LegacyListIssues register under the tool name "list_issues"; exactly one is active for any given request thanks to mutually exclusive FeatureFlagEnable / FeatureFlagDisable annotations.

func ListLabels

ListLabels lists labels from a repository

func ListNotifications

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

func ListPullRequests

ListPullRequests creates a tool to list pull requests in a GitHub repository. It is the FeatureFlagFieldsParam-enabled variant: it advertises the optional `fields` parameter and filters each pull request to the requested subset. Both this and LegacyListPullRequests register under the tool name "list_pull_requests"; exactly one is active for any given request thanks to mutually exclusive FeatureFlagEnable / FeatureFlagDisable annotations.

func ListReleases

ListReleases creates a tool to list releases in a GitHub repository. It is the FeatureFlagFieldsParam-enabled variant: it advertises the optional `fields` parameter and filters each release to the requested subset. Both this and LegacyListReleases register under the tool name "list_releases"; exactly one is active for any given request thanks to mutually exclusive FeatureFlagEnable / FeatureFlagDisable annotations.

func ListRepositoryCollaborators added in v0.6.0

func ListRepositoryCollaborators(t translations.TranslationHelperFunc) inventory.ServerTool

ListRepositoryCollaborators creates a tool to list collaborators of a GitHub repository.

func ListStarredRepositories

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

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

func ManageNotificationSubscription

func ManageNotificationSubscription(t translations.TranslationHelperFunc) inventory.ServerTool

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

func ManageRepositoryNotificationSubscription

func ManageRepositoryNotificationSubscription(t translations.TranslationHelperFunc) inventory.ServerTool

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

func MarkAllNotificationsRead

func MarkAllNotificationsRead(t translations.TranslationHelperFunc) inventory.ServerTool

MarkAllNotificationsRead creates a tool to mark all notifications as read.

func MarshalledTextResult

func MarshalledTextResult(v any) *mcp.CallToolResult

func MergePullRequest

MergePullRequest creates a tool to merge a pull request.

func MustGetUIAsset

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 NewInventory

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

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 "omnigit-mcp" and "GitHub MCP Server" are used.

func NewTool

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

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

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

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

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

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

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

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

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

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

func ProjectsList

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

func ProjectsWrite

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

func PullRequestCommentWrite

func PullRequestCommentWrite(t translations.TranslationHelperFunc) inventory.ServerTool

PullRequestCommentWrite creates a tool to update or delete a pull request review comment.

func PullRequestRead

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

func PushFiles

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

func RegisterUIResources

func RegisterUIResources(s *mcp.Server, readOnly bool)

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`.

Resource metadata follows the stable 2026-01-26 MCP Apps spec: https://github.com/modelcontextprotocol/ext-apps/blob/main/specification/2026-01-26/apps.mdx

func RemoteOnlyToolsets

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

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

func RemoveToolset

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

func RepositoryResourceCompletionHandler

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

RepositoryResourceCompletionHandler returns a CompletionHandlerFunc for repository resource completions.

func RepositoryResourceContentsHandler

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

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

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

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

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

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 v0.6.0

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

ResolveFeatureFlags computes the effective set of enabled feature flags by:

  1. Taking the user-supplied flags (from --features or X-MCP-Features) and keeping only those present in AllowedFeatureFlags. Unknown or unsafe flags from request input are silently dropped here.
  2. If insiders mode is on, unioning in every flag from InsidersFeatureFlags. Insiders is a server-controlled meta switch, so its expansion is NOT re-validated against AllowedFeatureFlags.

AllowedFeatureFlags and InsidersFeatureFlags are independent sets:

  • A flag in AllowedFeatureFlags but not InsidersFeatureFlags is a regular opt-in flag that insiders mode does not turn on automatically.
  • A flag in InsidersFeatureFlags but not AllowedFeatureFlags is reachable only through insiders mode and cannot be enabled by user input.

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

func ResolveReviewThread added in v0.6.0

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

func ResolvedEnabledToolsets(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

SearchCode creates a tool to search for code across GitHub repositories. It is the FeatureFlagFieldsParam-enabled variant: it advertises the optional `fields` parameter and filters each result to the requested subset. Both this and LegacySearchCode register under the tool name "search_code"; exactly one is active for any given request thanks to mutually exclusive FeatureFlagEnable / FeatureFlagDisable annotations.

func SearchCommits added in v0.6.0

SearchCommits creates a tool to search for commits across GitHub repositories.

func SearchIssues

SearchIssues creates a tool to search for issues. It is the FeatureFlagFieldsParam-enabled variant: it advertises the optional `fields` parameter and filters each result to the requested subset. Both this and LegacySearchIssues register under the tool name "search_issues"; exactly one is active for any given request thanks to mutually exclusive FeatureFlagEnable / FeatureFlagDisable annotations.

func SearchOrgs

SearchOrgs creates a tool to search for GitHub organizations.

func SearchPullRequests

SearchPullRequests creates a tool to search for pull requests. It is the FeatureFlagFieldsParam-enabled variant: it advertises the optional `fields` parameter and filters each result to the requested subset. Both this and LegacySearchPullRequests register under the tool name "search_pull_requests"; exactly one is active for any given request thanks to mutually exclusive FeatureFlagEnable / FeatureFlagDisable annotations.

func SearchRepositories

SearchRepositories creates a tool to search for GitHub repositories.

func SearchUsers

SearchUsers creates a tool to search for GitHub users.

func StarRepository

StarRepository creates a tool to star a repository.

func SubIssueWrite

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

func SubmitPendingPullRequestReview

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

func ToStringPtr

func ToStringPtr(s string) *string

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

func UIAssetsAvailable

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 non-UI features to work without requiring a UI build.

func UIGet added in v0.6.0

UIGet creates a tool to fetch UI data for MCP Apps.

func UnstarRepository

UnstarRepository creates a tool to unstar a repository.

func UpdateGist

UpdateGist creates a tool to edit an existing gist

func UpdateIssue

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, issueFieldValues []*github.IssueRequestFieldValue, fieldIDsToDelete []int64, state string, stateReason string, duplicateOf int, opts ...UpdateIssueOptions) (*mcp.CallToolResult, error)

func UpdatePullRequest

UpdatePullRequest creates a tool to update an existing pull request.

func UpdatePullRequestBranch

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

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

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

func WithPagination

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

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.6.0

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

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

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

	// Local Git tool dependencies. These are optional so tests and remote
	// integrations that only provide GitHub clients do not need local repo access.
	GitOps    gitops.GitOperations
	RepoPaths []string
	// 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

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

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

GetClient implements ToolDependencies.

func (BaseDeps) GetContentWindowSize

func (d BaseDeps) GetContentWindowSize() int

GetContentWindowSize implements ToolDependencies.

func (BaseDeps) GetFlags

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

GetFlags implements ToolDependencies.

func (BaseDeps) GetGQLClient

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

GetGQLClient implements ToolDependencies.

func (BaseDeps) GetGitOps

func (d BaseDeps) GetGitOps() gitops.GitOperations

GetGitOps implements pkg/git.ToolDependencies.

func (BaseDeps) GetRawClient

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

GetRawClient implements ToolDependencies.

func (BaseDeps) GetRepoAccessCache

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

GetRepoAccessCache implements ToolDependencies.

func (BaseDeps) GetRepoPaths

func (d BaseDeps) GetRepoPaths() []string

GetRepoPaths implements pkg/git.ToolDependencies.

func (BaseDeps) GetT

GetT implements ToolDependencies.

func (BaseDeps) IsFeatureEnabled

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.6.0

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

Logger implements ToolDependencies.

func (BaseDeps) Metrics added in v0.6.0

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

Metrics implements ToolDependencies.

type BasicNoOrder

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

func (*BasicNoOrder) GetDiscussionFragment

func (q *BasicNoOrder) GetDiscussionFragment() DiscussionFragment

Implement the interface for all query types

type BasicWithOrder

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

func (q *BasicWithOrder) GetDiscussionFragment() DiscussionFragment

type BlameAuthor added in v0.6.0

type BlameAuthor struct {
	Name  string  `json:"name"`
	Email string  `json:"email"`
	Login *string `json:"login,omitempty"`
	URL   *string `json:"url,omitempty"`
}

BlameAuthor describes the author of a commit referenced by a BlameRange.

type BlameCommit added in v0.6.0

type BlameCommit struct {
	SHA             string      `json:"sha"`
	MessageHeadline string      `json:"message_headline"`
	CommittedDate   string      `json:"committed_date"`
	Author          BlameAuthor `json:"author"`
}

BlameCommit holds commit metadata shared by one or more blame ranges.

type BlameRange added in v0.6.0

type BlameRange struct {
	StartingLine int    `json:"starting_line"`
	EndingLine   int    `json:"ending_line"`
	Age          int    `json:"age"`
	CommitSHA    string `json:"commit_sha"`
}

BlameRange is a contiguous run of lines attributed to a single commit.

Age is the relative position of this range's commit among distinct commits touching the file (0 = newest), not an absolute time delta. See: https://docs.github.com/en/graphql/reference/objects#blamerange

type BlameResult added in v0.6.0

type BlameResult struct {
	Repository  string                 `json:"repository"`
	Path        string                 `json:"path"`
	Ref         string                 `json:"ref"`
	Ranges      []BlameRange           `json:"ranges"`
	Commits     map[string]BlameCommit `json:"commits"`
	PageInfo    MinimalPageInfo        `json:"pageInfo"`
	TotalRanges int                    `json:"total_ranges"`
	Truncated   bool                   `json:"truncated,omitempty"`
}

BlameResult is the response payload returned by the get_file_blame tool.

Commits is keyed by SHA. TotalRanges counts matching ranges before cursor pagination or truncation. Truncated reports whether maxBlameRanges was hit.

type CloseIssueInput

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

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

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

type CursorPaginationParams struct {
	PerPage int
	After   string
}

func OptionalCursorPaginationParams

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

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

ToGraphQLParams converts cursor pagination parameters to GraphQL-specific parameters.

type DiscussionFragment

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

type DiscussionQueryResult

type DiscussionQueryResult interface {
	GetDiscussionFragment() DiscussionFragment
}

Common interface for all discussion query types

type FeatureFlags

type FeatureFlags struct {
	LockdownMode bool
}

FeatureFlags defines runtime feature toggles that adjust tool behavior.

type GetClientFn

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

type GetGQLClientFn

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

type GraphQLPaginationParams

type GraphQLPaginationParams struct {
	First *int32
	After *string
}

type IssueClosedStateReason

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 IssueField added in v0.6.0

type IssueField struct {
	ID          string                         `json:"id"`
	DatabaseID  int64                          `json:"full_database_id,omitempty"`
	Name        string                         `json:"name"`
	Description string                         `json:"description,omitempty"`
	DataType    string                         `json:"data_type"`
	Visibility  string                         `json:"visibility"`
	Options     []IssueSingleSelectFieldOption `json:"options,omitempty"`
}

IssueField represents a repository issue field definition.

type IssueFieldCreateOrUpdateInput added in v0.6.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"`
	Rationale            *githubv4.String  `json:"rationale,omitempty"`
	Confidence           *string           `json:"confidence,omitempty"`
	Suggest              *githubv4.Boolean `json:"suggest,omitempty"`
}

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

type IssueFieldRef added in v0.6.0

type IssueFieldRef struct {
	Date struct {
		Name           githubv4.String
		FullDatabaseID githubv4.String `graphql:"fullDatabaseId"`
	} `graphql:"... on IssueFieldDate"`
	Number struct {
		Name           githubv4.String
		FullDatabaseID githubv4.String `graphql:"fullDatabaseId"`
	} `graphql:"... on IssueFieldNumber"`
	SingleSelect struct {
		Name           githubv4.String
		FullDatabaseID githubv4.String `graphql:"fullDatabaseId"`
	} `graphql:"... on IssueFieldSingleSelect"`
	Text struct {
		Name           githubv4.String
		FullDatabaseID githubv4.String `graphql:"fullDatabaseId"`
	} `graphql:"... on IssueFieldText"`
}

IssueFieldRef resolves the name of an issue field across its concrete types. IssueFields is a union of IssueFieldDate, IssueFieldNumber, IssueFieldSingleSelect, IssueFieldText, so we have to ask for `name` on each member.

func (IssueFieldRef) FullDatabaseIDStr added in v0.6.0

func (r IssueFieldRef) FullDatabaseIDStr() string

FullDatabaseIDStr returns the fullDatabaseId string from whichever IssueFields union variant the field resolved to.

func (IssueFieldRef) Name added in v0.6.0

func (r IssueFieldRef) Name() string

Name returns the populated name from whichever IssueFields union variant the field resolved to.

type IssueFieldValueFilter added in v0.6.0

type IssueFieldValueFilter struct {
	FieldName               githubv4.String  `json:"fieldName"`
	TextValue               *githubv4.String `json:"textValue,omitempty"`
	DateValue               *githubv4.String `json:"dateValue,omitempty"`
	NumberValue             *githubv4.Float  `json:"numberValue,omitempty"`
	SingleSelectOptionValue *githubv4.String `json:"singleSelectOptionValue,omitempty"`
}

IssueFieldValueFilter mirrors the GraphQL IssueFieldValueFilter input. Exactly one typed value field should be set per filter (the monolith resolver rejects multiple).

type IssueFieldValueFragment added in v0.6.0

type IssueFieldValueFragment struct {
	TypeName  string `graphql:"__typename"`
	DateValue struct {
		Field IssueFieldRef
		Value githubv4.String
	} `graphql:"... on IssueFieldDateValue"`
	NumberValue struct {
		Field IssueFieldRef
		Value githubv4.Float `graphql:"valueNumber: value"`
	} `graphql:"... on IssueFieldNumberValue"`
	SingleSelectValue struct {
		Field IssueFieldRef
		Value githubv4.String
	} `graphql:"... on IssueFieldSingleSelectValue"`
	TextValue struct {
		Field IssueFieldRef
		Value githubv4.String
	} `graphql:"... on IssueFieldTextValue"`
}

IssueFieldValueFragment captures the value of a custom issue field. IssueFieldValue is a union of 4 concrete value types; each carries its own value scalar and a reference to its parent field. The Number variant's `value` is aliased to `valueNumber` to avoid a Float vs String type clash on decode.

type IssueFragment

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"`
	IssueFieldValues struct {
		Nodes []IssueFieldValueFragment
	} `graphql:"issueFieldValues(first: 25)"`
}

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

type IssueQueryFragment

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

type IssueQueryResult interface {
	GetIssueFragment() IssueQueryFragment
	GetIsPrivate() bool
}

Common interface for all issue query types

type IssueSingleSelectFieldOption added in v0.6.0

type IssueSingleSelectFieldOption struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description,omitempty"`
	Color       string `json:"color"`
	Priority    *int   `json:"priority,omitempty"`
}

IssueSingleSelectFieldOption represents an option for a single_select issue field.

type ListIssuesQuery

type ListIssuesQuery struct {
	Repository struct {
		Issues    IssueQueryFragment `` /* 163-byte string literal not displayed */
		IsPrivate githubv4.Boolean
	} `graphql:"repository(owner: $owner, name: $repo)"`
}

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

func (*ListIssuesQuery) GetIsPrivate added in v0.6.0

func (q *ListIssuesQuery) GetIsPrivate() bool

func (*ListIssuesQuery) GetIssueFragment

func (q *ListIssuesQuery) GetIssueFragment() IssueQueryFragment

type ListIssuesQueryTypeWithLabels

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

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

func (*ListIssuesQueryTypeWithLabels) GetIsPrivate added in v0.6.0

func (q *ListIssuesQueryTypeWithLabels) GetIsPrivate() bool

func (*ListIssuesQueryTypeWithLabels) GetIssueFragment

func (q *ListIssuesQueryTypeWithLabels) GetIssueFragment() IssueQueryFragment

Implement the interface for all query types

type ListIssuesQueryTypeWithLabelsWithSince

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

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

func (*ListIssuesQueryTypeWithLabelsWithSince) GetIsPrivate added in v0.6.0

func (q *ListIssuesQueryTypeWithLabelsWithSince) GetIsPrivate() bool

func (*ListIssuesQueryTypeWithLabelsWithSince) GetIssueFragment

type ListIssuesQueryWithSince

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

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

func (*ListIssuesQueryWithSince) GetIsPrivate added in v0.6.0

func (q *ListIssuesQueryWithSince) GetIsPrivate() bool

func (*ListIssuesQueryWithSince) GetIssueFragment

func (q *ListIssuesQueryWithSince) GetIssueFragment() IssueQueryFragment

type MCPServerConfig

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/aifity/omnigit-mcp?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

	// 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 expands to the curated set of feature flags enabled for insiders.
	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

	// TokenProvider, when non-nil, supplies the GitHub token for each API
	// request instead of the static Token. It backs OAuth login, where the
	// token is obtained lazily on first use and refreshed thereafter.
	TokenProvider func() string

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

type MCPServerOption

type MCPServerOption func(*mcp.ServerOptions)

type MinimalBranch

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.6.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.6.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 MinimalCodeResult added in v0.6.0

type MinimalCodeResult struct {
	Name        string              `json:"name"`
	Path        string              `json:"path"`
	SHA         string              `json:"sha"`
	Repository  string              `json:"repository"`
	TextMatches []*github.TextMatch `json:"text_matches,omitempty"`
}

MinimalCodeResult is the trimmed output type for a single code search hit.

type MinimalCodeSearchResult added in v0.6.0

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

MinimalCodeSearchResult is the trimmed output type for code search results.

type MinimalCollaborator added in v0.6.0

type MinimalCollaborator struct {
	Login    string `json:"login"`
	ID       int64  `json:"id"`
	RoleName string `json:"role_name"`
}

MinimalCollaborator is the trimmed output type for repository collaborators.

type MinimalCommit

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

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

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"`
	Patch     string `json:"patch,omitempty"`
}

MinimalCommitFile represents a file changed in a commit.

type MinimalCommitInfo

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

MinimalCommitInfo represents core commit information.

type MinimalCommitSearchItem added in v0.6.0

type MinimalCommitSearchItem struct {
	MinimalCommit
	Repository *MinimalRepoRef `json:"repository,omitempty"`
}

MinimalCommitSearchItem extends MinimalCommit with the containing repository, since commit search spans repositories and callers need to know which repo each result came from.

type MinimalCommitStats

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

MinimalCommitStats represents commit statistics.

type MinimalDiscussionComment added in v0.6.0

type MinimalDiscussionComment struct {
	ID              string                     `json:"id"`
	Body            string                     `json:"body"`
	IsAnswer        bool                       `json:"isAnswer,omitempty"`
	Replies         []MinimalDiscussionComment `json:"replies,omitempty"`
	ReplyTotalCount int                        `json:"replyTotalCount,omitempty"`
}

MinimalDiscussionComment is the trimmed output type for discussion comment objects.

type MinimalFieldValue added in v0.6.0

type MinimalFieldValue struct {
	Field  string   `json:"field"`
	Value  string   `json:"value,omitempty"`
	Values []string `json:"values,omitempty"`
}

MinimalFieldValue is the trimmed output type for a custom field value resolved via GraphQL (e.g. list_issues, search_issues). Single-value variants populate Value; Values is reserved for multi-select.

type MinimalFileCommit

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

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

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

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"`
	IssueFieldValues  []MinimalIssueFieldValue `json:"issue_field_values,omitempty"`
	FieldValues       []MinimalFieldValue      `json:"field_values,omitempty"`

	// Hierarchy relationship signals. HasParent and HasChildren are populated when
	// hierarchy enrichment succeeds; SubIssuesSummary is populated when children exist,
	// and Parent when a parent exists and may be surfaced (under lockdown an unverified
	// parent reference is omitted while HasParent stays true).
	HasParent        *bool                    `json:"has_parent,omitempty"`
	HasChildren      *bool                    `json:"has_children,omitempty"`
	Parent           *MinimalIssueRef         `json:"parent,omitempty"`
	SubIssuesSummary *MinimalSubIssuesSummary `json:"sub_issues_summary,omitempty"`
}

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

type MinimalIssueComment

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 MinimalIssueFieldValue added in v0.6.0

type MinimalIssueFieldValue struct {
	IssueFieldID       int64                                     `json:"issue_field_id,omitempty"`
	NodeID             string                                    `json:"node_id,omitempty"`
	DataType           string                                    `json:"data_type,omitempty"`
	Value              any                                       `json:"value,omitempty"`
	SingleSelectOption *MinimalIssueFieldValueSingleSelectOption `json:"single_select_option,omitempty"`
}

MinimalIssueFieldValue is the trimmed output type for a custom field value attached to an issue, populated from REST API responses (e.g. get_issue). For GraphQL-sourced field values see MinimalFieldValue.

type MinimalIssueFieldValueSingleSelectOption added in v0.6.0

type MinimalIssueFieldValueSingleSelectOption struct {
	ID    int64  `json:"id"`
	Name  string `json:"name"`
	Color string `json:"color"`
}

MinimalIssueFieldValueSingleSelectOption is the trimmed output type for a single-select option of an issue field value.

type MinimalIssueRef added in v0.6.0

type MinimalIssueRef struct {
	Number     int    `json:"number"`
	Title      string `json:"title"`
	State      string `json:"state"`
	URL        string `json:"url"`
	Repository string `json:"repository,omitempty"`
}

MinimalIssueRef is a compact reference to a related issue (e.g. a parent issue). Its keys mirror the get_parent (GetIssueParent) response shape.

type MinimalIssuesResponse added in v0.6.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

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

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.6.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.6.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

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 MinimalProjectItem added in v0.6.0

type MinimalProjectItem struct {
	ID          int64                          `json:"id"`
	NodeID      string                         `json:"node_id,omitempty"`
	ContentType string                         `json:"content_type,omitempty"`
	Content     *MinimalProjectItemContent     `json:"content,omitempty"`
	Fields      []MinimalProjectItemFieldValue `json:"fields,omitempty"`
	ArchivedAt  string                         `json:"archived_at,omitempty"`
	CreatedAt   string                         `json:"created_at,omitempty"`
	UpdatedAt   string                         `json:"updated_at,omitempty"`
	Creator     string                         `json:"creator,omitempty"`
}

type MinimalProjectItemContent added in v0.6.0

type MinimalProjectItemContent struct {
	ID          int64    `json:"id,omitempty"`
	NodeID      string   `json:"node_id,omitempty"`
	Number      int      `json:"number,omitempty"`
	Title       string   `json:"title,omitempty"`
	State       string   `json:"state,omitempty"`
	StateReason string   `json:"state_reason,omitempty"`
	HTMLURL     string   `json:"html_url,omitempty"`
	Repository  string   `json:"repository,omitempty"`
	Author      string   `json:"author,omitempty"`
	Assignees   []string `json:"assignees,omitempty"`
	Labels      []string `json:"labels,omitempty"`
	Milestone   string   `json:"milestone,omitempty"`
	Comments    int      `json:"comments,omitempty"`
	Draft       bool     `json:"draft,omitempty"`
	Merged      bool     `json:"merged,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"`
}

type MinimalProjectItemFieldValue added in v0.6.0

type MinimalProjectItemFieldValue struct {
	ID       int64  `json:"id,omitempty"`
	Name     string `json:"name,omitempty"`
	DataType string `json:"data_type,omitempty"`
	Value    any    `json:"value,omitempty"`
}

type MinimalProjectStatusUpdate

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

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 MinimalPullRequestCommit added in v0.6.0

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

MinimalPullRequestCommit is the trimmed output type for commits listed on a pull request.

type MinimalPullRequestReview added in v0.6.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

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

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 MinimalRepoRef added in v0.6.0

type MinimalRepoRef struct {
	FullName string `json:"full_name"`
	HTMLURL  string `json:"html_url,omitempty"`
	Private  bool   `json:"private,omitempty"`
}

MinimalRepoRef is a lightweight reference to a repository, used when a result needs to identify which repository it belongs to (for example, in cross-repo commit search results).

type MinimalRepository

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

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.6.0

type MinimalReviewComment struct {
	NodeID     string `json:"node_id"`
	DatabaseID int    `json:"database_id"`
	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.6.0

type MinimalReviewThread struct {
	ID          string                 `json:"id"`
	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.6.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 MinimalSearchCommitsResult added in v0.6.0

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

MinimalSearchCommitsResult is the trimmed output type for commit search results.

type MinimalSearchRepositoriesResult

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

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 MinimalSubIssuesSummary added in v0.6.0

type MinimalSubIssuesSummary struct {
	Total            int `json:"total"`
	Completed        int `json:"completed"`
	PercentCompleted int `json:"percent_completed"`
}

MinimalSubIssuesSummary holds the native GraphQL subIssuesSummary counts for an issue.

type MinimalTag added in v0.6.0

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

MinimalTag is the trimmed output type for tag objects.

type MinimalUser

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

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

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

type PageInfoFragment

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

type PaginationParams

type PaginationParams struct {
	Page    int
	PerPage int
	After   string
}

func OptionalPaginationParams

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

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

type PollConfig struct {
	MaxAttempts int
	Delay       time.Duration
}

PollConfig configures the PR polling behavior.

type ProjectV2IterationFieldConfigurationInput added in v0.6.0

type ProjectV2IterationFieldConfigurationInput struct {
	Duration   githubv4.Int                            `json:"duration"`
	StartDate  githubv4.Date                           `json:"startDate"`
	Iterations []ProjectV2IterationFieldIterationInput `json:"iterations"`
}

ProjectV2IterationFieldConfigurationInput is the GraphQL input for configuring an iteration field. GitHub's schema marks iterations as a required non-null list, so the field is not omitempty.

type ProjectV2IterationFieldIterationInput added in v0.6.0

type ProjectV2IterationFieldIterationInput struct {
	StartDate githubv4.Date   `json:"startDate"`
	Duration  githubv4.Int    `json:"duration"`
	Title     githubv4.String `json:"title"`
}

ProjectV2IterationFieldIterationInput is the GraphQL input for a single iteration definition.

type PullRequestReviewWriteParams

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

type ReplaceActorsForAssignableInput

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

type RequestDeps

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

func NewRequestDeps

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

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

GetClient implements ToolDependencies.

func (*RequestDeps) GetContentWindowSize

func (d *RequestDeps) GetContentWindowSize() int

GetContentWindowSize implements ToolDependencies.

func (*RequestDeps) GetFlags

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

GetFlags implements ToolDependencies.

func (*RequestDeps) GetGQLClient

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

GetGQLClient implements ToolDependencies.

func (*RequestDeps) GetRawClient

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

GetRawClient implements ToolDependencies.

func (*RequestDeps) GetRepoAccessCache

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

GetRepoAccessCache implements ToolDependencies.

func (*RequestDeps) GetT

GetT implements ToolDependencies.

func (*RequestDeps) IsFeatureEnabled

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

IsFeatureEnabled checks if a feature flag is enabled.

func (*RequestDeps) Logger added in v0.6.0

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

Logger implements ToolDependencies.

func (*RequestDeps) Metrics added in v0.6.0

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

Metrics implements ToolDependencies.

type ResolvedField added in v0.6.0

type ResolvedField struct {
	ID       string
	Name     string
	DataType string
	Options  []ResolvedFieldOption
}

ResolvedField is a project field resolved by name; Options is only set when DataType == "SINGLE_SELECT".

type ResolvedFieldOption added in v0.6.0

type ResolvedFieldOption struct {
	ID   string
	Name string
}

ResolvedFieldOption is one option on a SINGLE_SELECT project field.

type SearchIssueResult added in v0.6.0

type SearchIssueResult struct {
	*github.Issue
	FieldValues []MinimalFieldValue `json:"field_values,omitempty"`
}

SearchIssueResult wraps a REST search hit with its custom issue field values, fetched in a follow-up GraphQL nodes() query.

func (SearchIssueResult) MarshalJSON added in v0.6.0

func (r SearchIssueResult) MarshalJSON() ([]byte, error)

MarshalJSON serializes SearchIssueResult, suppressing the raw issue_field_values from the embedded REST response in favour of the normalized field_values populated via GraphQL enrichment.

type SearchIssuesResponse added in v0.6.0

type SearchIssuesResponse struct {
	Total             *int                `json:"total_count,omitempty"`
	IncompleteResults *bool               `json:"incomplete_results,omitempty"`
	Items             []SearchIssueResult `json:"items"`
}

SearchIssuesResponse mirrors the REST IssuesSearchResult JSON shape and adds field_values per item, sourced from a single GraphQL nodes() round-trip.

type SetIssueFieldValueInput added in v0.6.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

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

type ToolDependencies

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

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

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

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

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

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 UpdateIssueOptions added in v0.6.0

type UpdateIssueOptions struct {
	// AssigneesProvided sends the assignees field even when the slice is empty.
	AssigneesProvided bool
	// LabelsProvided sends the labels field even when the slice is empty.
	LabelsProvided bool
}

UpdateIssueOptions controls which optional fields are included in an issue update request.

type UpdateProjectV2FieldInput added in v0.6.0

type UpdateProjectV2FieldInput struct {
	FieldID                githubv4.ID                                `json:"fieldId"`
	IterationConfiguration *ProjectV2IterationFieldConfigurationInput `json:"iterationConfiguration,omitempty"`
}

UpdateProjectV2FieldInput is the GraphQL input for the updateProjectV2Field mutation. These types are defined locally because the pinned shurcooL/githubv4 release (v0.0.0-20240727222349) does not yet expose them. Upstream master now generates equivalent types, so this block can be removed when the dependency is next bumped.

type UserDetails

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

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

func (*WithCategoryAndOrder) GetDiscussionFragment

func (q *WithCategoryAndOrder) GetDiscussionFragment() DiscussionFragment

type WithCategoryNoOrder

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

func (*WithCategoryNoOrder) GetDiscussionFragment

func (q *WithCategoryNoOrder) GetDiscussionFragment() DiscussionFragment

Jump to

Keyboard shortcuts

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