Skip to main content
Glama
EfrainTorres

ArmaVita Meta Ads MCP

export_ad_image_file

Download ad image files from Meta Ads campaigns to local directories for creative management and asset organization.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ad_idYes
meta_access_tokenNo
output_dirNoad_images

Implementation Reference

  • The handler for the 'export_ad_image_file' tool. It fetches the ad image using 'read_ad_image' and saves it to the specified directory.
    async def export_ad_image_file(
        ad_id: str,
        meta_access_token: Optional[str] = None,
        output_dir: str = "ad_images",
    ) -> str:
        if not ad_id:
            return _json({"error": "No ad ID provided"})
    
        image = await read_ad_image(ad_id=ad_id, meta_access_token=meta_access_token)
        if not isinstance(image, Image):
            return _json({"error": "Unexpected image response type"})
    
        os.makedirs(output_dir, exist_ok=True)
        file_path = os.path.join(output_dir, f"{ad_id}.jpg")
        with open(file_path, "wb") as handle:
            handle.write(image.data)
    
        return _json({"filepath": file_path})

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/EfrainTorres/armavita-meta-ads-mcp'

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