Documentation
¶
Index ¶
- func ContextWithGitHubErrors(ctx context.Context) context.Context
- func NewGitHubAPIErrorResponse(ctx context.Context, message string, resp *github.Response, err error) *mcp.CallToolResult
- func NewGitHubAPIErrorToCtx(ctx context.Context, message string, resp *github.Response, err error) (context.Context, error)
- func NewGitHubAPIStatusErrorResponse(ctx context.Context, message string, resp *github.Response, body []byte) *mcp.CallToolResult
- func NewGitHubGraphQLErrorResponse(ctx context.Context, message string, err error) *mcp.CallToolResult
- func NewGitHubGraphQLErrorToCtx(ctx context.Context, message string, err error) (context.Context, error)
- func NewGitHubRawAPIErrorResponse(ctx context.Context, message string, resp *http.Response, err error) *mcp.CallToolResult
- func NewStructuredResolutionErrorResponse(err *StructuredResolutionError) *mcp.CallToolResult
- type GitHubAPIError
- type GitHubCtxErrors
- type GitHubErrorKey
- type GitHubGraphQLError
- type GitHubRawAPIError
- type StructuredResolutionError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContextWithGitHubErrors ¶
ContextWithGitHubErrors updates or creates a context with a pointer to GitHub error information (to be used by middleware).
func NewGitHubAPIErrorResponse ¶
func NewGitHubAPIErrorResponse(ctx context.Context, message string, resp *github.Response, err error) *mcp.CallToolResult
NewGitHubAPIErrorResponse returns an mcp.NewToolResultError and retains the error in the context for access via middleware
func NewGitHubAPIErrorToCtx ¶
func NewGitHubAPIStatusErrorResponse ¶ added in v0.26.0
func NewGitHubAPIStatusErrorResponse(ctx context.Context, message string, resp *github.Response, body []byte) *mcp.CallToolResult
NewGitHubAPIStatusErrorResponse handles cases where the API call succeeds (err == nil) but returns an unexpected HTTP status code. It creates a synthetic error from the status code and response body, then records it in context for observability tracking.
func NewGitHubGraphQLErrorResponse ¶
func NewGitHubGraphQLErrorResponse(ctx context.Context, message string, err error) *mcp.CallToolResult
NewGitHubGraphQLErrorResponse returns an mcp.NewToolResultError and retains the error in the context for access via middleware
func NewGitHubGraphQLErrorToCtx ¶ added in v0.27.0
func NewGitHubRawAPIErrorResponse ¶ added in v0.27.0
func NewGitHubRawAPIErrorResponse(ctx context.Context, message string, resp *http.Response, err error) *mcp.CallToolResult
NewGitHubRawAPIErrorResponse returns an mcp.NewToolResultError and retains the error in the context for access via middleware
func NewStructuredResolutionErrorResponse ¶ added in v1.6.0
func NewStructuredResolutionErrorResponse(err *StructuredResolutionError) *mcp.CallToolResult
NewStructuredResolutionErrorResponse returns an mcp.CallToolResult whose text body is the JSON-serialised StructuredResolutionError, suitable for agent self-correction.
Types ¶
type GitHubAPIError ¶
type GitHubAPIError struct {
Message string `json:"message"`
Response *github.Response `json:"-"`
Err error `json:"-"`
}
func GetGitHubAPIErrors ¶
func GetGitHubAPIErrors(ctx context.Context) ([]*GitHubAPIError, error)
GetGitHubAPIErrors retrieves the slice of GitHubAPIErrors from the context.
func (*GitHubAPIError) Error ¶
func (e *GitHubAPIError) Error() string
type GitHubCtxErrors ¶
type GitHubCtxErrors struct {
// contains filtered or unexported fields
}
type GitHubErrorKey ¶
type GitHubErrorKey struct{}
type GitHubGraphQLError ¶
func GetGitHubGraphQLErrors ¶
func GetGitHubGraphQLErrors(ctx context.Context) ([]*GitHubGraphQLError, error)
GetGitHubGraphQLErrors retrieves the slice of GitHubGraphQLErrors from the context.
func (*GitHubGraphQLError) Error ¶
func (e *GitHubGraphQLError) Error() string
type GitHubRawAPIError ¶ added in v0.27.0
type GitHubRawAPIError struct {
Message string `json:"message"`
Response *http.Response `json:"-"`
Err error `json:"-"`
}
func GetGitHubRawAPIErrors ¶ added in v0.27.0
func GetGitHubRawAPIErrors(ctx context.Context) ([]*GitHubRawAPIError, error)
GetGitHubRawAPIErrors retrieves the slice of GitHubRawAPIErrors from the context.
func (*GitHubRawAPIError) Error ¶ added in v0.27.0
func (e *GitHubRawAPIError) Error() string
type StructuredResolutionError ¶ added in v1.6.0
type StructuredResolutionError struct {
Kind string `json:"error"`
Name string `json:"name,omitempty"`
Field string `json:"field,omitempty"`
Candidates []any `json:"candidates,omitempty"`
Hint string `json:"hint,omitempty"`
}
StructuredResolutionError is a machine-readable error returned by name-resolution helpers (e.g. resolving a project field or single-select option by name). Agents can parse the JSON body to self-correct without re-prompting.
Kind values:
- "field_not_found" — no project field matches the supplied name
- "field_ambiguous" — more than one project field shares the supplied name
- "option_not_found" — no option on the resolved single-select field matches
- "option_ambiguous" — duplicate option names on the resolved field
- "item_not_in_project" — the issue/PR exists but is not an item on the project
- "wrong_field_type" — the named field is not the data type the caller expected
func NewStructuredResolutionError ¶ added in v1.6.0
func NewStructuredResolutionError(kind, name, hint string, candidates []any) *StructuredResolutionError
NewStructuredResolutionError constructs a StructuredResolutionError.
func (*StructuredResolutionError) Error ¶ added in v1.6.0
func (e *StructuredResolutionError) Error() string
Error implements the error interface; the message is the JSON body so that the downstream tool result also carries the structured payload as plain text.