- A client discovers resources via
resources/list(each resource includesuri, optionalname, optionalmimeType, etc.). - A client reads a resource via
resources/readwith auri. - The server executes your resource handler.
- The server returns a
ReadResourceResultcontainingcontentsper MCP spec.
@resource(...) and register them with server.collect(...) (or inside with server.binding(): ...).
Decorator signature
resource(...):resource(uri: str, *, name=None, description=None, mime_type=None)
fn()→ returnsstr(text) orbytes(binary). (async defis also supported.)
Basic resource
collect() registers it. Clients list resources with resources/list and read them with resources/read.
Text vs binary
Returnstr for text:
bytes for binary (Dedalus encodes it as base64 in the MCP response):
Async resources
async def for I/O. (Like tools, sync handlers run inline.)
MIME types
text/plain(default when returningstrand nomime_typeis provided)application/octet-stream(default when returningbytesand nomime_typeis provided)
Subscriptions
Clients can subscribe to resource changes viaresources/subscribe and unsubscribe via resources/unsubscribe.
When your underlying data changes, notify subscribers:
notifications/resources/updated.
Decorator options
Error handling
If your resource handler raises, Dedalus returns a text fallback resource:mimeType="text/plain"text="Resource error: <exception message>"
resources/read returns an empty contents list.
Testing
Test resource handlers as normal functions:resources/read):
Resource templates
Use@resource_template(...) to advertise URI patterns via resources/templates/list (for client discovery and completions). Dedalus MCP currently registers templates for listing, but does not automatically route resources/read to a template function—you still need to register concrete resource URIs with @resource(...).