mcp

package
v1.7.7 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2026 License: Apache-2.0 Imports: 46 Imported by: 0

Documentation

Overview

Package mcp provides Model Context Protocol (MCP) and Agent-to-Agent (A2A) services.

This package contains GatewayService, which is a shared service used in both gateway mode and outbound mode for MCP/A2A protocol translation and downstream dispatch. The service is truly polymorphic - the same implementation is used in both modes.

For more information on service modes, see docs/architecture/service_modes.md.

Index

Constants

View Source
const ApprovalRequestTTL = 2 * time.Minute

ApprovalRequestTTL is the lifetime of a human-approval request created when a state-changing action is paused under the notary posture. It is deliberately short: notary enforces *proof of human presence*, so the passkey (WebAuthn) authorization must be completed close in time to the action it authorizes. Once this window lapses the suspended transaction expires (the store filters on expires_at) and a fresh approval must be requested by retrying the action.

Variables

This section is empty.

Functions

func RegisterNativeTools added in v1.0.7

func RegisterNativeTools(registry *ToolRegistry) error

RegisterNativeTools explicitly registers all native tools into the provided registry. This function replaces the previous init()-based auto-registration to comply with the prohibition on init() functions in service packages.

Types

type A2ACallRequest added in v1.1.9

type A2ACallRequest struct {
	SkillName   string          `json:"skill_name"`
	Payload     json.RawMessage `json:"payload"`
	ExecutionID string          `json:"execution_id,omitempty"`
}

A2ACallRequest is the params for the "a2a/call" method.

type A2ADownstreamRequest

type A2ADownstreamRequest struct {
	SkillName   string          `json:"skill_name"`
	Payload     json.RawMessage `json:"payload"`
	ExecutionID string          `json:"execution_id,omitempty"`
}

A2ADownstreamRequest is the request sent to a downstream A2A server.

type A2ASuccessResponse

type A2ASuccessResponse struct {
	ID     string                    `json:"id"`
	Result *operatorv1.ActionReceipt `json:"result"`
}

A2ASuccessResponse is returned when an A2A call succeeds.

type A2ASuspensionResponse

type A2ASuspensionResponse struct {
	ID          string `json:"id"`
	Status      string `json:"status"`
	TxHash      string `json:"tx_hash"`
	ApprovalURL string `json:"approval_url"`
	Message     string `json:"message"`
}

A2ASuspensionResponse is returned when an A2A call is suspended for L3 approval.

type AuditEventRecorder added in v1.6.4

type AuditEventRecorder interface {
	RecordEvent(event *storage.Event) (int64, error)
}

AuditEventRecorder records audit events. Implemented by storage.SQLAuditStore in production. NewGatewayService rejects a nil AuditStore at construction (constants.ErrAuditStoreRequired) — a missing audit store is a wiring bug and fail-open on a security control, not a no-op condition. The noopAuditEventRecorder type is retained for test helpers that construct GatewayService structs directly (bypassing the constructor).

type AuditLogger

type AuditLogger interface {
	LogFieldRead(operatorSessionID, collection, documentID, fieldPath string, value FieldValue) error
}

AuditLogger logs field read operations to the audit vault

type AzureComputeMetadata added in v1.6.4

type AzureComputeMetadata struct {
	VMSize              string `json:"vmSize,omitempty"`
	Location            string `json:"location,omitempty"`
	PlatformFaultDomain string `json:"platformFaultDomain,omitempty"`
}

AzureComputeMetadata represents the compute section of Azure instance metadata.

type AzureInstanceMetadata added in v1.6.4

type AzureInstanceMetadata struct {
	Compute AzureComputeMetadata `json:"compute"`
}

AzureInstanceMetadata represents the Azure instance metadata service response.

type CallToolRequest

type CallToolRequest struct {
	Name      string          `json:"name"`
	Arguments json.RawMessage `json:"arguments,omitempty"`
}

CallToolRequest is the params for the "tools/call" method.

type CallToolResult

type CallToolResult struct {
	Content []TextContent `json:"content"`
	IsError bool          `json:"isError,omitempty"`
}

CallToolResult is the result for the "tools/call" method.

type Capabilities added in v1.0.6

type Capabilities struct {
	Tools     bool `json:"tools"`
	Resources bool `json:"resources"`
	Prompts   bool `json:"prompts"`
}

Capabilities represents the MCP server capabilities.

type CloudMetadataAllResult added in v1.6.4

type CloudMetadataAllResult struct {
	Provider         string                              `json:"provider"`
	Instance         CloudMetadataInstanceResult         `json:"instance"`
	Region           CloudMetadataRegionResult           `json:"region"`
	AvailabilityZone CloudMetadataAvailabilityZoneResult `json:"availability_zone"`
	InstanceType     CloudMetadataInstanceTypeResult     `json:"instance_type"`
}

CloudMetadataAllResult is the result for the "cloud_metadata" all operation.

type CloudMetadataAvailabilityZoneResult added in v1.6.4

type CloudMetadataAvailabilityZoneResult struct {
	Provider         string `json:"provider"`
	AvailabilityZone string `json:"availability_zone"`
	Error            string `json:"error,omitempty"`
}

CloudMetadataAvailabilityZoneResult is the result for the "cloud_metadata" availability_zone operation.

type CloudMetadataDetectResult added in v1.6.4

type CloudMetadataDetectResult struct {
	Provider string `json:"provider"`
}

CloudMetadataDetectResult is the result for the "cloud_metadata" detect operation.

type CloudMetadataErrorResponse added in v1.6.4

type CloudMetadataErrorResponse struct {
	Operation string `json:"operation,omitempty"`
	Provider  string `json:"provider,omitempty"`
	Error     string `json:"error,omitempty"`
	Message   string `json:"message,omitempty"`
}

CloudMetadataErrorResponse is the error response for the "cloud_metadata" tool.

type CloudMetadataInstanceResult added in v1.6.4

type CloudMetadataInstanceResult struct {
	Provider   string `json:"provider"`
	InstanceID string `json:"instance_id,omitempty"`
	Name       string `json:"name,omitempty"`
	VMSize     string `json:"vm_size,omitempty"`
	Location   string `json:"location,omitempty"`
	Error      string `json:"error,omitempty"`
}

CloudMetadataInstanceResult is the result for the "cloud_metadata" instance operation.

type CloudMetadataInstanceTypeResult added in v1.6.4

type CloudMetadataInstanceTypeResult struct {
	Provider     string `json:"provider"`
	InstanceType string `json:"instance_type"`
	Error        string `json:"error,omitempty"`
}

CloudMetadataInstanceTypeResult is the result for the "cloud_metadata" instance_type operation.

type CloudMetadataRegionResult added in v1.6.4

type CloudMetadataRegionResult struct {
	Provider string `json:"provider"`
	Region   string `json:"region"`
	Error    string `json:"error,omitempty"`
}

CloudMetadataRegionResult is the result for the "cloud_metadata" region operation.

type CloudMetadataRequest added in v1.6.4

type CloudMetadataRequest struct {
	Operation string `json:"operation"`
}

CloudMetadataRequest is the params for the "cloud_metadata" tool.

type CloudMetadataTool added in v1.0.8

type CloudMetadataTool struct{}

CloudMetadataTool provides cloud provider metadata detection and information for AWS, Azure, and GCP.

func (*CloudMetadataTool) Description added in v1.0.8

func (t *CloudMetadataTool) Description() string

Description returns a human-readable description.

func (*CloudMetadataTool) Execute added in v1.0.8

Execute implements the tool logic.

func (*CloudMetadataTool) InputSchema added in v1.0.8

func (t *CloudMetadataTool) InputSchema() *InputSchema

InputSchema returns the JSON Schema for tool validation.

func (*CloudMetadataTool) Name added in v1.0.8

func (t *CloudMetadataTool) Name() string

Name returns the tool identifier.

type CollectionFieldPaths

type CollectionFieldPaths struct {
	AllowedPaths   []string `json:"allowed_paths"`
	ForbiddenPaths []string `json:"forbidden_paths"`
}

CollectionFieldPaths defines allowed and forbidden paths for a collection

type Config added in v1.0.6

type Config struct {
	MCPServers map[string]ServerConfig `json:"mcpServers"`
}

Config represents the top-level MCP client configuration structure. This is the single source of truth for the MCP config schema used by: - CLI commands (mcp agent show) - Tests (test/mcp_stdio_test.go) - Example templates (protocol/examples/mcp_server/g8e_gateway_mcp_config.json)

func NewGatewayConfig added in v1.0.6

func NewGatewayConfig(gatewayURL, clientCertPath, clientKeyPath, caCertPath string) (*Config, error)

NewGatewayConfig creates a standard gateway MCP configuration with the given gateway URL and cert paths.

func NewGatewayConfigWithHostname added in v1.0.10

func NewGatewayConfigWithHostname(gatewayURL, clientCertPath, clientKeyPath, caCertPath, verifyHostname string) (*Config, error)

NewGatewayConfigWithHostname creates a gateway MCP configuration with a custom hostname for verification.

type ConfigDiff

type ConfigDiff struct {
	Key      string `json:"key"`
	Current  string `json:"current,omitempty"`
	Baseline string `json:"baseline,omitempty"`
	Type     string `json:"type"`
}

