McpServer.Resource.Content (HTTP MCP Server v0.6.0)
View SourceRepresents a single content item from a resource.
Content items contain the actual data read from a resource, along with metadata. Content can be either textual or binary (base64-encoded blob).
Fields
name- Display name (e.g., filename)uri- Canonical URI of the contentmime_type- MIME type (optional)text- Textual content (optional, mutually exclusive with blob)blob- Base64-encoded binary content (optional, mutually exclusive with text)title- Display title (optional)
Examples
iex> content = McpServer.Resource.Content.new(
...> name: "example.txt",
...> uri: "file:///path/to/example.txt",
...> mime_type: "text/plain",
...> text: "File content here..."
...> )
%McpServer.Resource.Content{
name: "example.txt",
uri: "file:///path/to/example.txt",
mime_type: "text/plain",
text: "File content here..."
}
Summary
Types
Functions
Creates a new Resource.Content struct.
Parameters
opts- Keyword list of content options::name(required) - Display name:uri(required) - Canonical URI:mime_type- MIME type:text- Textual content:blob- Base64-encoded binary content:title- Display title
Examples
iex> McpServer.Resource.Content.new(
...> name: "config.json",
...> uri: "file:///app/config.json",
...> mime_type: "application/json",
...> text: "{\"setting\": \"value\"}"
...> )
%McpServer.Resource.Content{
name: "config.json",
uri: "file:///app/config.json",
mime_type: "application/json",
text: "{\"setting\": \"value\"}"
}
iex> McpServer.Resource.Content.new(
...> name: "image.png",
...> uri: "file:///images/logo.png",
...> mime_type: "image/png",
...> blob: "iVBORw0KGgo..."
...> )
%McpServer.Resource.Content{
name: "image.png",
uri: "file:///images/logo.png",
mime_type: "image/png",
blob: "iVBORw0KGgo..."
}