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

Function serverSessionMethod

mcp/shared.go:332–336  ·  view source on GitHub ↗

serverSessionMethod is glue for creating a typedServerMethodHandler from a method on ServerSession.

(f func(*ServerSession, context.Context, P) (R, error))

Source from the content-addressed store, hash-verified

330
331// serverSessionMethod is glue for creating a typedServerMethodHandler from a method on ServerSession.
332func serverSessionMethod[P Params, R Result](f func(*ServerSession, context.Context, P) (R, error)) typedServerMethodHandler[P, R] {
333 return func(ctx context.Context, req *ServerRequest[P]) (R, error) {
334 return f(req.GetSession().(*ServerSession), ctx, req.Params)
335 }
336}
337
338// clientSessionMethod is glue for creating a typedMethodHandler from a method on ServerSession.
339func clientSessionMethod[P Params, R Result](f func(*ClientSession, context.Context, P) (R, error)) typedClientMethodHandler[P, R] {

Callers 2

server.goFile · 0.85
initializeMethodInfoFunction · 0.85

Calls 1

GetSessionMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…