ConfigDiff represents a configuration difference.

type ConfigDiffMaskRequest

type ConfigDiffMaskRequest struct {
	ConfigPath string `json:"config_path"`
	Baseline   string `json:"baseline"`
}

ConfigDiffMaskRequest is the params for the "config_diff_mask" tool.

type ConfigDiffMaskResult

type ConfigDiffMaskResult struct {
	Differences []ConfigDiff `json:"differences"`
}

ConfigDiffMaskResult is the result for the "config_diff_mask" tool.

type ConfigDiffMaskTool added in v1.0.7

type ConfigDiffMaskTool struct{}

ConfigDiffMaskTool compares configuration files with secret masking.

func (*ConfigDiffMaskTool) Description added in v1.0.7

func (t *ConfigDiffMaskTool) Description() string

Description returns a human-readable description.

func (*ConfigDiffMaskTool) Execute added in v1.0.7

Execute implements the tool logic.

func (*ConfigDiffMaskTool) InputSchema added in v1.0.7

func (t *ConfigDiffMaskTool) InputSchema() *InputSchema

InputSchema returns the JSON Schema for tool validation.

func (*ConfigDiffMaskTool) Name added in v1.0.7

func (t *ConfigDiffMaskTool) Name() string

Name returns the tool identifier.

type DBDiscoverTopologyRequest

type DBDiscoverTopologyRequest struct {
	DatabasePath string `json:"database_path"`
}

DBDiscoverTopologyRequest is the params for the "db_discover_topology" tool.

type DBDiscoverTopologyResult

type DBDiscoverTopologyResult struct {
	Schema map[string]map[string]string `json:"schema"`
}

DBDiscoverTopologyResult is the result for the "db_discover_topology" tool.

type DBDiscoverTopologyTool added in v1.0.7

type DBDiscoverTopologyTool struct{}

DBDiscoverTopologyTool scans database schemas, tables, and column data types.

func (*DBDiscoverTopologyTool) Description added in v1.0.7

func (t *DBDiscoverTopologyTool) Description() string

Description returns a human-readable description.

func (*DBDiscoverTopologyTool) Execute added in v1.0.7

Execute implements the tool logic.

func (*DBDiscoverTopologyTool) InputSchema added in v1.0.7

func (t *DBDiscoverTopologyTool) InputSchema() *InputSchema

InputSchema returns the JSON Schema for tool validation.

func (*DBDiscoverTopologyTool) Name added in v1.0.7

func (t *DBDiscoverTopologyTool) Name() string

Name returns the tool identifier.

type DBIndexTriageRequest

type DBIndexTriageRequest struct {
	DatabasePath string `json:"database_path"`
}

DBIndexTriageRequest is the params for the "db_index_triage" tool.

type DBIndexTriageResult

type DBIndexTriageResult struct {
	Indexes       []IndexInfo `json:"indexes"`
	Fragmentation float64     `json:"fragmentation"`
}

DBIndexTriageResult is the result for the "db_index_triage" tool.

type DBIndexTriageTool added in v1.0.7

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

DBIndexTriageTool queries fragmentation statistics and indexes.

func (*DBIndexTriageTool) Description added in v1.0.7

func (t *DBIndexTriageTool) Description() string

Description returns a human-readable description.

func (*DBIndexTriageTool) Execute added in v1.0.7

Execute implements the tool logic.

func (*DBIndexTriageTool) InputSchema added in v1.0.7

func (t *DBIndexTriageTool) InputSchema() *InputSchema

InputSchema returns the JSON Schema for tool validation.

func (*DBIndexTriageTool) Name added in v1.0.7

func (t *DBIndexTriageTool) Name() string

Name returns the tool identifier.

type DBIsolatedReadRequest

type DBIsolatedReadRequest struct {
	DatabasePath string `json:"database_path"`
	Query        string `json:"query"`
}

DBIsolatedReadRequest is the params for the "db_isolated_read" tool.

type DBIsolatedReadResult

type DBIsolatedReadResult struct {
	Rows    []DBRow  `json:"rows"`
	Columns []string `json:"columns"`
	Error   string   `json:"error,omitempty"`
}

DBIsolatedReadResult is the result for the "db_isolated_read" tool.

type DBIsolatedReadTool added in v1.0.7

type DBIsolatedReadTool struct{}

DBIsolatedReadTool executes SELECT statements in read-only mode.

func (*DBIsolatedReadTool) Description added in v1.0.7

func (t *DBIsolatedReadTool) Description() string

Description returns a human-readable description.

func (*DBIsolatedReadTool) Execute added in v1.0.7

Execute implements the tool logic.

func (*DBIsolatedReadTool) InputSchema added in v1.0.7

func (t *DBIsolatedReadTool) InputSchema() *InputSchema

InputSchema returns the JSON Schema for tool validation.

func (*DBIsolatedReadTool) Name added in v1.0.7

func (t *DBIsolatedReadTool) Name() string

Name returns the tool identifier.

type DBQueryValidateRequest

type DBQueryValidateRequest struct {
	DatabasePath string `json:"database_path"`
	Query        string `json:"query"`
}

DBQueryValidateRequest is the params for the "db_query_validate" tool.

type DBQueryValidateResult

type DBQueryValidateResult struct {
	Valid    bool   `json:"valid"`
	Plan     string `json:"plan,omitempty"`
	Warning  string `json:"warning,omitempty"`
	Rejected bool   `json:"rejected"`
	Reason   string `json:"reason,omitempty"`
}

DBQueryValidateResult is the result for the "db_query_validate" tool.

type DBQueryValidateTool added in v1.0.7

type DBQueryValidateTool struct{}

DBQueryValidateTool validates SQL queries using EXPLAIN QUERY PLAN.

func (*DBQueryValidateTool) Description added in v1.0.7

func (t *DBQueryValidateTool) Description() string

Description returns a human-readable description.

func (*DBQueryValidateTool) Execute added in v1.0.7

Execute implements the tool logic.

func (*DBQueryValidateTool) InputSchema added in v1.0.7

func (t *DBQueryValidateTool) InputSchema() *InputSchema

InputSchema returns the JSON Schema for tool validation.

func (*DBQueryValidateTool) Name added in v1.0.7

func (t *DBQueryValidateTool) Name() string

Name returns the tool identifier.

type DBRow added in v1.1.4

type DBRow struct {
	Values map[string]DBValue `json:"values"`
}

DBRow represents a single database row with typed values.

type DBValue added in v1.1.4

type DBValue struct {
	String  *string  `json:"string,omitempty"`
	Int64   *int64   `json:"int64,omitempty"`
	Float64 *float64 `json:"float64,omitempty"`
	Bool    *bool    `json:"bool,omitempty"`
	Null    bool     `json:"null"`
}

DBValue represents a typed database value.

type DNSAAAARecord added in v1.1.4

type DNSAAAARecord struct {
	IP string `json:"ip"`
}

DNSAAAARecord represents an AAAA record.

type DNSARecord added in v1.1.4

type DNSARecord struct {
	IP string `json:"ip"`
}

DNSARecord represents an A record.

type DNSCNAMERecord added in v1.1.4

type DNSCNAMERecord struct {
	Target string `json:"target"`
}

DNSCNAMERecord represents a CNAME record.

type DNSMXRecord added in v1.0.10

type DNSMXRecord struct {
	Host string `json:"host"`
	Pref uint16 `json:"pref"`
}

DNSMXRecord represents an MX DNS record.

type DNSNSRecord added in v1.1.4

type DNSNSRecord struct {
	Host string `json:"host"`
}

DNSNSRecord represents an NS record.

type DNSRecords added in v1.1.4

type DNSRecords struct {
	A     []DNSARecord    `json:"a,omitempty"`
	AAAA  []DNSAAAARecord `json:"aaaa,omitempty"`
	MX    []DNSMXRecord   `json:"mx,omitempty"`
	TXT   []DNSTXTRecord  `json:"txt,omitempty"`
	CNAME *DNSCNAMERecord `json:"cname,omitempty"`
	NS    []DNSNSRecord   `json:"ns,omitempty"`
}

DNSRecords represents typed DNS record data.

type DNSTXTRecord added in v1.1.4

type DNSTXTRecord struct {
	Text string `json:"text"`
}

DNSTXTRecord represents a TXT record.

type Dependencies

type Dependencies struct {
	Logger           *slog.Logger
	Responder        *response.Writer
	SuspendedStore   storage.SuspendedTransactionStore
	ScrubbingService *scrubbing.ScrubbingService
	ThreatScanner    ThreatScanner
	MaxPayloadBytes  int64
	Posture          string // Gateway posture: doctrine, consensus, or notary
	A2ADownstreamURL string // A2A downstream server URL
	PublicBaseURL    string // Public base URL for approval links

	// AuditStore records audit events for suspended transactions and downstream
	// MCP calls. Required: NewGatewayService returns constants.ErrAuditStoreRequired
	// when nil — a missing audit store is a wiring bug, not a no-op condition.
	AuditStore AuditEventRecorder

	// FieldPathRegistryFactory overrides the default NewFieldPathRegistry constructor.
	// When nil, NewFieldPathRegistry is used. This allows tests to inject a failing
	// factory to verify error handling in NewGatewayService.
	FieldPathRegistryFactory func(*slog.Logger) (*FieldPathRegistry, error)

	EnvProc                governance.EnvelopeProcessor
	StateRootProvider      StateRootProvider
	SigningKey             ed25519.PrivateKey
	KeyID                  string
	DownstreamURL          string
	DBService              FieldReader
	SessionValidator       SessionValidator
	AuditLogger            AuditLogger
	L2ConsensusDeliberator L2ConsensusDeliberator
}

