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

FuncType MethodHandler

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

A MethodHandler handles MCP messages. For methods, exactly one of the return values must be nil. For notifications, both must be nil.

func(ctx context.Context, method string, req Request) (result Result, err error)

Source from the content-addressed store, hash-verified

68// For methods, exactly one of the return values must be nil.
69// For notifications, both must be nil.
70type MethodHandler func(ctx context.Context, method string, req Request) (result Result, err error)
71
72// A Session is either a [ClientSession] or a [ServerSession].
73type Session interface {

Callers 2

newClientMethodInfoFunction · 0.85
newServerMethodInfoFunction · 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…