Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/Python/SDK/examples/stories/pagination/     Datei vom 5.10.2026 mit Größe 1 kB image not shown  

Quelle  images.py  Sprache: unbekannt

 
"""Example showing image handling with MCPServer."""

from PIL import Image as PILImage

from mcp.server.mcpserver import Image, MCPServer

mcp = MCPServer("Image Example")


@mcp.tool()
def create_thumbnail(image_path: str) -> Image:
    """Create a thumbnail from an image"""
    img = PILImage.open(image_path)
    img.thumbnail((100, 100))
    return Image(data=img.tobytes(), format="png")

Messung
CHZG
889710095

[Dauer der Verarbeitung: 0.3 Sekunden, vorverarbeitet 2026-11-24]