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

Function serverMethod

mcp/shared.go:314–320  ·  view source on GitHub ↗

serverMethod is glue for creating a typedMethodHandler from a method on Server.

(
	f func(*Server, context.Context, *ServerRequest[P]) (R, error),
)

Source from the content-addressed store, hash-verified

312
313// serverMethod is glue for creating a typedMethodHandler from a method on Server.
314func serverMethod[P Params, R Result](
315 f func(*Server, context.Context, *ServerRequest[P]) (R, error),
316) typedServerMethodHandler[P, R] {
317 return func(ctx context.Context, req *ServerRequest[P]) (R, error) {
318 return f(req.Session.server, ctx, req)
319 }
320}
321
322// clientMethod is glue for creating a typedMethodHandler from a method on Client.
323func clientMethod[P Params, R Result](

Callers 1

server.goFile · 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…