Dependencies groups all dependencies for NewGatewayService.

type DirEntry

type DirEntry struct {
	Path     string `json:"path"`
	SizeMB   int64  `json:"size_mb"`
	IsDir    bool   `json:"is_dir"`
	Modified int64  `json:"modified"`
}

DirEntry represents a directory entry for disk profiling.

type FSDiskProfileRequest

type FSDiskProfileRequest struct {
	Path     string `json:"path"`
	MaxDepth int    `json:"max_depth,omitempty"`
}

FSDiskProfileRequest is the params for the "fs_disk_profile" tool.

type FSDiskProfileResult

type FSDiskProfileResult struct {
	Entries []DirEntry `json:"entries"`
	TotalMB int64      `json:"total_mb"`
}

FSDiskProfileResult is the result for the "fs_disk_profile" tool.

type FSDiskProfileTool added in v1.0.7

type FSDiskProfileTool struct{}

FSDiskProfileTool recursively calculates directory sizes.

func (*FSDiskProfileTool) Description added in v1.0.7

func (t *FSDiskProfileTool) Description() string

Description returns a human-readable description.

func (*FSDiskProfileTool) Execute added in v1.0.7

Execute implements the tool logic.

func (*FSDiskProfileTool) InputSchema added in v1.0.7

func (t *FSDiskProfileTool) InputSchema() *InputSchema

InputSchema returns the JSON Schema for tool validation.

func (*FSDiskProfileTool) Name added in v1.0.7

func (t *FSDiskProfileTool) Name() string

Name returns the tool identifier.

type FSDiskUsageRequest added in v1.0.10

type FSDiskUsageRequest struct {
	Path string `json:"path,omitempty"`
}

FSDiskUsageRequest is the params for the "fs_disk_usage" tool.

type FSDiskUsageResult added in v1.0.10

type FSDiskUsageResult struct {
	Path        string           `json:"path,omitempty"`
	Filesystem  *FilesystemInfo  `json:"filesystem,omitempty"`
	Filesystems []FilesystemInfo `json:"filesystems,omitempty"`
	Count       int              `json:"count,omitempty"`
}

FSDiskUsageResult is the result for the "fs_disk_usage" tool.

type FSDiskUsageTool added in v1.0.8

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

FSDiskUsageTool provides df-style free space reporting.

func (*FSDiskUsageTool) Description added in v1.0.8

func (t *FSDiskUsageTool) Description() string

Description returns a human-readable description.

func (*FSDiskUsageTool) Execute added in v1.0.8

Execute implements the tool logic.

func (*FSDiskUsageTool) InputSchema added in v1.0.8

func (t *FSDiskUsageTool) InputSchema() *InputSchema

InputSchema returns the JSON Schema for tool validation.

func (*FSDiskUsageTool) Name added in v1.0.8

func (t *FSDiskUsageTool) Name() string

Name returns the tool identifier.

type FSFileChecksumRequest added in v1.0.10

type FSFileChecksumRequest struct {
	FilePath string `json:"file_path"`
}

FSFileChecksumRequest represents the input for the file checksum tool.

type FSFileChecksumResult added in v1.0.10

type FSFileChecksumResult struct {
	FilePath  string `json:"file_path"`
	Algorithm string `json:"algorithm"`
	Checksum  string `json:"checksum"`
	SizeBytes int64  `json:"size_bytes"`
}

FSFileChecksumResult represents the output of the file checksum tool.

type FSFileChecksumTool added in v1.0.8

type FSFileChecksumTool struct{}

FSFileChecksumTool computes SHA256 checksums for file integrity verification.

func (*FSFileChecksumTool) Description added in v1.0.8

func (t *FSFileChecksumTool) Description() string

Description returns a human-readable description.

func (*FSFileChecksumTool) Execute added in v1.0.8

Execute implements the tool logic.

func (*FSFileChecksumTool) InputSchema added in v1.0.8

func (t *FSFileChecksumTool) InputSchema() *InputSchema

InputSchema returns the JSON Schema for tool validation.

func (*FSFileChecksumTool) Name added in v1.0.8

func (t *FSFileChecksumTool) Name() string

Name returns the tool identifier.

type FieldPathRegistry

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

FieldPathRegistry holds the schema registry for allowed field paths per collection

func NewFieldPathRegistry

func NewFieldPathRegistry(logger *slog.Logger) (*FieldPathRegistry, error)

NewFieldPathRegistry loads the field path schema from the constants package

func (*FieldPathRegistry) ValidateFieldPath

func (r *FieldPathRegistry) ValidateFieldPath(collection string, fieldPath string) error

ValidateFieldPath checks if a field path is allowed for a given collection

type FieldReadRequest

type FieldReadRequest struct {
	Collection        string `json:"collection"`
	DocumentID        string `json:"document_id"`
	FieldPath         string `json:"field_path"`
	OperatorSessionID string `json:"operator_session_id"`
}

FieldReadRequest is the params for the "read_field" tool.

type FieldReadResult

type FieldReadResult struct {
	Value FieldValue `json:"value"`
}

FieldReadResult is the result for the "read_field" tool.

type FieldReader added in v1.1.0

type FieldReader interface {
	GetField(collection, id, fieldPath string) (FieldValue, error)
}

FieldReader provides read access to individual document fields, backing the MCP gateway's read_field operation. It is implemented by the gateway's document store (DocumentStoreService).

type FieldValue added in v1.1.4

type FieldValue struct {
	Str     *string               `json:"string,omitempty"`
	Int64   *int64                `json:"int64,omitempty"`
	Float64 *float64              `json:"float64,omitempty"`
	Bool    *bool                 `json:"bool,omitempty"`
	Array   []FieldValue          `json:"array,omitempty"`
	Object  map[string]FieldValue `json:"object,omitempty"`
	Null    bool                  `json:"null"`
}

FieldValue represents a typed field value from document storage.

func ConvertToFieldValue added in v1.1.4

func ConvertToFieldValue(val interface{}) FieldValue

ConvertToFieldValue converts an interface{} value (e.g., from JSON unmarshal or DocumentStoreService.GetField) to a typed FieldValue. Exported so the document store layer can use it at the package boundary.

func (FieldValue) String added in v1.1.4

func (v FieldValue) String() string

String returns a human-readable representation of the field value, suitable for display in MCP text content and audit log entries. Implements fmt.Stringer interface.

type FileReadRequest added in v1.0.12

type FileReadRequest struct {
	Path   string `json:"path"`
	Offset int    `json:"offset,omitempty"`
	Limit  int    `json:"limit,omitempty"`
}

FileReadRequest is the params for the "read_file" tool.

type FileReadResult added in v1.0.12

type FileReadResult struct {
	Content string `json:"content"`
	Path    string `json:"path"`
	Offset  int    `json:"offset,omitempty"`
	Limit   int    `json:"limit,omitempty"`
	Error   string `json:"error,omitempty"`
}

FileReadResult is the result for the "read_file" tool.

type FileReadTool added in v1.0.12

type FileReadTool struct{}

FileReadTool reads file contents with path validation and safety checks.

func (*FileReadTool) Description added in v1.0.12

func (t *FileReadTool) Description() string

Description returns a human-readable description.

func (*FileReadTool) Execute added in v1.0.12

func (t *FileReadTool) Execute(ctx context.Context, args json.RawMessage) (CallToolResult, error)

Execute implements the tool logic.

func (*FileReadTool) InputSchema added in v1.0.12

func (t *FileReadTool) InputSchema() *InputSchema

InputSchema returns the JSON Schema for tool validation.

func (*FileReadTool) Name added in v1.0.12

func (t *FileReadTool) Name() string

Name returns the tool identifier.

type FilesystemInfo added in v1.0.10

type FilesystemInfo struct {
	Path           string  `json:"path"`
	TotalBytes     uint64  `json:"total_bytes"`
	UsedBytes      uint64  `json:"used_bytes"`
	FreeBytes      uint64  `json:"free_bytes"`
	AvailableBytes uint64  `json:"available_bytes"`
	UsedPercent    float64 `json:"used_percent"`
}

FilesystemInfo represents filesystem disk usage information.

type GatewayService

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

GatewayService handles MCP/A2A protocol translation and downstream dispatch. This service is shared across both gateway mode and outbound mode - the same implementation is used in both contexts (truly polymorphic).

In gateway mode, it is created by GatewayModeService as field mcpGateway. In outbound mode, it is used by OperatorPubSubService as field mcpGateway.

func NewGatewayService

func NewGatewayService(deps Dependencies) (*GatewayService, error)

func (*GatewayService) DeleteSuspendedTransaction added in v1.0.3

