Documentation
¶
Overview ¶
Package processor provides execution logic for MCP request/response processors.
Package processor provides execution logic for MCP request/response processors.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatMCPError ¶
func FormatMCPError(result *ChainResult, requestID interface{}) (string, error)
FormatMCPError formats a processor rejection/error as an MCP-compatible error response. Returns a JSON-RPC 2.0 error response with processor details in the data field.
Types ¶
type Chain ¶
type Chain struct {
// contains filtered or unexported fields
}
Chain executes a sequence of processors on MCP messages.
func NewChain ¶
func NewChain(processors []*config.ProcessorConfig, serverName, sessionID string) (*Chain, error)
NewChain creates a new processor chain.
func (*Chain) Execute ¶
func (c *Chain) Execute(event common.McpEventInterface) (*ChainResult, error)
Execute runs all enabled processors sequentially on the payload.
func (*Chain) HasProcessors ¶
HasProcessors returns true if the chain has any enabled processors.
type ChainResult ¶
type ChainResult struct {
Status int // Final status code (200, 40x, 50x)
ModifiedPayload map[string]interface{} // Final payload after all processors
Error *string // Error message if status >= 400
ProcessorChain []string // Names of processors that executed
Metadata map[string]interface{} // Aggregated processor metadata
}
ChainResult represents the result of executing a processor chain.
type Executor ¶
type Executor struct {
// WorkingDir is the directory where processor commands are executed.
// Defaults to user's home directory.
WorkingDir string
}
Executor handles processor execution with timeout and error handling.
func NewExecutor ¶
NewExecutor creates a new processor executor.
func (*Executor) Execute ¶
func (e *Executor) Execute(processorConfig *config.ProcessorConfig, input *config.ProcessorInput) (*config.ProcessorOutput, error)
Execute runs a processor with the given input and returns the output. It handles CLI processor execution with timeout, JSON marshaling, and error handling.