Resources: Addressable Content for a Stateless Server
A tool answers a question by doing something. A resource answers it by being something the host can already point the model at, addressed by a URI instead of invoked by a name. Read resources/list, resources/templates/list, and resources/read as three distinct methods with three distinct results. Expand an RFC 6570 URI template into a concrete URI, then read it like any other resource. Explain why a missing resource is JSON-RPC error -32602 with data.uri, never a result with an empty contents array. Choose ttlMs and cacheScope for a read based on whether its content is shared or belongs to one caller. Sanitize a URI before it reaches storage so a template can never be used to read outside a server's own root. A host that wants to put a project's README, a ticket's body, or a user's saved note into a model's context is not asking the model to do anything. It is choosing what the model should already know before it answers. Route that choice through a tool and you inherit tool semantics you do not want: the model decides whether to call it, the call can fail argument validation, and every plain read now looks like an action in the transcript. Route it around MCP entirely, by reading a file straight off disk from inside the host, and…
Resources: Addressable Content for a Stateless Server: A tool answers a question by doing something. A resource answers it by being something the host can…
This free lesson is part of the AI Engineering from Scratch curriculum. Read the full explanation, run the lesson code, and verify the result in the interactive reader or from the repository source.
Browse the complete course catalog or open this lesson on GitHub.