func (g *GatewayService) DeleteSuspendedTransaction(ctx context.Context, txHash string)

DeleteSuspendedTransaction removes a suspended transaction after approval/rejection.

func (*GatewayService) DispatchToA2ADownstream

func (g *GatewayService) DispatchToA2ADownstream(ctx context.Context, skillName string, payload json.RawMessage) (string, error)

DispatchToA2ADownstream forwards a verified A2A call to the downstream A2A server.

func (*GatewayService) DispatchToDownstream

func (g *GatewayService) DispatchToDownstream(ctx context.Context, toolName string, toolArgs json.RawMessage, operatorSessionID string) (string, error)

DispatchToDownstream forwards a verified MCP tool call to the downstream MCP server. This implements the Actuator Egress phase for MCP protocol translation. Native tools are executed locally so every call — native or downstream — passes through the full L1-L5 governance pipeline and produces a signed receipt.

func (*GatewayService) GetSuspendedTransaction

func (g *GatewayService) GetSuspendedTransaction(ctx context.Context, txHash string) (*models.SuspendedTransaction, bool, error)

GetSuspendedTransaction retrieves a suspended transaction by hash.

func (*GatewayService) HandleA2aCall

func (g *GatewayService) HandleA2aCall(w http.ResponseWriter, r *http.Request)

@Summary A2A call @Description Calls an A2A agent endpoint @Tags a2a @Accept json @Produce json @Success 200 {object} map[string]interface{} @Router /api/v1/a2a/call [post]

func (*GatewayService) HandleMCP added in v1.0.7

func (g *GatewayService) HandleMCP(w http.ResponseWriter, r *http.Request)

HandleMCP is the unified MCP Streamable HTTP endpoint. It accepts a single JSON-RPC 2.0 request via POST and dispatches by method through the governed execution pipeline. GET is used for SSE streaming support.

@Summary		MCP endpoint
@Description	Unified MCP JSON-RPC endpoint for AI IDE integration
@Tags			mcp
@Accept			json
@Produce		json
@Success		200	{object}	map[string]interface{}
@Router			/mcp [post]

func (*GatewayService) ResumeWithL3Proof

func (g *GatewayService) ResumeWithL3Proof(ctx context.Context, txHash, userID string, proof *commonv1.L3Proof) (*operatorv1.ActionReceipt, error)

ResumeWithL3Proof re-submits a suspended transaction with an attached L3 WebAuthn proof through the g8e Gateway. The proof is verified inside the Gateway's TransactionVerifier - this method does not perform independent passkey validation, it only re-wires the envelope and calls the same fail-closed entry point used for primary submission.

The signed receipt returned by the Gateway is forwarded to the caller so the OOB approval UI can surface the downstream tool result to the user.

func (*GatewayService) RunMaintenance

func (g *GatewayService) RunMaintenance(ctx context.Context)

RunMaintenance periodically prunes expired suspended transactions. It audits expired transactions before deletion by recording expiry events to the originating session's audit-vault chain, then deletes them.

func (*GatewayService) SetAuditLogger

func (g *GatewayService) SetAuditLogger(l AuditLogger)

SetAuditLogger sets the audit logger. Called by NewGatewayOperatorPubSubService after construction.

func (*GatewayService) SetL2ConsensusDeliberator added in v1.6.4

func (g *GatewayService) SetL2ConsensusDeliberator(d L2ConsensusDeliberator)

SetL2ConsensusDeliberator sets the L2 consensus deliberator. Called after construction when consensus is bootstrapped.

func (*GatewayService) StoreSuspendedTransaction added in v1.0.3

func (g *GatewayService) StoreSuspendedTransaction(ctx context.Context, txHash string, envelope []byte, toolName string, toolArgs json.RawMessage, userID, operatorID string, certFingerprint string)

StoreSuspendedTransaction stores a transaction awaiting L3 approval.

type GetPromptRequest

type GetPromptRequest struct {
	Name      string            `json:"name"`
	Arguments map[string]string `json:"arguments,omitempty"`
}

GetPromptRequest is the params for the "prompts/get" method.

type GetPromptResult

type GetPromptResult struct {
	Description string          `json:"description,omitempty"`
	Messages    []PromptMessage `json:"messages,omitempty"`
}

GetPromptResult is the result for the "prompts/get" method.

type GitOpsTool added in v1.0.8

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

GitOpsTool provides git repository operations including status, log, branch info, and remote management.

func (*GitOpsTool) Description added in v1.0.8

func (t *GitOpsTool) Description() string

Description returns a human-readable description.

func (*GitOpsTool) Execute added in v1.0.8

func (t *GitOpsTool) Execute(ctx context.Context, args json.RawMessage) (CallToolResult, error)

Execute implements the tool logic.

func (*GitOpsTool) InputSchema added in v1.0.8

func (t *GitOpsTool) InputSchema() *InputSchema

InputSchema returns the JSON Schema for tool validation.

func (*GitOpsTool) Name added in v1.0.8

func (t *GitOpsTool) Name() string

Name returns the tool identifier.

type IndexInfo

type IndexInfo struct {
	Name    string   `json:"name"`
	Table   string   `json:"table"`
	Columns []string `json:"columns"`
	Unique  bool     `json:"unique"`
	Used    bool     `json:"used"`
}

IndexInfo represents database index information.

type InitializeResult added in v1.1.9

type InitializeResult struct {
	ProtocolVersion string             `json:"protocolVersion"`
	Capabilities    ServerCapabilities `json:"capabilities"`
	ServerInfo      MCPServerInfo      `json:"serverInfo"`
	Instructions    string             `json:"instructions,omitempty"`
}

InitializeResult is the response to the MCP "initialize" handshake.

type InputSchema added in v1.0.10

type InputSchema struct {
	Type       string                     `json:"type"`
	Properties map[string]*PropertySchema `json:"properties"`
	Required   []string                   `json:"required"`
}

InputSchema represents a JSON Schema for tool input validation.

type JSONRPCError

type JSONRPCError = response.JSONRPCError

JSONRPCError is an alias for response.JSONRPCError

type JSONRPCRequest

type JSONRPCRequest = response.JSONRPCRequest

JSONRPCRequest is an alias for response.JSONRPCRequest

type JSONRPCResponse

type JSONRPCResponse = response.JSONRPCResponse

JSONRPCResponse is an alias for response.JSONRPCResponse

type K8sClusterInfo added in v1.0.10

type K8sClusterInfo struct {
	Version string `json:"version"`
	Context string `json:"context"`
	Cluster string `json:"cluster"`
}

K8sClusterInfo represents Kubernetes cluster information.

type K8sDeploymentInfo added in v1.0.10

type K8sDeploymentInfo struct {
	Name              string `json:"name"`
	Namespace         string `json:"namespace"`
	DesiredReplicas   int    `json:"desired_replicas"`
	AvailableReplicas int    `json:"available_replicas"`
	UpdatedReplicas   int    `json:"updated_replicas"`
	Ready             bool   `json:"ready"`
}

K8sDeploymentInfo represents Kubernetes deployment information.

type K8sInspectRequest added in v1.0.10

type K8sInspectRequest struct {
	Operation string `json:"operation,omitempty"`
	Namespace string `json:"namespace,omitempty"`
	Name      string `json:"name,omitempty"`
	Limit     int    `json:"limit,omitempty"`
}

K8sInspectRequest is the params for the "k8s_inspect" tool.

type K8sInspectResult added in v1.0.10

type K8sInspectResult struct {
	Operation   string              `json:"operation"`
	Namespace   string              `json:"namespace,omitempty"`
	Error       string              `json:"error,omitempty"`
	Pods        []K8sPodInfo        `json:"pods,omitempty"`
	Nodes       []K8sNodeInfo       `json:"nodes,omitempty"`
	Services    []K8sServiceInfo    `json:"services,omitempty"`
	Deployments []K8sDeploymentInfo `json:"deployments,omitempty"`
	Namespaces  []K8sNamespaceInfo  `json:"namespaces,omitempty"`
	ClusterInfo *K8sClusterInfo     `json:"cluster_info,omitempty"`
	PodLogs     *K8sPodLogs         `json:"pod_logs,omitempty"`
	PodDescribe *K8sPodDescribe     `json:"pod_describe,omitempty"`
	Count       int                 `json:"count,omitempty"`
}

K8sInspectResult is the result for the "k8s_inspect" tool.

type K8sInspectTool added in v1.0.8

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

K8sInspectTool provides Kubernetes cluster inspection and pod management operations.

func (*K8sInspectTool) Description added in v1.0.8

func (t *K8sInspectTool) Description() string

Description returns a human-readable description.

func (*K8sInspectTool) Execute added in v1.0.8

Execute implements the tool logic.

func (*K8sInspectTool) InputSchema added in v1.0.8

func (t *K8sInspectTool) InputSchema() *InputSchema

InputSchema returns the JSON Schema for tool validation.

func (*K8sInspectTool) Name added in v1.0.8

func (t *K8sInspectTool) Name() string

Name returns the tool identifier.

type K8sNamespaceInfo added in v1.0.10

type K8sNamespaceInfo struct {
	Name   string `json:"name"`
	Status string `json:"status"`
}

