MCPcopy Create free account
hub / github.com/modelcontextprotocol/go-sdk / addMiddleware

Function addMiddleware

mcp/shared.go:88–92  ·  view source on GitHub ↗

addMiddleware wraps the handler in the middleware functions.

(handlerp *MethodHandler, middleware []Middleware)

Source from the content-addressed store, hash-verified

86
87// addMiddleware wraps the handler in the middleware functions.
88func addMiddleware(handlerp *MethodHandler, middleware []Middleware) {
89 for _, m := range slices.Backward(middleware) {
90 *handlerp = m(*handlerp)
91 }
92}
93
94func defaultSendingMethodHandler(ctx context.Context, method string, req Request) (Result, error) {
95 info, ok := req.GetSession().sendingMethodInfos()[method]

Callers 4

AddSendingMiddlewareMethod · 0.85
AddSendingMiddlewareMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…