Skip to main content

fastmcp.resources.types

Concrete resource implementations.

Classes

TextResource

A resource that reads from a string. Methods:

read

Read the text content.

BinaryResource

A resource that reads from bytes. Methods:

read

Read the binary content.

FileResource

A resource that reads from a file. Set is_binary=True to read file as binary data instead of text. Methods:

validate_absolute_path

Ensure path is absolute.

set_binary_from_mime_type

Set is_binary based on mime_type if not explicitly set.

read

Read the file content.

HttpResource

A resource that reads from an HTTP endpoint. Methods:

read

Read the HTTP content.

DirectoryResource

A resource that lists files in a directory. Methods:

validate_absolute_path

Ensure path is absolute.

list_files

List files in the directory.

read

Read the directory listing.