Skip to main content
Glama

tos_image_info

Retrieve metadata and details about images stored in Volcengine TOS object storage by specifying the bucket name and object key.

Instructions

获取图片信息

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
bucket_nameYes存储桶名称
object_keyYes图片对象键名

Implementation Reference

  • The main handler function for the 'tos_image_info' tool. It retrieves image metadata from TOS using the get_object API with process='image/info', parses the JSON response, and returns it structured with bucket and key info.
    async def image_info(args: Dict[str, Any]) -> List[TextContent]: """获取图片信息""" bucket_name = args["bucket_name"] object_key = args["object_key"] try: # 使用 get_object 方法通过 style 参数获取图片信息 # 设置处理参数为 image/info resp = tos_client.get_object(bucket_name, object_key, process="image/info") image_info_data = resp.read().decode('utf-8') # 尝试解析JSON响应 try: image_info_json = json.loads(image_info_data) result = { "bucket": bucket_name, "key": object_key, "image_info": image_info_json, "status": "success" } except json.JSONDecodeError: # 如果不是JSON格式,直接返回原始数据 result = { "bucket": bucket_name, "key": object_key, "image_info": image_info_data, "status": "success", "note": "返回原始格式数据" } return [TextContent(type="text", text=json.dumps(result, indent=2, ensure_ascii=False))] except Exception as e: return [TextContent(type="text", text=f"获取图片信息失败: {str(e)}")]
  • Registers the 'tos_image_info' tool in the MCP server's list_tools() function, including name, description, and input schema.
    Tool( name="tos_image_info", description="获取图片信息", inputSchema={ "type": "object", "properties": { "bucket_name": { "type": "string", "description": "存储桶名称" }, "object_key": { "type": "string", "description": "图片对象键名" } }, "required": ["bucket_name", "object_key"] } ),
  • In the call_tool dispatcher, routes 'tos_image_info' calls to the image_info handler function.
    elif name == "tos_image_info": return await image_info(arguments)
  • Input schema definition for the 'tos_image_info' tool, specifying required parameters bucket_name and object_key.
    inputSchema={ "type": "object", "properties": { "bucket_name": { "type": "string", "description": "存储桶名称" }, "object_key": { "type": "string", "description": "图片对象键名" } }, "required": ["bucket_name", "object_key"] }

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/jneless/tos-mcp'

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