49b9bb6724
Deploy Docs / deploy-docs (push) Failing after 1s
Conformance Tests / client-conformance (push) Failing after 3s
Conformance Tests / server-conformance (push) Failing after 1s
GitHub Actions Security Analysis / zizmor (push) Failing after 1s
CI / checks (push) Failing after 59m20s
CI / all-green (push) Waiting to run
16 lines
395 B
Python
16 lines
395 B
Python
"""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")
|