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

Function initializeMethodInfo

mcp/server.go:1385–1400  ·  view source on GitHub ↗

initializeMethodInfo handles the workaround for #607: we must set params.Capabilities.RootsV2.

()

Source from the content-addressed store, hash-verified

1383// initializeMethodInfo handles the workaround for #607: we must set
1384// params.Capabilities.RootsV2.
1385func initializeMethodInfo() methodInfo {
1386 info := newServerMethodInfo(serverSessionMethod((*ServerSession).initialize), 0)
1387 info.unmarshalParams = func(m json.RawMessage) (Params, error) {
1388 var params *initializeParamsV2
1389 if m != nil {
1390 if err := internaljson.Unmarshal(m, &params); err != nil {
1391 return nil, fmt.Errorf("unmarshaling %q into a %T: %w", m, params, err)
1392 }
1393 }
1394 if params == nil {
1395 return nil, fmt.Errorf(`missing required "params"`)
1396 }
1397 return params.toV1(), nil
1398 }
1399 return info
1400}
1401
1402func (ss *ServerSession) sendingMethodInfos() map[string]methodInfo { return clientMethodInfos }
1403

Callers 1

server.goFile · 0.85

Calls 3

toV1Method · 0.95
newServerMethodInfoFunction · 0.85
serverSessionMethodFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…