Skip to main content
Glama
keizman

MCP Feedback Collector

by keizman

get_image_info

Retrieve image details such as dimensions and format from a specified file path using this tool on the MCP Feedback Collector server.

Instructions

获取指定路径图片的信息(尺寸、格式等) Args: image_path: 图片文件路径

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
image_pathYes

Implementation Reference

  • The main handler function for the 'get_image_info' tool. It takes an image_path, uses PIL to open the image, extracts metadata like format, mode, size, dimensions, file size, and returns a formatted string with the info. Handles errors if file not exists or other exceptions.
    @mcp.tool() def get_image_info(image_path: str) -> str: """ 获取指定路径图片的信息(尺寸、格式等) Args: image_path: 图片文件路径 """ try: image_path = Path(image_path) if not image_path.exists(): return f"图片文件不存在: {image_path}" with Image.open(image_path) as img: info = { "path": str(image_path), "format": img.format, "mode": img.mode, "size": img.size, "width": img.width, "height": img.height, } # 尝试获取文件大小 file_size = image_path.stat().st_size info["file_size_bytes"] = file_size info["file_size_mb"] = round(file_size / (1024 * 1024), 2) return f"图片信息: {info}" except Exception as e: return f"获取图片信息失败: {str(e)}"

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/keizman/mcp-feedforward'

If you have feedback or need assistance with the MCP directory API, please join our Discord server