Skip to main content
Glama

get_ad_details

Retrieve detailed ad information including creative reference, tracking specs, conversion specs, issues, and recommendations by providing the ad ID.

Instructions

Get detailed ad information including creative reference, tracking specs, conversion specs, issues, and recommendations.

Args: ad_id: Ad ID (numeric string).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ad_idYes

Implementation Reference

  • The @mcp.tool() decorated function that implements the 'get_ad_details' tool. Calls the Meta Graph API with AD_DETAIL_FIELDS, then enriches the result with creative details by fetching the associated creative resource. Handles errors gracefully if the creative fetch fails.
    @mcp.tool()
    def get_ad_details(ad_id: str) -> dict:
        """
        Get detailed ad information including creative reference,
        tracking specs, conversion specs, issues, and recommendations.
    
        Args:
            ad_id: Ad ID (numeric string).
        """
        api_client._ensure_initialized()
        try:
            result = api_client.graph_get(f"/{ad_id}", fields=AD_DETAIL_FIELDS)
            creative_ref = result.get("creative")
            if creative_ref and isinstance(creative_ref, dict):
                creative_id = creative_ref.get("id")
                if creative_id:
                    try:
                        creative_details = api_client.graph_get(
                            f"/{creative_id}",
                            fields=[
                                "id", "name", "title", "body", "status",
                                "thumbnail_url", "image_url",
                                "object_story_spec", "asset_feed_spec",
                                "degrees_of_freedom_spec",
                                "url_tags", "call_to_action_type",
                            ],
                        )
                        result["creative_details"] = creative_details
                    except MetaAPIError as e:
                        logger.warning("Could not fetch creative %s: %s", creative_id, e)
                        result["creative_details"] = {"error": str(e)}
            result["rate_limit_usage_pct"] = api_client.rate_limits.max_usage_pct
            return result
        except MetaAPIError:
            raise
  • AD_DETAIL_FIELDS constant defining the API fields fetched by get_ad_details, extending AD_LIST_FIELDS with bid_amount, bid_type, conversion_specs, source_ad_id, issues_info, and recommendations.
    # Fields for detail view
    AD_DETAIL_FIELDS = AD_LIST_FIELDS + [
        "bid_amount", "bid_type",
        "conversion_specs", "source_ad_id",
        "issues_info", "recommendations",
    ]
  • The @mcp.tool() decorator that registers get_ad_details as an MCP tool. This is the only registration needed since the decorator handles it directly. The ads module is imported in server.py (line 28) to trigger registration.
    @mcp.tool()
Behavior2/5

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

No annotations are provided, and the description only lists output fields without disclosing behavioral traits such as authentication requirements, rate limits, or side effects.

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 concise with a clear list of output fields and an Args section, but could be more structured (e.g., markdown formatting).

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

Completeness3/5

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

For a single-parameter tool with no output schema or annotations, the description covers basic purpose and parameter info but is incomplete regarding return format or usage hints.

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?

The description adds meaning to the `ad_id` parameter by specifying it is a numeric string, which the schema lacks (only type string). However, no further validation rules or constraints are given.

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 retrieves detailed ad information including specific fields (creative reference, tracking specs, etc.), distinguishing it from sibling tools like get_creative_details or get_ads.

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?

No explicit guidance on when to use versus alternatives; the purpose is implied but lacks when-not or alternative references.

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/brandu-mos/konquest-meta-ads-mcp'

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