K8sNamespaceInfo represents Kubernetes namespace information.

type K8sNodeInfo added in v1.0.10

type K8sNodeInfo struct {
	Name  string `json:"name"`
	Ready bool   `json:"ready"`
}

K8sNodeInfo represents Kubernetes node information.

type K8sPodDescribe added in v1.0.10

type K8sPodDescribe struct {
	Namespace string `json:"namespace"`
	Pod       string `json:"pod"`
	Describe  string `json:"describe"`
}

K8sPodDescribe represents Kubernetes pod describe output.

type K8sPodInfo added in v1.0.10

type K8sPodInfo struct {
	Name      string `json:"name"`
	Namespace string `json:"namespace"`
	Status    string `json:"status"`
}

K8sPodInfo represents Kubernetes pod information.

type K8sPodLogs added in v1.0.10

type K8sPodLogs struct {
	Namespace string `json:"namespace"`
	Pod       string `json:"pod"`
	Logs      string `json:"logs"`
	Truncated bool   `json:"truncated"`
}

K8sPodLogs represents Kubernetes pod logs.

type K8sServiceInfo added in v1.0.10

type K8sServiceInfo struct {
	Name      string `json:"name"`
	Namespace string `json:"namespace"`
	Type      string `json:"type"`
}

K8sServiceInfo represents Kubernetes service information.

type L2ConsensusDeliberator added in v1.6.4

type L2ConsensusDeliberator interface {
	Deliberate(ctx context.Context, envelopeBytes []byte) ([]byte, error)
}

L2ConsensusDeliberator sends an envelope to an L2 consensus service for deliberation. The consensus service collects signed votes from its members and returns the envelope with L2 metadata populated. This interface is implemented by an HTTP client that calls the consensus service's /consensus/v1/deliberate endpoint, or by an in-process adapter.

type ListPromptsRequest

type ListPromptsRequest struct {
	// Optional cursor for pagination
	Cursor *string `json:"cursor,omitempty"`
}

ListPromptsRequest is the params for the "prompts/list" method.

type ListResourcesRequest

type ListResourcesRequest struct {
	// Optional cursor for pagination
	Cursor *string `json:"cursor,omitempty"`
}

ListResourcesRequest is the params for the "resources/list" method.

type LogStreamFilterRequest

type LogStreamFilterRequest struct {
	LogPath string `json:"log_path"`
	Pattern string `json:"pattern"`
	Limit   int    `json:"limit,omitempty"`
}

LogStreamFilterRequest is the params for the "log_stream_filter" tool.

type LogStreamFilterResult

type LogStreamFilterResult struct {
	Lines []string `json:"lines"`
	Count int      `json:"count"`
}

LogStreamFilterResult is the result for the "log_stream_filter" tool.

type LogStreamFilterTool added in v1.0.7

type LogStreamFilterTool struct{}

LogStreamFilterTool reads log files and applies regex filtering with scrubbing.

func (*LogStreamFilterTool) Description added in v1.0.7

func (t *LogStreamFilterTool) Description() string

Description returns a human-readable description.

func (*LogStreamFilterTool) Execute added in v1.0.7

Execute implements the tool logic.

func (*LogStreamFilterTool) InputSchema added in v1.0.7

func (t *LogStreamFilterTool) InputSchema() *InputSchema

InputSchema returns the JSON Schema for tool validation.

func (*LogStreamFilterTool) Name added in v1.0.7

func (t *LogStreamFilterTool) Name() string

Name returns the tool identifier.

type MCPServerInfo added in v1.1.9

type MCPServerInfo struct {
	Name    string `json:"name"`
	Version string `json:"version"`
}

type Metadata added in v1.1.4

type Metadata struct {
	Custom map[string]string `json:"custom,omitempty"`
}

Metadata represents typed metadata for MCP resources and prompts.

type NTPSelectedPeer added in v1.0.10

type NTPSelectedPeer struct {
	Remote  string `json:"remote"`
	RefID   string `json:"refid"`
	Stratum string `json:"stratum"`
	When    string `json:"when"`
	Poll    string `json:"poll"`
	Reach   string `json:"reach"`
	Delay   string `json:"delay"`
	Offset  string `json:"offset"`
	Jitter  string `json:"jitter"`
}

NTPSelectedPeer represents the selected NTP peer from ntpq.

type NTPStatus added in v1.0.10

type NTPStatus struct {
	Synced           bool             `json:"synced"`
	Status           string           `json:"status"`
	NTPService       string           `json:"ntp_service,omitempty"`
	NTPSynchronized  string           `json:"ntp_synchronized,omitempty"`
	ReferenceID      string           `json:"reference_id,omitempty"`
	Stratum          string           `json:"stratum,omitempty"`
	SystemTimeOffset string           `json:"system_time_offset,omitempty"`
	SelectedPeer     *NTPSelectedPeer `json:"selected_peer,omitempty"`
}

NTPStatus represents NTP synchronization status.

type NativeTool added in v1.0.7

type NativeTool interface {
	// Name returns the unique identifier for this tool.
	Name() string

	// Description returns a human-readable description of what the tool does.
	Description() string

	// InputSchema returns the JSON Schema for validating tool input arguments.
	InputSchema() *InputSchema

	// Execute runs the tool with the provided arguments and returns the result.
	Execute(ctx context.Context, args json.RawMessage) (CallToolResult, error)
}

NativeTool defines the interface that all native tools must implement.

type NativeToolHandler

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

NativeToolHandler executes native tools compiled into the Node binary.

func NewNativeToolHandler

func NewNativeToolHandler(logger *slog.Logger) (*NativeToolHandler, error)

NewNativeToolHandler creates a new native tool handler with all native tools explicitly registered. This avoids init()-based auto-registration and mutable global state.

func (*NativeToolHandler) HandleTool

func (h *NativeToolHandler) HandleTool(ctx context.Context, toolName string, arguments json.RawMessage) (CallToolResult, error)

HandleTool executes a native tool by name and returns the result.

func (*NativeToolHandler) ListTools added in v1.0.7

func (h *NativeToolHandler) ListTools() []NativeTool

ListTools returns all registered native tools.

type NetDNSResolveRequest added in v1.0.10

type NetDNSResolveRequest struct {
	Hostname   string `json:"hostname"`
	RecordType string `json:"record_type,omitempty"`
}

NetDNSResolveRequest is the params for the "net_dns_resolve" tool.

type NetDNSResolveResult added in v1.0.10

type NetDNSResolveResult struct {
	Hostname   string     `json:"hostname"`
	RecordType string     `json:"record_type"`
	Records    DNSRecords `json:"records"`
	Count      int        `json:"count"`
	Error      string     `json:"error,omitempty"`
}

NetDNSResolveResult is the result for the "net_dns_resolve" tool.

type NetDNSResolveTool added in v1.0.8

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

NetDNSResolveTool performs DNS resolution similar to dig/nslookup for network debugging.

func (*NetDNSResolveTool) Description added in v1.0.8

func (t *NetDNSResolveTool) Description() string

Description returns a human-readable description.

func (*NetDNSResolveTool) Execute added in v1.0.8

Execute implements the tool logic.

func (*NetDNSResolveTool) InputSchema added in v1.0.8

func (t *NetDNSResolveTool) InputSchema() *InputSchema

InputSchema returns the JSON Schema for tool validation.

func (*NetDNSResolveTool) Name added in v1.0.8

func (t *NetDNSResolveTool) Name() string

Name returns the tool identifier.

type NetEndpointPingRequest

type NetEndpointPingRequest struct {
	Host string `json:"host"`
	Port int    `json:"port"`
}

NetEndpointPingRequest is the params for the "net_endpoint_ping" tool.

type NetEndpointPingResult

type NetEndpointPingResult struct {
	Reachable bool    `json:"reachable"`
	LatencyMs float64 `json:"latency_ms"`
	Error     string  `json:"error,omitempty"`
}

NetEndpointPingResult is the result for the "net_endpoint_ping" tool.

type NetEndpointPingTool added in v1.0.7

type NetEndpointPingTool struct{}

NetEndpointPingTool performs TCP handshake to verify connectivity.

func (*NetEndpointPingTool) Description added in v1.0.7

func (t *NetEndpointPingTool) Description() string

Description returns a human-readable description

func (*NetEndpointPingTool) Execute added in v1.0.7

Execute implements the tool logic

func (*NetEndpointPingTool) InputSchema added in v1.0.7

func (t *NetEndpointPingTool) InputSchema() *InputSchema

InputSchema returns the JSON Schema for tool validation

func (*NetEndpointPingTool) Name added in v1.0.7

func (t *NetEndpointPingTool) Name() string

Name returns the tool identifier

type NetHTTPProbeRequest

type NetHTTPProbeRequest struct {
	URL    string `json:"url"`
	Method string `json:"method,omitempty"`
}

NetHTTPProbeRequest is the params for the "net_http_probe" tool.

type NetHTTPProbeResult

type NetHTTPProbeResult struct {
	StatusCode int               `json:"status_code"`
	Headers    map[string]string `json:"headers"`
	LatencyMs  float64           `json:"latency_ms"`
	Error      string            `json:"error,omitempty"`
}

