Skip to content

Commit 073aa78

Browse files
docs: fix middleware example function signature
- Correct MethodHandler type parameter to use fully qualified mcp.ServerSession - Update parameter types to use proper mcp.Params and mcp.Result instead of any - Ensure example code matches the actual API des
1 parent cb17593 commit 073aa78

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

design/design.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -456,8 +456,8 @@ func (s *Server) AddReceivingMiddleware(middleware ...Middleware[*ServerSession]
456456
As an example, this code adds server-side logging:
457457
458458
```go
459-
func withLogging(h mcp.MethodHandler[*ServerSession]) mcp.MethodHandler[*ServerSession]{
460-
return func(ctx context.Context, s *mcp.ServerSession, method string, params any) (res any, err error) {
459+
func withLogging(h mcp.MethodHandler[*mcp.ServerSession]) mcp.MethodHandler[*mcp.ServerSession]{
460+
return func(ctx context.Context, s *mcp.ServerSession, method string, params mcp.Params) (res mcp.Result, err error) {
461461
log.Printf("request: %s %v", method, params)
462462
defer func() { log.Printf("response: %v, %v", res, err) }()
463463
return h(ctx, s , method, params)

0 commit comments

Comments
 (0)