Help us shape the future of Go! Take the 2026 Go Developer Survey

processor

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

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.

func RunScaffoldInteractive

func RunScaffoldInteractive(in io.Reader, out io.Writer) error

RunScaffoldInteractive creates a processor scaffold via interactive prompts.

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

func (c *Chain) HasProcessors() bool

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

func NewExecutor() (*Executor, error)

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.

Jump to

Keyboard shortcuts

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