Thanks to visit codestin.com
Credit goes to github.com

Skip to content

How tools should be created to use images in Claude Desktop? #771

Open
@alexlopezcifuentes

Description

@alexlopezcifuentes

So basically, I am trying to follow the simple quickstart guide on how to work with images.

from mcp.server.fastmcp import FastMCP, Image
from PIL import Image as PILImage

mcp = FastMCP("My App")


@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")

However, it does not seem straigthforward how to use this in a conversation with Claude. I have properly configured the MCP server in Claude, and those tools not using images are properly working.

Is there any way of uploading an image to Claude so that it is then used by an MCP tool?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    To triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions