Use this file to discover all available pages before exploring further.
New in version 2.13.0Icons provide visual representations for your MCP servers and components, helping client applications present better user interfaces. When displayed in MCP clients, icons help users quickly identify and navigate your server’s capabilities.
from mcp.types import Icon@mcp.tool( icons=[Icon(src="https://example.com/calculator-icon.png")])def calculate_sum(a: int, b: int) -> int: """Add two numbers together.""" return a + b
@mcp.prompt( icons=[Icon(src="https://example.com/prompt-icon.png")])def analyze_code(code: str): """Create a prompt for code analysis.""" return f"Please analyze this code:\n\n{code}"
For small icons or when you want to embed the icon directly, use data URIs:
from mcp.types import Iconfrom fastmcp.utilities.types import Image# SVG icon as data URIsvg_icon = Icon( src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCI+PHBhdGggZD0iTTEyIDJDNi40OCAyIDIgNi40OCAyIDEyczQuNDggMTAgMTAgMTAgMTAtNC40OCAxMC0xMFMxNy41MiAyIDEyIDJ6Ii8+PC9zdmc+", mimeType="image/svg+xml")@mcp.tool(icons=[svg_icon])def my_tool() -> str: """A tool with an embedded SVG icon.""" return "result"# Generating a data URI from a local image file.img = Image(path="./assets/brand/favicon.png")icon = Icon(src=img.to_data_uri())@mcp.tool(icons=[icon])def file_icon_tool() -> str: """A tool with an icon generated from a local file.""" return "result"