← Back to ToolBench
Server Capabilities
Resources
Expose structured data that clients can read
What it does
Resources let servers expose data (files, database records, API responses) as readable content identified by URIs. Clients discover resources via resources/list and read them with resources/read. Resources can also support subscriptions so clients are notified when content changes. Unlike tools, resources are read-only and don't perform actions.
How it works
Example implementation
server.resource("config://app/settings", async (uri) => ({
contents: [{
uri: uri.href,
mimeType: "application/json",
text: JSON.stringify(await loadSettings())
}]
}));