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

Method AddExtension

mcp/protocol.go:238–246  ·  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

236// (the spec requires an object, not null).
237// The settings map should not be modified after the call.
238func (c *ClientCapabilities) AddExtension(name string, settings map[string]any) {
239 if c.Extensions == nil {
240 c.Extensions = make(map[string]any)
241 }
242 if settings == nil {
243 settings = map[string]any{}
244 }
245 c.Extensions[name] = settings
246}
247
248// clone returns a copy of the ClientCapabilities.
249// Values in the Extensions and Experimental maps are shallow-copied.

Callers 2

TestClientCapabilitiesFunction · 0.95

Calls

no outgoing calls

Tested by 2

TestClientCapabilitiesFunction · 0.76