MCPcopy Index your code
hub / github.com/modelcontextprotocol/go-sdk / AddExtension

Method AddExtension

mcp/protocol.go:1581–1589  ·  view source on GitHub ↗

AddExtension adds an extension with the given name and settings. If settings is nil, an empty map is used to ensure valid JSON serialization (the spec requires an object, not null). The settings map should not be modified after the call.

(name string, settings map[string]any)

Source from the content-addressed store, hash-verified

1579// (the spec requires an object, not null).
1580// The settings map should not be modified after the call.
1581func (c *ServerCapabilities) AddExtension(name string, settings map[string]any) {
1582 if c.Extensions == nil {
1583 c.Extensions = make(map[string]any)
1584 }
1585 if settings == nil {
1586 settings = map[string]any{}
1587 }
1588 c.Extensions[name] = settings
1589}
1590
1591// clone returns a copy of the ServerCapabilities.
1592// Values in the Extensions and Experimental maps are shallow-copied.

Callers 2

TestServerCapabilitiesFunction · 0.95

Calls

no outgoing calls

Tested by 2

TestServerCapabilitiesFunction · 0.76