McpServer.Resource (HTTP MCP Server v0.6.0)
View SourceRepresents a static resource definition.
Resources are data sources that can be read by MCP clients. Static resources have fixed URIs without template variables.
Fields
name- Unique resource identifieruri- Static URI for the resourcedescription- Human-readable description (optional)mime_type- MIME type of the resource (optional)title- Display title (optional)
Examples
iex> resource = McpServer.Resource.new(
...> name: "config",
...> uri: "file:///app/config.json",
...> description: "Application configuration",
...> mime_type: "application/json"
...> )
%McpServer.Resource{
name: "config",
uri: "file:///app/config.json",
description: "Application configuration",
mime_type: "application/json"
}
Summary
Types
Functions
Creates a new Resource struct.
Parameters
opts- Keyword list of resource options::name(required) - Unique resource identifier:uri(required) - Static URI:description- Human-readable description:mime_type- MIME type:title- Display title
Examples
iex> McpServer.Resource.new(
...> name: "readme",
...> uri: "file:///README.md"
...> )
%McpServer.Resource{name: "readme", uri: "file:///README.md"}
iex> McpServer.Resource.new(
...> name: "config",
...> uri: "file:///app/config.json",
...> description: "App config",
...> mime_type: "application/json",
...> title: "Configuration"
...> )
%McpServer.Resource{
name: "config",
uri: "file:///app/config.json",
description: "App config",
mime_type: "application/json",
title: "Configuration"
}