NetHTTPProbeResult is the result for the "net_http_probe" tool.

type NetHTTPProbeTool added in v1.0.7

type NetHTTPProbeTool struct{}

NetHTTPProbeTool performs lightweight HTTP requests.

func (*NetHTTPProbeTool) Description added in v1.0.7

func (t *NetHTTPProbeTool) Description() string

Description returns a human-readable description.

func (*NetHTTPProbeTool) Execute added in v1.0.7

Execute implements the tool logic.

func (*NetHTTPProbeTool) InputSchema added in v1.0.7

func (t *NetHTTPProbeTool) InputSchema() *InputSchema

InputSchema returns the JSON Schema for tool validation.

func (*NetHTTPProbeTool) Name added in v1.0.7

func (t *NetHTTPProbeTool) Name() string

Name returns the tool identifier.

type NetSSHKnownHostsRequest added in v1.0.10

type NetSSHKnownHostsRequest struct {
	SSHConfigPath  string `json:"ssh_config_path,omitempty"`
	KnownHostsPath string `json:"known_hosts_path,omitempty"`
}

NetSSHKnownHostsRequest is the params for the "net_ssh_known_hosts" tool.

type NetSSHKnownHostsResult added in v1.0.10

type NetSSHKnownHostsResult struct {
	ConfigHosts    []SSHConfigHost `json:"config_hosts"`
	KnownHosts     []SSHKnownHost  `json:"known_hosts"`
	OS             string          `json:"os"`
	ConfigPath     string          `json:"config_path"`
	KnownHostsPath string          `json:"known_hosts_path"`
}

NetSSHKnownHostsResult is the result for the "net_ssh_known_hosts" tool.

type NetSSHKnownHostsTool added in v1.0.10

type NetSSHKnownHostsTool struct{}

NetSSHKnownHostsTool lists known hosts from SSH config and known_hosts files.

func (*NetSSHKnownHostsTool) Description added in v1.0.10

func (t *NetSSHKnownHostsTool) Description() string

Description returns a human-readable description.

func (*NetSSHKnownHostsTool) Execute added in v1.0.10

Execute implements the tool logic.

func (*NetSSHKnownHostsTool) InputSchema added in v1.0.10

func (t *NetSSHKnownHostsTool) InputSchema() *InputSchema

InputSchema returns the JSON Schema for tool validation.

func (*NetSSHKnownHostsTool) Name added in v1.0.10

func (t *NetSSHKnownHostsTool) Name() string

Name returns the tool identifier.

type NetSocketAuditRequest

type NetSocketAuditRequest struct {
	Protocol string `json:"protocol,omitempty"`
}

NetSocketAuditRequest is the params for the "net_socket_audit" tool.

type NetSocketAuditResult

type NetSocketAuditResult struct {
	Sockets []SocketInfo `json:"sockets"`
}

NetSocketAuditResult is the result for the "net_socket_audit" tool.

type NetSocketAuditTool added in v1.0.7

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

NetSocketAuditTool inspects active network sockets.

func (*NetSocketAuditTool) Description added in v1.0.7

func (t *NetSocketAuditTool) Description() string

Description returns a human-readable description.

func (*NetSocketAuditTool) Execute added in v1.0.7

Execute implements the tool logic.

func (*NetSocketAuditTool) InputSchema added in v1.0.7

func (t *NetSocketAuditTool) InputSchema() *InputSchema

InputSchema returns the JSON Schema for tool validation.

func (*NetSocketAuditTool) Name added in v1.0.7

func (t *NetSocketAuditTool) Name() string

Name returns the tool identifier.

type NoopAuditEventRecorder added in v1.7.5

type NoopAuditEventRecorder struct{}

NoopAuditEventRecorder is a no-op implementation of AuditEventRecorder, retained for test helpers that construct GatewayService via NewGatewayService or directly. NewGatewayService never defaults to this type; a nil AuditStore is a construction error (constants.ErrAuditStoreRequired). Tests that do not exercise audit recording pass NoopAuditEventRecorder{} explicitly.

func (NoopAuditEventRecorder) RecordEvent added in v1.7.5

func (NoopAuditEventRecorder) RecordEvent(*storage.Event) (int64, error)

type NoopFieldReader added in v1.6.6

type NoopFieldReader struct{}

NoopFieldReader is a no-op implementation of FieldReader. It returns an empty FieldValue with no error. Used in tests; production outbound mode uses nil with explicit nil-checks.

func (NoopFieldReader) GetField added in v1.6.6

type OOMEvent

type OOMEvent struct {
	Timestamp string `json:"timestamp"`
	PID       int    `json:"pid"`
	Process   string `json:"process"`
	MemoryMB  int    `json:"memory_mb"`
}

OOMEvent represents an OOM killer event.

type OSInfo added in v1.0.10

type OSInfo struct {
	OS          string `json:"os"`
	Arch        string `json:"arch"`
	Kernel      string `json:"kernel"`
	OSVersion   string `json:"os_version"`
	Uptime      string `json:"uptime"`
	LoadAverage string `json:"load_average"`
}

OSInfo represents operating system information.

type OperatorDeployRequest added in v1.0.10

type OperatorDeployRequest struct {
	Hostnames      []string `json:"hostnames"`
	OperatorBinary string   `json:"operator_binary,omitempty"`
	OperatorArgs   []string `json:"operator_args,omitempty"`
	Timeout        int      `json:"timeout,omitempty"`
}

OperatorDeployRequest is the params for the "operator_deploy" tool.

type OperatorDeployResult added in v1.0.10

type OperatorDeployResult struct {
	Deployments []OperatorDeploymentResult `json:"deployments"`
}

OperatorDeployResult is the result for the "operator_deploy" tool.

type OperatorDeployTool added in v1.0.10

type OperatorDeployTool struct{}

OperatorDeployTool deploys the g8e operator to remote hosts.

func (*OperatorDeployTool) Description added in v1.0.10

func (t *OperatorDeployTool) Description() string

Description returns a human-readable description.

func (*OperatorDeployTool) Execute added in v1.0.10

Execute implements the tool logic.

func (*OperatorDeployTool) InputSchema added in v1.0.10

func (t *OperatorDeployTool) InputSchema() *InputSchema

InputSchema returns the JSON Schema for tool validation.

func (*OperatorDeployTool) Name added in v1.0.10

func (t *OperatorDeployTool) Name() string

Name returns the tool identifier.

type OperatorDeploymentResult added in v1.0.10

type OperatorDeploymentResult struct {
	Hostname string `json:"hostname"`
	Success  bool   `json:"success"`
	Message  string `json:"message"`
	Error    string `json:"error,omitempty"`
	Output   string `json:"output,omitempty"`
}

OperatorDeploymentResult represents the deployment result for a single host.

type ProcMetricTopRequest

type ProcMetricTopRequest struct {
	Limit int `json:"limit,omitempty"`
}

ProcMetricTopRequest is the params for the "proc_metric_top" tool.

type ProcMetricTopResult

type ProcMetricTopResult struct {
	Processes []ProcessInfo `json:"processes"`
}

ProcMetricTopResult is the result for the "proc_metric_top" tool.

type ProcMetricTopTool added in v1.0.7

type ProcMetricTopTool struct{}

ProcMetricTopTool parses /proc to extract top resource-consuming processes.

func (*ProcMetricTopTool) Description added in v1.0.7

func (t *ProcMetricTopTool) Description() string

Description returns a human-readable description.

func (*ProcMetricTopTool) Execute added in v1.0.7

Execute implements the tool logic.

func (*ProcMetricTopTool) InputSchema added in v1.0.7

func (t *ProcMetricTopTool) InputSchema() *InputSchema

InputSchema returns the JSON Schema for tool validation.

func (*ProcMetricTopTool) Name added in v1.0.7

func (t *ProcMetricTopTool) Name() string

Name returns the tool identifier.

type ProcSignalSafeRequest

type ProcSignalSafeRequest struct {
	PID    int    `json:"pid"`
	Signal string `json:"signal"`
}

ProcSignalSafeRequest is the params for the "proc_signal_safe" tool.

type ProcSignalSafeResult

type ProcSignalSafeResult struct {
	Sent   bool   `json:"sent"`
	PID    int    `json:"pid"`
	Signal string `json:"signal"`
	Error  string `json:"error,omitempty"`
}

ProcSignalSafeResult is the result for the "proc_signal_safe" tool.

type ProcSignalSafeTool added in v1.0.7

type ProcSignalSafeTool struct{}

ProcSignalSafeTool sends signals to processes with denylist enforcement.

func (*ProcSignalSafeTool) Description added in v1.0.7

func (t *ProcSignalSafeTool) Description() string

Description returns a human-readable description.

func (*ProcSignalSafeTool) Execute added in v1.0.7

Execute implements the tool logic.

func (*ProcSignalSafeTool) InputSchema added in v1.0.7

func (t *ProcSignalSafeTool) InputSchema() *InputSchema

InputSchema returns the JSON Schema for tool validation.

func (*ProcSignalSafeTool) Name added in v1.0.7

func (t *ProcSignalSafeTool) Name() string

Name returns the tool identifier.

type ProcTreeTool added in v1.0.8

type ProcTreeTool struct{}

