MCP Resources vs. Tools
When to expose data as a resource vs. a tool call.
Resources are read-only, addressable data the model can request by URI. Tools are operations with side effects. Expose static or slow-changing data as resources; operations as tools. Resources can be cached client-side; tools cannot.
Real-world example: Codebase file index
A developer-productivity agent needs read access to ~3,000 source files. Exposing every file as a tool call wastes tokens — each call re-pays the schema cost.
Instead, expose them as resources:
codebase://file/src/auth/login.ts
codebase://file/src/billing/stripe.ts
…The client caches resources locally. When the agent says "read src/auth/login.ts", the client serves it from its own cache without a server round-trip.
Why this matters: read-only, addressable data belongs on the resource axis. You pay schema overhead once for "fetch resource" and the URI carries the rest.
- Resources are read-only and addressable
- Tools are operations with side effects
- Resources cache client-side; tools do not
- Expose slow-changing data as resources
- Verbs imply tool, nouns imply resource
