utils

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMissingAuthorizationHeader     = fmt.Errorf("%w: missing required Authorization header", mark.ErrBadRequest)
	ErrBadAuthorizationHeader         = fmt.Errorf("%w: Authorization header is badly formatted", mark.ErrBadRequest)
	ErrUnsupportedAuthorizationHeader = fmt.Errorf("%w: unsupported Authorization header", mark.ErrBadRequest)
)

Functions

func NewToolResultAwaitingFormSubmission added in v1.4.0

func NewToolResultAwaitingFormSubmission(message string) *mcp.CallToolResult

NewToolResultAwaitingFormSubmission signals to the agent that a tool call has been intercepted to show an MCP App form to the user and has NOT performed the requested operation. The agent must stop, not chain dependent tool calls, and not claim the operation succeeded. The result is marked IsError=true so agents that bail on error don't proceed; the host still renders the UI because rendering is keyed off the tool's _meta.ui, not the result. The MCP App form will submit the operation directly when the user clicks submit, after which a ui/update-model-context call delivers the real outcome to the agent.

func NewToolResultError

func NewToolResultError(message string) *mcp.CallToolResult

func NewToolResultErrorFromErr

func NewToolResultErrorFromErr(message string, err error) *mcp.CallToolResult

func NewToolResultResource

func NewToolResultResource(message string, contents *mcp.ResourceContents) *mcp.CallToolResult
func NewToolResultResourceLink(message string, link *mcp.ResourceLink) *mcp.CallToolResult

func NewToolResultText

func NewToolResultText(message string) *mcp.CallToolResult

Types

type APIHost added in v0.31.0

type APIHost struct {
	// contains filtered or unexported fields
}

func (APIHost) AuthorizationServerURL added in v0.32.0

func (a APIHost) AuthorizationServerURL(_ context.Context) (*url.URL, error)

func (APIHost) BaseRESTURL added in v0.31.0

func (a APIHost) BaseRESTURL(_ context.Context) (*url.URL, error)

APIHostResolver implementation

func (APIHost) GraphqlURL added in v0.31.0

func (a APIHost) GraphqlURL(_ context.Context) (*url.URL, error)

func (APIHost) RawURL added in v0.31.0

func (a APIHost) RawURL(_ context.Context) (*url.URL, error)

func (APIHost) UploadURL added in v0.31.0

func (a APIHost) UploadURL(_ context.Context) (*url.URL, error)

type APIHostResolver added in v0.31.0

type APIHostResolver interface {
	BaseRESTURL(ctx context.Context) (*url.URL, error)
	GraphqlURL(ctx context.Context) (*url.URL, error)
	UploadURL(ctx context.Context) (*url.URL, error)
	RawURL(ctx context.Context) (*url.URL, error)
	AuthorizationServerURL(ctx context.Context) (*url.URL, error)
}

func NewAPIHost added in v0.31.0

func NewAPIHost(s string) (APIHostResolver, error)

type TokenType added in v0.31.0

type TokenType int
const (
	TokenTypeUnknown TokenType = iota
	TokenTypePersonalAccessToken
	TokenTypeFineGrainedPersonalAccessToken
	TokenTypeOAuthAccessToken
	TokenTypeUserToServerGitHubAppToken
	TokenTypeServerToServerGitHubAppToken
)

func ParseAuthorizationHeader added in v0.31.0

func ParseAuthorizationHeader(req *http.Request) (tokenType TokenType, token string, _ error)

ParseAuthorizationHeader parses the Authorization header from the HTTP request

Jump to

Keyboard shortcuts

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