List resources
Resource schema
Each resource includes:| Field | Type | Description |
|---|---|---|
uri | str | Resource identifier (e.g. resource://config/app) |
name | str | Human-readable name |
description | str | None | What the resource contains |
mimeType | str | None | Content type (e.g. application/json) |
Read resources
Read a specific resource by URI:result is a ReadResourceResult with a contents list. It can contain TextResourceContents (text) or BlobResourceContents (base64 blob).
Response structure (text vs binary)
Example: Configuration reader
Resource templates
Resource templates are just “patterns” a server can publish (like resource://users/) to show what kinds of resource URLs exist. They don’t automatically create resources—to read something, you still call read_resource(…) with a real URL (like resource://users/123), and it only works if the server actually serves that exact URI.Context manager
Again,open_connection(...) is an async context manager. It means you don’t have to remember to call await client.close(). When the async with block exits, it automatically closes the underlying connection for you.