Skip to main content
Glama
KaiQin04

Instagram Download MCP Server

by KaiQin04

download_instagram_post

Download Instagram posts, reels, and videos to your local filesystem with optional metadata and caption extraction. Save media files from Instagram URLs for offline access.

Instructions

Download an Instagram post's media files to the local filesystem.

Args: url: Instagram post/reel/tv URL. include_videos: Whether to download videos alongside pictures. save_metadata: Save JSON metadata files when available. save_caption: Save caption into a text file when available. username: Optional Instagram username for authenticated access. password: Optional Instagram password for authenticated access. download_root: Optional override for download directory.

Returns: A JSON-serializable dict containing download results.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYes
include_videosNo
save_metadataNo
save_captionNo
usernameNo
passwordNo
download_rootNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The @mcp.tool()-decorated function implementing the core logic of the 'download_instagram_post' tool. It extracts the shortcode from the URL, sets up Instaloader, handles login, downloads the post media, and returns paths to downloaded files.
    @mcp.tool()
    def download_instagram_post(
        url: str,
        include_videos: bool = True,
        save_metadata: bool = True,
        save_caption: bool = True,
        username: str | None = None,
        password: str | None = None,
        download_root: str | None = None,
    ) -> dict[str, Any]:
        """Download an Instagram post's media files to the local filesystem.
    
        Args:
            url: Instagram post/reel/tv URL.
            include_videos: Whether to download videos alongside pictures.
            save_metadata: Save JSON metadata files when available.
            save_caption: Save caption into a text file when available.
            username: Optional Instagram username for authenticated access.
            password: Optional Instagram password for authenticated access.
            download_root: Optional override for download directory.
    
        Returns:
            A JSON-serializable dict containing download results.
        """
        try:
            shortcode = extract_shortcode(url)
            target_root = _resolve_download_root(download_root)
            loader = _build_instaloader(
                target_root,
                download_pictures=True,
                download_videos=include_videos,
                save_metadata=save_metadata,
                save_caption=save_caption,
            )
            user, pwd = _resolve_credentials(username, password)
            _login_if_needed(loader, user, pwd)
            download_dir, downloaded_files = _download_post_for_shortcode(
                loader,
                shortcode,
                target_root,
            )
            image_files = _collect_paths_by_suffixes(
                downloaded_files,
                {".jpg", ".jpeg", ".png", ".webp"},
            )
            video_files = _collect_paths_by_suffixes(downloaded_files, {".mp4"})
            metadata_files = _collect_paths_by_suffixes(
                downloaded_files,
                {".json"},
            )
            caption_files = _collect_paths_by_suffixes(
                downloaded_files,
                {".txt"},
            )
            return {
                "success": True,
                "shortcode": shortcode,
                "download_dir": str(download_dir),
                "image_files": image_files,
                "video_files": video_files,
                "metadata_files": metadata_files,
                "caption_files": caption_files,
            }
        except instaloader.exceptions.InstaloaderException as exc:
            return {
                "success": False,
                "error": f"Instaloader error: {exc.__class__.__name__}: {exc}",
            }
        except Exception as exc:
            return {"success": False, "error": str(exc)}
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden. It discloses that files are saved to the local filesystem and mentions authentication needs via username/password parameters, but doesn't cover important behavioral aspects like rate limits, error handling, file naming conventions, or what happens when metadata/captions aren't available. It provides basic operational context but lacks comprehensive behavioral disclosure.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with clear sections (purpose, Args, Returns) and efficiently explains parameters. Every sentence adds value, though the 'Returns' section could be slightly more informative given the output schema exists. The structure is logical and easy to parse.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given 7 parameters with no schema descriptions and no annotations, the description does a good job explaining parameter semantics. The existence of an output schema means the description doesn't need to detail return values. For a tool with this complexity and no annotation support, the description provides adequate context for basic usage.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema description coverage, the description compensates well by explaining all 7 parameters in the Args section. Each parameter gets meaningful context about its purpose and effect, adding substantial value beyond the bare schema. The only minor gap is that 'url' could specify format expectations more precisely.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with specific verb ('Download') and resource ('Instagram post's media files'), and distinguishes it from siblings by specifying it's for posts/reels/TV rather than highlights, profile pics, stories, or videos. The first sentence is a complete, unambiguous statement of function.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage context through parameter explanations (e.g., 'for authenticated access'), but doesn't explicitly state when to use this tool versus its siblings. It mentions what the tool does but doesn't provide guidance on when it's the appropriate choice among the Instagram download tools available.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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/KaiQin04/ig-download-mcp'

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