package mcp import "context" // Transport is a bidirectional MCP channel to a single peer. Implementations // correlate requests with responses internally so callers see simple // request/response semantics. // // Call returns the response Message (which may itself carry a JSON-RPC error in // Message.Error); the returned error is reserved for transport-level failures // (process died, connection refused, context cancelled, malformed frame). type Transport interface { Call(ctx context.Context, method string, params any) (*Message, error) Notify(ctx context.Context, method string, params any) error // SetNotificationHandler registers a handler for peer-initiated // notifications/requests (e.g. tools/list_changed). May be nil. SetNotificationHandler(func(*Message)) Close() error }