Skip to main content
Resources in MCP provide structured access to information that AI models need to understand context. They represent data sources that can be retrieved and used by AI applications, such as files, database records, API responses, or any other structured information.

What are Resources?

Resources are context data sources with:
  • URI-based identification for consistent addressing
  • Structured access patterns with defined schemas
  • Multiple content types (text, JSON, binary data)
  • Dynamic or static content that can change over time
Common examples include:
  • Configuration files and documents
  • Database records and query results
  • API responses and external data
  • Calendar events and schedules
  • User preferences and settings

Types of Resources

Direct Resources

Static resources with fixed URIs that always return the same type of content.

Resource Templates

Dynamic resources that accept parameters to generate different content based on input.

Listing Available Resources

To see what resources are available from a connected MCP server:

Automatic Resource List Update

When servers send ResourceListChangedNotification, it signals that the resource list has changed. The list_resources() method always fetches fresh data from the server, ensuring you get up-to-date information. Important: Always use await session.list_resources() instead of the deprecated session.resources property to ensure you get fresh data:

Reading Resources

Resources are accessed using the read_resource method with their URI:

Working with Resource Templates

Resource templates allow dynamic content generation based on parameters:

Resource Content Types

Resources can contain different types of content:

Text Content

Binary Content

Resource Discovery

Find resources matching specific criteria:

Error Handling

Always handle potential errors when reading resources: