mcpstdio

package
v0.82.2 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AttachContextOrStderr

func AttachContextOrStderr(ctx context.Context, err error, stderr *StderrBuffer) error

func AttachNotifications

func AttachNotifications(result map[string]any, notifications []RPCEnvelope)

func AttachStderr

func AttachStderr(err error, stderr *StderrBuffer) error

func IDMatches

func IDMatches(value any, want int) bool

func RunCallTool

func RunCallTool(options Options, name string, arguments map[string]any) (map[string]any, error)

func RunListTools

func RunListTools(options Options) (map[string]any, error)

func RunRequest

func RunRequest(options Options, method string, params map[string]any) (map[string]any, error)

func WriteNotification

func WriteNotification(writer io.Writer, method string, params any) error

func WriteRequest

func WriteRequest(writer io.Writer, id int, method string, params any) error

Types

type Options

type Options struct {
	Command []string
	Env     map[string]string
	Timeout time.Duration
	Hooks   ProcessHooks
}

type ProcessHooks

type ProcessHooks struct {
	ConfigureCommand func(*exec.Cmd)
	KillProcess      func(*os.Process) error
	ForceKillDelay   time.Duration
	ClientVersion    string
}

type RPCEnvelope

type RPCEnvelope struct {
	JSONRPC string          `json:"jsonrpc,omitempty"`
	ID      any             `json:"id,omitempty"`
	Method  string          `json:"method,omitempty"`
	Params  any             `json:"params,omitempty"`
	Result  json.RawMessage `json:"result,omitempty"`
	Error   *RPCError       `json:"error,omitempty"`
}

func ReadResponse

func ReadResponse(reader *bufio.Scanner, id int) (map[string]any, []RPCEnvelope, error)

type RPCError

type RPCError struct {
	Code    int    `json:"code,omitempty"`
	Message string `json:"message,omitempty"`
}

type StderrBuffer

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

func (*StderrBuffer) String

func (b *StderrBuffer) String() string

func (*StderrBuffer) Write

func (b *StderrBuffer) Write(data []byte) (int, error)

Jump to

Keyboard shortcuts

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