runtime

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2026 License: MPL-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChoiceID

func ChoiceID(serverID spec.MCPServerID, toolName string) string

func EnsureDigest

func EnsureDigest(expected, got string, allowStale bool) error

func ProviderToolName

func ProviderToolName(serverID spec.MCPServerID, toolName string) string

Types

type ApprovalManager

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

func NewApprovalManager

func NewApprovalManager(ttl time.Duration) *ApprovalManager

func (*ApprovalManager) Create

func (m *ApprovalManager) Create(ctx context.Context, summary spec.MCPApprovalSummary) (string, error)

func (*ApprovalManager) LookupDecision

func (m *ApprovalManager) LookupDecision(summary spec.MCPApprovalSummary) (spec.MCPApprovalResolution, bool)

func (*ApprovalManager) Resolve

func (*ApprovalManager) VerifyAndConsume

func (m *ApprovalManager) VerifyAndConsume(ctx context.Context, id, token string) error

func (*ApprovalManager) VerifyAndConsumeToken

func (m *ApprovalManager) VerifyAndConsumeToken(
	ctx context.Context,
	token string,
	expected spec.MCPApprovalSummary,
) (string, error)

type ClientFactory

type ClientFactory interface {
	Connect(
		ctx context.Context,
		cfg spec.MCPServerConfig,
		resolved auth.ResolvedTransportAuth,
		events ClientNotificationSink,
	) (ClientSession, error)
}

type ClientNotification

type ClientNotification struct {
	BundleID bundleitemutils.BundleID
	ServerID spec.MCPServerID
	Kind     ClientNotificationKind

	ResourceURI string

	LoggerName   string
	LoggingLevel string
	LogData      any

	Progress float64
	Total    float64
	Message  string
}

type ClientNotificationKind

type ClientNotificationKind string
const (
	ClientNotificationToolListChanged     ClientNotificationKind = "toolsListChanged"
	ClientNotificationResourceListChanged ClientNotificationKind = "resourcesListChanged"
	ClientNotificationPromptListChanged   ClientNotificationKind = "promptsListChanged"
	ClientNotificationResourceUpdated     ClientNotificationKind = "resourceUpdated"
	ClientNotificationProgress            ClientNotificationKind = "progress"
)

type ClientNotificationSink

type ClientNotificationSink interface {
	OnClientNotification(ctx context.Context, event ClientNotification)
}

type ClientSession

type ClientSession interface {
	Close(ctx context.Context) error
	Ping(ctx context.Context) error
	Discover(
		ctx context.Context,
		serverID spec.MCPServerID,
		policy spec.MCPServerPolicy,
		trustLevel spec.MCPTrustLevel,
	) (spec.MCPDiscoverySnapshot, error)

	CallTool(ctx context.Context, toolName string, args map[string]any) (*spec.InvokeMCPToolResponseBody, error)
	ReadResource(ctx context.Context, uri string) (*spec.MCPReadResourceResponseBody, error)
	GetPrompt(ctx context.Context, name string, args map[string]string) (*spec.MCPGetPromptResponseBody, error)
	Complete(ctx context.Context, req spec.MCPCompleteArgumentRequestBody) (*spec.MCPCompletionResult, error)
}

type EvaluationInput

type EvaluationInput struct {
	Server spec.MCPServerConfig
	Tool   spec.MCPToolCapability
	Req    spec.InvokeMCPToolRequestBody
}

type MCPRuntimeManager

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

func NewMCPRuntimeManager

func NewMCPRuntimeManager(st *store.Store, authMgr *auth.AuthManager, factory ClientFactory) *MCPRuntimeManager

func (*MCPRuntimeManager) Close

func (m *MCPRuntimeManager) Close(ctx context.Context) error

func (*MCPRuntimeManager) Complete

func (*MCPRuntimeManager) Connect

func (*MCPRuntimeManager) Disconnect

func (*MCPRuntimeManager) ForgetLastKnownSnapshot added in v0.1.13

func (m *MCPRuntimeManager) ForgetLastKnownSnapshot(
	ctx context.Context,
	bundleID bundleitemutils.BundleID,
	serverID spec.MCPServerID,
)

func (*MCPRuntimeManager) GetPrompt

func (*MCPRuntimeManager) ListPrompts

func (*MCPRuntimeManager) ListResources

func (*MCPRuntimeManager) ListTools

func (*MCPRuntimeManager) OnClientNotification

func (m *MCPRuntimeManager) OnClientNotification(ctx context.Context, event ClientNotification)

func (*MCPRuntimeManager) ReadResource

func (*MCPRuntimeManager) Refresh

func (*MCPRuntimeManager) Status

type ToolBridge

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

func NewToolBridge

func NewToolBridge(rt *MCPRuntimeManager, approvals *ApprovalManager) *ToolBridge

func (*ToolBridge) Evaluate

func (*ToolBridge) Invoke

Jump to

Keyboard shortcuts

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