mcp

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExportLogEvent

func ExportLogEvent(path string, event ExportEvent) error

func ExportOTelEvent

func ExportOTelEvent(path string, event ExportEvent) error

func ToIntentRequest

func ToIntentRequest(call ToolCall) (schemagate.IntentRequest, error)

func ToIntentRequestWithOptions

func ToIntentRequestWithOptions(call ToolCall, opts IntentOptions) (schemagate.IntentRequest, error)

Types

type Adapter

type Adapter interface {
	CallTool(context.Context, ToolCall) (ToolResult, error)
}

type ArgProvenance

type ArgProvenance struct {
	ArgPath         string `json:"arg_path"`
	Source          string `json:"source"`
	SourceRef       string `json:"source_ref,omitempty"`
	IntegrityDigest string `json:"integrity_digest,omitempty"`
}

type CallContext

type CallContext struct {
	Identity               string         `json:"identity,omitempty"`
	Workspace              string         `json:"workspace,omitempty"`
	RiskClass              string         `json:"risk_class,omitempty"`
	Phase                  string         `json:"phase,omitempty"`
	JobID                  string         `json:"job_id,omitempty"`
	SessionID              string         `json:"session_id,omitempty"`
	RequestID              string         `json:"request_id,omitempty"`
	RunID                  string         `json:"run_id,omitempty"`
	AuthMode               string         `json:"auth_mode,omitempty"`
	OAuthEvidence          *OAuthEvidence `json:"oauth_evidence,omitempty"`
	AuthContext            map[string]any `json:"auth_context,omitempty"`
	CredentialScopes       []string       `json:"credential_scopes,omitempty"`
	EnvironmentFingerprint string         `json:"environment_fingerprint,omitempty"`
}

type Delegation

type Delegation struct {
	RequesterIdentity string           `json:"requester_identity"`
	ScopeClass        string           `json:"scope_class,omitempty"`
	TokenRefs         []string         `json:"token_refs,omitempty"`
	Chain             []DelegationLink `json:"chain,omitempty"`
}
type DelegationLink struct {
	DelegatorIdentity string `json:"delegator_identity"`
	DelegateIdentity  string `json:"delegate_identity"`
	ScopeClass        string `json:"scope_class,omitempty"`
	TokenRef          string `json:"token_ref,omitempty"`
}

type EvalResult

type EvalResult struct {
	Call    ToolCall
	Intent  schemagate.IntentRequest
	Outcome gate.EvalOutcome
}

func EvaluateToolCall

func EvaluateToolCall(policy gate.Policy, call ToolCall, opts gate.EvalOptions) (EvalResult, error)

func EvaluateToolCallWithIntentOptions

func EvaluateToolCallWithIntentOptions(policy gate.Policy, call ToolCall, opts gate.EvalOptions, intentOpts IntentOptions) (EvalResult, error)

type ExportEvent

type ExportEvent struct {
	CreatedAt       time.Time `json:"created_at"`
	ProducerVersion string    `json:"producer_version"`
	RunID           string    `json:"run_id"`
	SessionID       string    `json:"session_id,omitempty"`
	TraceID         string    `json:"trace_id"`
	TracePath       string    `json:"trace_path,omitempty"`
	ToolName        string    `json:"tool_name"`
	Verdict         string    `json:"verdict"`
	ReasonCodes     []string  `json:"reason_codes,omitempty"`
	PolicyDigest    string    `json:"policy_digest"`
	IntentDigest    string    `json:"intent_digest"`
	DecisionLatency int64     `json:"decision_latency_ms,omitempty"`
	DelegationRef   string    `json:"delegation_ref,omitempty"`
	DelegationDepth int       `json:"delegation_depth,omitempty"`
}

type IntentOptions

type IntentOptions struct {
	RequireExplicitContext bool
}

type OAuthEvidence added in v1.2.5

type OAuthEvidence struct {
	Issuer      string   `json:"issuer,omitempty"`
	Audience    []string `json:"audience,omitempty"`
	Subject     string   `json:"subject,omitempty"`
	ClientID    string   `json:"client_id,omitempty"`
	TokenType   string   `json:"token_type,omitempty"`
	Scopes      []string `json:"scopes,omitempty"`
	DCRClientID string   `json:"dcr_client_id,omitempty"`
	RedirectURI string   `json:"redirect_uri,omitempty"`
	TokenBind   string   `json:"token_binding,omitempty"`
	AuthTime    string   `json:"auth_time,omitempty"`
	EvidenceRef string   `json:"evidence_ref,omitempty"`
}

type ScriptCall added in v1.2.8

type ScriptCall struct {
	Steps []ScriptStep `json:"steps"`
}

type ScriptStep added in v1.2.8

type ScriptStep struct {
	Name          string          `json:"name"`
	Args          map[string]any  `json:"args,omitempty"`
	Targets       []Target        `json:"targets,omitempty"`
	ArgProvenance []ArgProvenance `json:"arg_provenance,omitempty"`
}

type Target

type Target struct {
	Kind                 string         `json:"kind"`
	Value                string         `json:"value"`
	Operation            string         `json:"operation,omitempty"`
	Sensitivity          string         `json:"sensitivity,omitempty"`
	DiscoveryMethod      string         `json:"discovery_method,omitempty"`
	DiscoveryMethodAlias string         `json:"discoveryMethod,omitempty"`
	ReadOnlyHint         bool           `json:"read_only_hint,omitempty"`
	ReadOnlyHintAlias    bool           `json:"readOnlyHint,omitempty"`
	DestructiveHint      bool           `json:"destructive_hint,omitempty"`
	DestructiveHintAlias bool           `json:"destructiveHint,omitempty"`
	IdempotentHint       bool           `json:"idempotent_hint,omitempty"`
	IdempotentHintAlias  bool           `json:"idempotentHint,omitempty"`
	OpenWorldHint        bool           `json:"open_world_hint,omitempty"`
	OpenWorldHintAlias   bool           `json:"openWorldHint,omitempty"`
	Annotations          map[string]any `json:"annotations,omitempty"`
}

type ToolCall

type ToolCall struct {
	Name          string          `json:"name"`
	Args          map[string]any  `json:"args,omitempty"`
	Script        *ScriptCall     `json:"script,omitempty"`
	Target        string          `json:"target,omitempty"`
	Targets       []Target        `json:"targets,omitempty"`
	ArgProvenance []ArgProvenance `json:"arg_provenance,omitempty"`
	Context       CallContext     `json:"context,omitempty"`
	Delegation    *Delegation     `json:"delegation,omitempty"`
	CreatedAt     time.Time       `json:"created_at,omitempty"`
}

func DecodeToolCall

func DecodeToolCall(adapter string, payload []byte) (ToolCall, error)

type ToolResult

type ToolResult struct {
	Status string         `json:"status"`
	Output map[string]any `json:"output,omitempty"`
}

Jump to

Keyboard shortcuts

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