core

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertListTools

func ConvertListTools(raw json.RawMessage) (*protocol.ListToolsRequest, error)

func ConvertToolCall

func ConvertToolCall(raw json.RawMessage) (*protocol.CallToolRequest, error)

Types

type Lifecycle

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

func NewLifecycle

func NewLifecycle(server *Server, router *Router, reg interface {
	StartAll(context.Context) error
	StopAll() error
	HealthCheckAndRestart()
},
) *Lifecycle

func (*Lifecycle) Run

func (l *Lifecycle) Run() error

type Proxy

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

func NewProxy

func NewProxy(timeout time.Duration) *Proxy

func (*Proxy) ForwardToSSE

func (p *Proxy) ForwardToSSE(ctx context.Context, url string, req *protocol.Request) (*protocol.Response, error)

func (*Proxy) ForwardToStdio

func (p *Proxy) ForwardToStdio(_ context.Context, stdin io.Writer, stdout io.Reader, req *protocol.Request) (*protocol.Response, error)

type RequestContext

type RequestContext struct {
	ID         json.RawMessage
	Method     string
	Params     json.RawMessage
	RawRequest *protocol.Request
	// contains filtered or unexported fields
}

func NewRequestContext

func NewRequestContext(req *protocol.Request, stream *Stream) *RequestContext

func (*RequestContext) Respond

func (ctx *RequestContext) Respond(resp *protocol.Response)

func (*RequestContext) RespondError

func (ctx *RequestContext) RespondError(err protocol.ErrorObject)

func (*RequestContext) RespondResult

func (ctx *RequestContext) RespondResult(result json.RawMessage)

type Router

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

func NewRouter

func NewRouter(reg *registry.Registry) *Router

func (*Router) BackendCount

func (r *Router) BackendCount() int

func (*Router) Dispatch

func (r *Router) Dispatch(ctx *RequestContext)

func (*Router) GetStream

func (r *Router) GetStream(id string) *Stream

func (*Router) NewStream

func (r *Router) NewStream(id string, w http.ResponseWriter, flusher http.Flusher) *Stream

func (*Router) RebuildToolIndex

func (r *Router) RebuildToolIndex()

func (*Router) RemoveStream

func (r *Router) RemoveStream(id string)

func (*Router) Route

func (r *Router) Route(toolName string) (string, bool)

func (*Router) StreamCount

func (r *Router) StreamCount() int

type RouterTelemetry

type RouterTelemetry struct {
	RequestsTotal  int64
	RequestsFailed int64
	CircuitBreaks  int64
}

type Server

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

func NewServer

func NewServer(cfg *config.Config, router *Router) *Server

func (*Server) SetReloadHandler

func (s *Server) SetReloadHandler(fn func(*config.Config) error)

func (*Server) Shutdown

func (s *Server) Shutdown(ctx context.Context) error

func (*Server) Start

func (s *Server) Start() error

type Stream

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

func NewStream

func NewStream(id string, w io.Writer, flusher http.Flusher, router *Router) *Stream

func (*Stream) Close

func (s *Stream) Close()

func (*Stream) HandleMessage

func (s *Stream) HandleMessage(body io.ReadCloser) error

func (*Stream) SendResponse

func (s *Stream) SendResponse(resp *protocol.Response)

Jump to

Keyboard shortcuts

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