McpServer.Tool.Content.Resource (HTTP MCP Server v0.6.0)
View SourceRepresents an embedded resource in a tool result.
Fields
uri- The URI of the resource (required)text- Textual content of the resource (optional)blob- Binary content of the resource, stored as-is (optional)mime_type- MIME type of the resource (optional)
The blob data is stored as-is (not base64-encoded in the struct). Base64 encoding happens during JSON serialization.
Examples
iex> resource = McpServer.Tool.Content.Resource.new(uri: "file:///path/to/file.txt")
iex> resource.uri
"file:///path/to/file.txt"
iex> resource = McpServer.Tool.Content.Resource.new(
...> uri: "file:///data.json",
...> text: ~s({"key": "value"}),
...> mime_type: "application/json"
...> )
iex> resource.text
~s({"key": "value"})
Summary
Types
Functions
Creates a new Resource content struct.
Parameters
opts- Keyword list with required:urifield and optional:text,:blob,:mime_typefields
Examples
iex> McpServer.Tool.Content.Resource.new(uri: "file:///test.txt")
%McpServer.Tool.Content.Resource{uri: "file:///test.txt", text: nil, blob: nil, mime_type: nil}
iex> McpServer.Tool.Content.Resource.new(
...> uri: "file:///test.txt",
...> text: "content",
...> mime_type: "text/plain"
...> )
%McpServer.Tool.Content.Resource{
uri: "file:///test.txt",
text: "content",
blob: nil,
mime_type: "text/plain"
}