mcp: Deprecate roots, sampling and logging (SEP-2577) (#1017)
Fixes #1013
This commit is contained in:
parent
cd7d80c591
commit
b6649db4f9
1 changed files with 320 additions and 25 deletions
|
|
@ -69,6 +69,11 @@ func compareLevels(l1, l2 LoggingLevel) int {
|
|||
}
|
||||
|
||||
// LoggingHandlerOptions are options for a LoggingHandler.
|
||||
//
|
||||
// Deprecated: the logging feature is deprecated as of protocol version
|
||||
// 2026-07-28 (SEP-2577). It remains functional during the deprecation window
|
||||
// (at least twelve months). See
|
||||
// https://modelcontextprotocol.io/seps/2577-deprecate-roots-sampling-and-logging.
|
||||
type LoggingHandlerOptions struct {
|
||||
// The value for the "logger" field of logging notifications.
|
||||
LoggerName string
|
||||
|
|
@ -79,6 +84,11 @@ type LoggingHandlerOptions struct {
|
|||
}
|
||||
|
||||
// A LoggingHandler is a [slog.Handler] for MCP.
|
||||
//
|
||||
// Deprecated: the logging feature is deprecated as of protocol version
|
||||
// 2026-07-28 (SEP-2577). It remains functional during the deprecation window
|
||||
// (at least twelve months). See
|
||||
// https://modelcontextprotocol.io/seps/2577-deprecate-roots-sampling-and-logging.
|
||||
type LoggingHandler struct {
|
||||
opts LoggingHandlerOptions
|
||||
ss *ServerSession
|
||||
|
|
@ -101,6 +111,11 @@ func ensureLogger(l *slog.Logger) *slog.Logger {
|
|||
|
||||
// NewLoggingHandler creates a [LoggingHandler] that logs to the given [ServerSession] using a
|
||||
// [slog.JSONHandler].
|
||||
//
|
||||
// Deprecated: the logging feature is deprecated as of protocol version
|
||||
// 2026-07-28 (SEP-2577). It remains functional during the deprecation window
|
||||
// (at least twelve months). See
|
||||
// https://modelcontextprotocol.io/seps/2577-deprecate-roots-sampling-and-logging.
|
||||
func NewLoggingHandler(ss *ServerSession, opts *LoggingHandlerOptions) *LoggingHandler {
|
||||
var buf bytes.Buffer
|
||||
jsonHandler := slog.NewJSONHandler(&buf, &slog.HandlerOptions{
|
||||
|
|
|
|||
Loading…
Reference in a new issue