@@ -114,23 +114,6 @@ MCP servers can serve resources to clients.
114114They can register resources individually, or register a _ resource template_
115115that uses a URI pattern to describe a collection of resources.
116116
117- ** Server-side** :
118- Servers use
119- [ ` Server.AddResource ` ] ( https://pkg.go.dev/github.com/modelcontextprotocol/go-sdk/mcp#Server.AddResource )
120- and
121- [ ` Server.AddResourceTemplate ` ] ( https://pkg.go.dev/github.com/modelcontextprotocol/go-sdk/mcp#Server.AddResourceTemplate )
122- to register resources and resource templates and associate them with handlers.
123- If ` AddResource ` or ` AddResourceTemplate ` is called before a server is connected, the server will have the
124- ` resources ` capability.
125- If all resources or resource templates are to be added after connection, set
126- [ ` ServerOptions.HasResources ` ] ( https://pkg.go.dev/github.com/modelcontextprotocol/go-sdk/mcp#ServerOptions.HasResources )
127- to advertise the capability.
128-
129- A
130- [ ` ResourceHandler ` ] ( https://pkg.go.dev/github.com/modelcontextprotocol/go-sdk/mcp#ResourceHandler )
131- maps a URI to the contents of a resource, which can include text, binary data,
132- or both.
133-
134117
135118** Client-side** :
136119Call [ ` ClientSession.ReadResource ` ] ( https://pkg.go.dev/github.com/modelcontextprotocol/go-sdk/mcp#ClientSession.ReadResource )
158141[ ` ClientOptions.ResourceUpdatedHandler ` ] ( https://pkg.go.dev/github.com/modelcontextprotocol/go-sdk/mcp#ClientOptions.ResourceUpdatedHandler )
159142to be notified of changes to subscribed resources.
160143
144+ ** Server-side** :
145+ Use
146+ [ ` Server.AddResource ` ] ( https://pkg.go.dev/github.com/modelcontextprotocol/go-sdk/mcp#Server.AddResource )
147+ or
148+ [ ` Server.AddResourceTemplate ` ] ( https://pkg.go.dev/github.com/modelcontextprotocol/go-sdk/mcp#Server.AddResourceTemplate )
149+ to add a resource or resource template to the server along with its handler.
150+ A
151+ [ ` ResourceHandler ` ] ( https://pkg.go.dev/github.com/modelcontextprotocol/go-sdk/mcp#ResourceHandler )
152+ maps a URI to the contents of a resource, which can include text, binary data,
153+ or both.
154+ If ` AddResource ` or ` AddResourceTemplate ` is called before a server is connected, the server will have the
155+ ` resources ` capability.
156+ The server will have the ` resources ` capability if any resource or resource template is added before the
157+ server is connected to a client, or if
158+ [ ` ServerOptions.HasResources ` ] ( https://pkg.go.dev/github.com/modelcontextprotocol/go-sdk/mcp#ServerOptions.HasResources )
159+ is explicitly set. When a prompt is added, any clients already connected to the
160+ server will be notified via a ` notifications/resources/list_changed `
161+ notification.
162+
163+
161164``` go
162165func Example_resources () {
163166 ctx := context.Background ()
0 commit comments