ProcTreeTool provides parent-child process relationships.

func (*ProcTreeTool) Description added in v1.0.8

func (t *ProcTreeTool) Description() string

Description returns a human-readable description.

func (*ProcTreeTool) Execute added in v1.0.8

func (t *ProcTreeTool) Execute(ctx context.Context, args json.RawMessage) (CallToolResult, error)

Execute implements the tool logic.

func (*ProcTreeTool) InputSchema added in v1.0.8

func (t *ProcTreeTool) InputSchema() *InputSchema

InputSchema returns the JSON Schema for tool validation.

func (*ProcTreeTool) Name added in v1.0.8

func (t *ProcTreeTool) Name() string

Name returns the tool identifier.

type ProcessInfo

type ProcessInfo struct {
	PID        int     `json:"pid"`
	Name       string  `json:"name"`
	CPUPercent float64 `json:"cpu_percent"`
	MemoryMB   float64 `json:"memory_mb"`
	User       string  `json:"user"`
	Command    string  `json:"command"`
}

ProcessInfo represents process information from /proc.

type Prompt

type Prompt struct {
	Name        string           `json:"name"`
	Description string           `json:"description,omitempty"`
	Arguments   []PromptArgument `json:"arguments,omitempty"`
	Metadata    *Metadata        `json:"metadata,omitempty"`
}

Prompt represents an MCP prompt template.

type PromptArgument

type PromptArgument struct {
	Name        string `json:"name"`
	Description string `json:"description,omitempty"`
	Required    bool   `json:"required,omitempty"`
}

PromptArgument represents an argument for a prompt template.

type PromptMessage

type PromptMessage struct {
	Role    string      `json:"role"`
	Content TextContent `json:"content"`
}

PromptMessage represents a message in a prompt template.

type PromptsCapability added in v1.1.9

type PromptsCapability struct{}

type PromptsListResult

type PromptsListResult struct {
	Prompts []Prompt `json:"prompts"`
}

PromptsListResult is the result for the "prompts/list" method.

type PropertySchema added in v1.0.10

type PropertySchema struct {
	Type        string   `json:"type"`
	Description string   `json:"description,omitempty"`
	Enum        []string `json:"enum,omitempty"`
}

PropertySchema represents a JSON Schema property definition.

type ReadResourceRequest

type ReadResourceRequest struct {
	URI string `json:"uri"`
}

ReadResourceRequest is the params for the "resources/read" method.

type ReadResourceResult

type ReadResourceResult struct {
	Contents []TextContent `json:"contents"`
	MIMEType string        `json:"mimeType,omitempty"`
}

ReadResourceResult is the result for the "resources/read" method.

type Resource

type Resource struct {
	URI         string    `json:"uri"`
	Name        string    `json:"name"`
	Description string    `json:"description,omitempty"`
	MimeType    string    `json:"mimeType,omitempty"`
	Metadata    *Metadata `json:"metadata,omitempty"`
}

Resource represents an MCP resource.

type ResourceTemplate added in v1.1.9

type ResourceTemplate struct {
	URITemplate string `json:"uriTemplate"`
	Name        string `json:"name"`
	Description string `json:"description,omitempty"`
	MIMEType    string `json:"mimeType,omitempty"`
}

ResourceTemplate represents an MCP resource template with a URI pattern.

type ResourcesCapability added in v1.1.9

type ResourcesCapability struct{}

type ResourcesListResult

type ResourcesListResult struct {
	Resources []Resource `json:"resources"`
}

ResourcesListResult is the result for the "resources/list" method.

type RunShellCommandRequest added in v1.0.12

type RunShellCommandRequest struct {
	Command    string   `json:"command"`
	Args       []string `json:"args,omitempty"`
	Timeout    int      `json:"timeout,omitempty"`
	WorkingDir string   `json:"working_dir,omitempty"`
	Hostnames  []string `json:"hostnames,omitempty"`
}

RunShellCommandRequest is the params for the "run_shell_command" tool.

type RunShellCommandResult added in v1.0.12

type RunShellCommandResult struct {
	ExitCode int    `json:"exit_code"`
	Stdout   string `json:"stdout"`
	Stderr   string `json:"stderr"`
	TimedOut bool   `json:"timed_out"`
	Error    string `json:"error,omitempty"`
	Hostname string `json:"hostname,omitempty"`
}

RunShellCommandResult is the result for the "run_shell_command" tool.

type RunShellCommandTool added in v1.0.12

type RunShellCommandTool struct{}

RunShellCommandTool runs shell commands with denylist enforcement and timeout limits.

func (*RunShellCommandTool) Description added in v1.0.12

func (t *RunShellCommandTool) Description() string

Description returns a human-readable description.

func (*RunShellCommandTool) Execute added in v1.0.12

Execute implements the tool logic.

func (*RunShellCommandTool) InputSchema added in v1.0.12

func (t *RunShellCommandTool) InputSchema() *InputSchema

InputSchema returns the JSON Schema for tool validation.

func (*RunShellCommandTool) Name added in v1.0.12

func (t *RunShellCommandTool) Name() string

Name returns the tool identifier.

type SSHConfigHost added in v1.0.10

type SSHConfigHost struct {
	Pattern       string   `json:"pattern"`
	Hostname      string   `json:"hostname"`
	User          string   `json:"user"`
	Port          string   `json:"port"`
	IdentityFiles []string `json:"identity_files"`
	ProxyCommand  string   `json:"proxy_command"`
}

SSHConfigHost represents a host from SSH config.

type SSHKnownHost added in v1.0.10

type SSHKnownHost struct {
	HostPattern string `json:"host_pattern"`
	KeyType     string `json:"key_type"`
	KeyHash     string `json:"key_hash"`
}

SSHKnownHost represents a host from known_hosts file.

type ServerCapabilities added in v1.1.9

type ServerCapabilities struct {
	Tools     ToolsCapability     `json:"tools"`
	Resources ResourcesCapability `json:"resources"`
	Prompts   PromptsCapability   `json:"prompts"`
}

ServerCapabilities describes the server's supported MCP features.

type ServerConfig added in v1.0.6

type ServerConfig struct {
	Transport    TransportConfig `json:"transport"`
	TLS          *TLSConfig      `json:"tls,omitempty"`
	Capabilities Capabilities    `json:"capabilities"`
	Description  string          `json:"description"`
	Notes        []string        `json:"notes"`
}

ServerConfig represents a single MCP server configuration.

type SessionValidator

type SessionValidator interface {
	ValidateSession(operatorSessionID string) (bool, error)
}

SessionValidator validates Operator sessions for L3 authorization

type SimpleConfig added in v1.0.10

type SimpleConfig struct {
	MCPServers map[string]SimpleStdioServerConfig `json:"mcpServers"`
}

SimpleConfig represents a simplified MCP client configuration structure.

func NewStdioConfigSimple added in v1.0.10

func NewStdioConfigSimple(g8eBinaryPath string) (*SimpleConfig, error)

NewStdioConfigSimple creates a simplified stdio transport MCP configuration for local native tools. This format is compatible with Cursor/Devin MCP clients.

type SimpleStdioServerConfig added in v1.0.10

type SimpleStdioServerConfig struct {
	Command  string   `json:"command"`
	Args     []string `json:"args"`
	Disabled bool     `json:"disabled"`
}

SimpleStdioServerConfig represents a simplified MCP server configuration for stdio transport. This format is compatible with Cursor/Devin MCP clients.

type SocketInfo

type SocketInfo struct {
	Protocol   string `json:"protocol"`
	LocalAddr  string `json:"local_addr"`
	LocalPort  int    `json:"local_port"`
	RemoteAddr string `json:"remote_addr,omitempty"`
	RemotePort int    `json:"remote_port,omitempty"`
	State      string `json:"state,omitempty"`
	PID        int    `json:"pid,omitempty"`
	Process    string `json:"process,omitempty"`
}

SocketInfo represents network socket information.

type StateRootProvider

type StateRootProvider interface {
	GetCurrentStateRoot() (string, error)
}

StateRootProvider defines the interface for obtaining the current state root.

type SuspendedTransaction

type SuspendedTransaction = models.SuspendedTransaction

SuspendedTransaction is an alias for the shared models type.

type SysContainerStatusTool added in v1.0.8

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

SysContainerStatusTool checks container health status (podman).

func (*SysContainerStatusTool) Description added in v1.0.8

func (t *SysContainerStatusTool) Description() string

Description returns a human-readable description.

func (*SysContainerStatusTool) Execute added in v1.0.8

Execute implements the tool logic.

func (*SysContainerStatusTool) InputSchema added in v1.0.8

func (t *SysContainerStatusTool) InputSchema() *InputSchema

InputSchema returns the JSON Schema for tool validation.

func (*SysContainerStatusTool) Name added in v1.0.8

func (t *SysContainerStatusTool) Name() string

Name returns the tool identifier.

type SysEnvVarsTool added in v1.0.8

type SysEnvVarsTool struct{}

SysEnvVarsTool reads environment variables for configuration debugging.

func (*SysEnvVarsTool) Description added in v1.0.8

func (t *SysEnvVarsTool) Description() string

Description returns a human-readable description.

