Skip to main content
Glama
keizman

MCP Feedback Collector

by keizman

pick_image

Select images from your device or paste from clipboard to provide visual feedback in AI assistant interactions.

Instructions

弹出图片选择对话框,让用户选择图片文件或从剪贴板粘贴图片。 用户可以选择本地图片文件,或者先截图到剪贴板然后粘贴。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the 'pick_image' tool. It is decorated with @mcp.tool() which also serves as registration. Opens a tkinter file dialog to let user pick an image file, encodes it to base64, and returns an MCPImage object.
    @mcp.tool()
    def pick_image() -> MCPImage:
        """
        弹出图片选择对话框,让用户选择图片文件或从剪贴板粘贴图片。
        用户可以选择本地图片文件,或者先截图到剪贴板然后粘贴。
        """
        root = tk.Tk()
        root.withdraw()  # 隐藏主窗口
        
        file_types = [
            ("图片文件", "*.png *.jpg *.jpeg *.gif *.bmp *.webp"),
            ("PNG files", "*.png"),
            ("JPEG files", "*.jpg *.jpeg"),
            ("所有文件", "*.*")
        ]
        
        file_path = filedialog.askopenfilename(
            title="选择图片文件",
            filetypes=file_types
        )
        
        root.destroy()
        
        if file_path:
            try:
                with open(file_path, "rb") as f:
                    image_data = f.read()
                    image_base64 = base64.b64encode(image_data).decode('utf-8')
                    
                    return MCPImage(
                        data=image_base64,
                        media_type="image/png"
                    )
            except Exception as e:
                raise Exception(f"读取图片失败: {str(e)}")
        else:
            raise Exception("未选择图片文件")
Install Server

Other 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