Topic 2: Resources
Readable content identified by a URI
A resource is a piece of readable content that a server exposes under a URI (a Uniform Resource Identifier, an address such as notes://sleep-and-memory). A client lists resources with resources/list and fetches one with resources/read. The server decides the URI scheme: ours is notes://.
The difference from a tool is who is in control. A tool is model-controlled: the model decides to call search_notes. A resource is application-controlled: the host application decides to load it, for example when Nare pins a note into the conversation, when a sidebar shows the notes index, or when the host offers the model a generic "read this URI" helper. Module 1 introduced these control models; here they become code.
Resources come in two shapes:
- A static resource has one fixed URI, such as
notes://index. It shows up inresources/list. - A resource template is a URI pattern with placeholders, such as
notes://{note_id}, following RFC 6570. It shows up inresources/templates/list, and one function serves every URI that matches.
Every resource also carries a MIME type (a label such as text/markdown that tells the client how to display the content). The SDK never guesses it: if you do not set mime_type=, it says text/plain.