func (*SysEnvVarsTool) Execute added in v1.0.8

Execute implements the tool logic.

func (*SysEnvVarsTool) InputSchema added in v1.0.8

func (t *SysEnvVarsTool) InputSchema() *InputSchema

InputSchema returns the JSON Schema for tool validation.

func (*SysEnvVarsTool) Name added in v1.0.8

func (t *SysEnvVarsTool) Name() string

Name returns the tool identifier.

type SysInfoRequest added in v1.0.10

type SysInfoRequest struct{}

SysInfoRequest is the params for the "sys_info" tool.

type SysInfoResult added in v1.0.10

type SysInfoResult struct {
	Hostname string `json:"hostname"`
	OS       OSInfo `json:"os"`
}

SysInfoResult is the result for the "sys_info" tool.

type SysInfoTool added in v1.0.8

type SysInfoTool struct{}

SysInfoTool provides system information including hostname, OS version, kernel, uptime, and load average.

func (*SysInfoTool) Description added in v1.0.8

func (t *SysInfoTool) Description() string

Description returns a human-readable description.

func (*SysInfoTool) Execute added in v1.0.8

func (t *SysInfoTool) Execute(ctx context.Context, args json.RawMessage) (CallToolResult, error)

Execute implements the tool logic.

func (*SysInfoTool) InputSchema added in v1.0.8

func (t *SysInfoTool) InputSchema() *InputSchema

InputSchema returns the JSON Schema for tool validation.

func (*SysInfoTool) Name added in v1.0.8

func (t *SysInfoTool) Name() string

Name returns the tool identifier.

type SysOOMDetectRequest

type SysOOMDetectRequest struct {
	LogPath string `json:"log_path,omitempty"`
}

SysOOMDetectRequest is the params for the "sys_oom_detect" tool.

type SysOOMDetectResult

type SysOOMDetectResult struct {
	Events []OOMEvent `json:"events"`
}

SysOOMDetectResult is the result for the "sys_oom_detect" tool.

type SysOOMDetectTool added in v1.0.7

type SysOOMDetectTool struct{}

SysOOMDetectTool scans system logs for OOM killer events.

func (*SysOOMDetectTool) Description added in v1.0.7

func (t *SysOOMDetectTool) Description() string

Description returns a human-readable description.

func (*SysOOMDetectTool) Execute added in v1.0.7

Execute implements the tool logic.

func (*SysOOMDetectTool) InputSchema added in v1.0.7

func (t *SysOOMDetectTool) InputSchema() *InputSchema

InputSchema returns the JSON Schema for tool validation.

func (*SysOOMDetectTool) Name added in v1.0.7

func (t *SysOOMDetectTool) Name() string

Name returns the tool identifier.

type SysServiceStatusRequest added in v1.1.4

type SysServiceStatusRequest struct {
	ServiceName string `json:"service_name"`
}

SysServiceStatusRequest is the params for the "sys_service_status" tool.

type SysServiceStatusResult added in v1.1.4

type SysServiceStatusResult struct {
	ServiceName string `json:"service_name"`
	LoadState   string `json:"load_state"`
	ActiveState string `json:"active_state"`
	SubState    string `json:"sub_state"`
	Enabled     bool   `json:"enabled"`
	Description string `json:"description"`
	MainPID     string `json:"main_pid"`
	ExecStart   string `json:"exec_start"`
	Error       string `json:"error,omitempty"`
}

SysServiceStatusResult is the result for the "sys_service_status" tool.

type SysServiceStatusTool added in v1.0.8

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

SysServiceStatusTool checks systemd service status.

func (*SysServiceStatusTool) Description added in v1.0.8

func (t *SysServiceStatusTool) Description() string

Description returns a human-readable description.

func (*SysServiceStatusTool) Execute added in v1.0.8

Execute implements the tool logic.

func (*SysServiceStatusTool) InputSchema added in v1.0.8

func (t *SysServiceStatusTool) InputSchema() *InputSchema

InputSchema returns the JSON Schema for tool validation.

func (*SysServiceStatusTool) Name added in v1.0.8

func (t *SysServiceStatusTool) Name() string

Name returns the tool identifier.

type SysTimeClockRequest added in v1.0.10

type SysTimeClockRequest struct{}

SysTimeClockRequest is the params for the "sys_time_clock" tool.

type SysTimeClockResult added in v1.0.10

type SysTimeClockResult struct {
	SystemTime SystemTimeInfo `json:"system_time"`
	NTP        NTPStatus      `json:"ntp"`
}

SysTimeClockResult is the result for the "sys_time_clock" tool.

type SysTimeClockTool added in v1.0.8

type SysTimeClockTool struct{}

SysTimeClockTool provides NTP sync status and system time verification.

func (*SysTimeClockTool) Description added in v1.0.8

func (t *SysTimeClockTool) Description() string

Description returns a human-readable description.

func (*SysTimeClockTool) Execute added in v1.0.8

Execute implements the tool logic.

func (*SysTimeClockTool) InputSchema added in v1.0.8

func (t *SysTimeClockTool) InputSchema() *InputSchema

InputSchema returns the JSON Schema for tool validation.

func (*SysTimeClockTool) Name added in v1.0.8

func (t *SysTimeClockTool) Name() string

Name returns the tool identifier.

type SystemTimeInfo added in v1.0.10

type SystemTimeInfo struct {
	UTC      string `json:"utc"`
	Local    string `json:"local"`
	Unix     int64  `json:"unix"`
	UnixNano int64  `json:"unix_nano"`
	Timezone string `json:"timezone"`
	Offset   string `json:"offset"`
}

SystemTimeInfo represents system time information.

type TLSCertInspectTool added in v1.0.8

type TLSCertInspectTool struct{}

TLSCertInspectTool parses TLS certificates, verifies chains, and checks expiration.

func (*TLSCertInspectTool) Description added in v1.0.8

func (t *TLSCertInspectTool) Description() string

Description returns a human-readable description.

func (*TLSCertInspectTool) Execute added in v1.0.8

Execute implements the tool logic.

func (*TLSCertInspectTool) InputSchema added in v1.0.8

func (t *TLSCertInspectTool) InputSchema() *InputSchema

InputSchema returns the JSON Schema for tool validation.

func (*TLSCertInspectTool) Name added in v1.0.8

func (t *TLSCertInspectTool) Name() string

Name returns the tool identifier.

type TLSConfig added in v1.0.6

type TLSConfig struct {
	ClientCertificateEnv string `json:"clientCertificateEnv,omitempty"`
	ClientKeyEnv         string `json:"clientKeyEnv,omitempty"`
	CACertificateEnv     string `json:"caCertificateEnv,omitempty"`
	ClientCertificate    string `json:"clientCertificate,omitempty"`
	ClientKey            string `json:"clientKey,omitempty"`
	CACertificate        string `json:"caCertificate,omitempty"`
	VerifyServer         bool   `json:"verifyServer"`
	VerifyHostname       string `json:"verifyHostname"`
}

TLSConfig represents TLS configuration for HTTP transport.

type TextContent

type TextContent struct {
	Type string `json:"type"`
	Text string `json:"text"`
}

TextContent represents a text part of a tool response.

type ThreatScanner added in v1.6.4

type ThreatScanner interface {
	AnalyzeCommand(input string) []governance.ThreatSignal
}

ThreatScanner scans input strings for security threats using L1 doctrine patterns. Implemented by governance.L1Doctrine.

type Tool

type Tool struct {
	Name        string       `json:"name"`
	Description string       `json:"description,omitempty"`
	InputSchema *InputSchema `json:"inputSchema,omitempty"`
}

Tool represents an MCP tool.

type ToolRegistry added in v1.0.7

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

ToolRegistry manages tool registration and lookup in a thread-safe manner.

func NewToolRegistry added in v1.0.7

func NewToolRegistry() *ToolRegistry

NewToolRegistry creates a new empty tool registry.

func (*ToolRegistry) Count added in v1.0.7

func (r *ToolRegistry) Count() int

Count returns the number of registered tools.

func (*ToolRegistry) Get added in v1.0.7

func (r *ToolRegistry) Get(name string) (NativeTool, bool)

Get retrieves a tool by name. Returns the tool and true if found, nil and false otherwise.

func (*ToolRegistry) List added in v1.0.7

func (r *ToolRegistry) List() []NativeTool

List returns all registered tools.

func (*ToolRegistry) Register added in v1.0.7

func (r *ToolRegistry) Register(tool NativeTool) error

Register adds a tool to the registry. Returns an error if a tool with the same name is already registered.

type ToolsCapability added in v1.1.9

type ToolsCapability struct {
	ListChanged bool `json:"listChanged"`
}

type ToolsListResult

type ToolsListResult struct {
	Tools []Tool `json:"tools"`
}

ToolsListResult is the result for the "tools/list" method.

type TransportConfig added in v1.0.6

type TransportConfig struct {
	Type    string            `json:"type"`
	URL     string            `json:"url,omitempty"`
	Command string            `json:"command,omitempty"`
	Args    []string          `json:"args,omitempty"`
	Headers map[string]string `json:"headers,omitempty"`
}

TransportConfig represents the transport configuration.

Jump to

Keyboard shortcuts

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